struct yamaha_mc1n2_audio_params_route *
yamaha_mc1n2_audio_params_route_find(struct yamaha_mc1n2_audio_pdata *pdata,
- audio_devices_t device, audio_mode_t mode)
+ audio_devices_t device, enum yamaha_mc1n2_audio_direction direction)
{
struct yamaha_mc1n2_audio_params_route *params = NULL;
int params_count = 0;
return NULL;
for(i=0 ; i < params_count ; i++) {
- if(params[i].device == device && params[i].mode == mode)
+ if(params[i].device == device && params[i].direction == direction)
return ¶ms[i];
}
int rc;
+ LOGD("%s()", __func__);
+
if(pdata == NULL || pdata->ops == NULL)
return -1;
output_merge:
if(pdata->output_state) {
params_route = yamaha_mc1n2_audio_params_route_find(pdata,
- pdata->output_device, pdata->mode);
+ pdata->output_device, YAMAHA_MC1N2_AUDIO_DIRECTION_OUTPUT);
if(params_route == NULL)
goto input_merge;
input_merge:
if(pdata->input_state) {
params_route = yamaha_mc1n2_audio_params_route_find(pdata,
- pdata->input_device, pdata->mode);
+ pdata->input_device, YAMAHA_MC1N2_AUDIO_DIRECTION_INPUT);
+ if(params_route == NULL)
+ goto modem_merge;
+
+ memcpy(¶ms_dst, params_route, sizeof(params_dst));
+ yamaha_mc1n2_audio_params_route_merge(¶ms_src, ¶ms_dst);
+ memcpy(¶ms_src, ¶ms_dst, sizeof(params_src));
+ }
+
+modem_merge:
+ if(pdata->modem_state) {
+ params_route = yamaha_mc1n2_audio_params_route_find(pdata,
+ pdata->output_device, YAMAHA_MC1N2_AUDIO_DIRECTION_MODEM);
if(params_route == NULL)
goto route_start;
{
int rc;
+ LOGD("%s()", __func__);
+
if(pdata == NULL || pdata->ops == NULL)
return -1;
{
int rc;
+ LOGD("%s()", __func__);
+
if(pdata == NULL || pdata->ops == NULL)
return -1;
{
int rc;
+ LOGD("%s()", __func__);
+
if(pdata == NULL || pdata->ops == NULL)
return -1;
{
int rc;
+ LOGD("%s()", __func__);
+
if(pdata == NULL || pdata->ops == NULL)
return -1;
return 0;
}
+int yamaha_mc1n2_audio_modem_start(struct yamaha_mc1n2_audio_pdata *pdata)
+{
+ int rc;
+
+ LOGD("%s()", __func__);
+
+ if(pdata == NULL || pdata->ops == NULL)
+ return -1;
+
+ pdata->modem_state = 1;
+
+ rc = yamaha_mc1n2_audio_route_start(pdata);
+ if(rc < 0) {
+ LOGE("Route start failed, aborting!");
+ return -1;
+ }
+
+ rc = yamaha_mc1n2_audio_ioctl_notify(pdata, MCDRV_NOTIFY_CALL_START);
+ if(rc < 0) {
+ LOGE("NOTIFY_CALL_START IOCTL failed, aborting!");
+ return -1;
+ }
+
+ return 0;
+}
+
+int yamaha_mc1n2_audio_modem_stop(struct yamaha_mc1n2_audio_pdata *pdata)
+{
+ int rc;
+
+ LOGD("%s()", __func__);
+
+ if(pdata == NULL || pdata->ops == NULL)
+ return -1;
+
+ pdata->modem_state = 0;
+
+ rc = yamaha_mc1n2_audio_route_start(pdata);
+ if(rc < 0) {
+ LOGE("Route start failed, aborting!");
+ return -1;
+ }
+
+ rc = yamaha_mc1n2_audio_ioctl_notify(pdata, MCDRV_NOTIFY_CALL_STOP);
+ if(rc < 0) {
+ LOGE("NOTIFY_CALL_START IOCTL failed, aborting!");
+ return -1;
+ }
+
+ return 0;
+}
+
/*
* Values configuration
*/
int yamaha_mc1n2_audio_set_route(struct yamaha_mc1n2_audio_pdata *pdata,
- audio_devices_t device, audio_mode_t mode)
+ audio_devices_t device)
{
int changed = 0;
+ LOGD("%s(%x)", __func__, device);
+
if(pdata == NULL)
return -1;
changed = 1;
}
- if(pdata->mode != mode) {
- pdata->mode = mode;
- changed = 1;
- }
-
- if(changed && (pdata->output_state || pdata->input_state))
+ if(changed && (pdata->output_state || pdata->input_state || pdata->modem_state))
return yamaha_mc1n2_audio_route_start(pdata);
return 0;
struct yamaha_mc1n2_audio_pdata *pdata = NULL;
int rc;
+ LOGD("%s(%s)", __func__, device_name);
+
if(pdata_p == NULL || device_name == NULL)
return -1;
if(pdata == NULL)
return -1;
+ LOGD("%s()", __func__);
+
return 0;
}