diff options
-rw-r--r-- | audio/audio_hw.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index ad8c620..355c8e4 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -366,7 +366,6 @@ static int set_route_by_array(struct mixer *mixer, struct route_setting *route, void select_devices(struct m0_audio_device *adev) { int i; - if (adev->active_out_device == adev->out_device && adev->active_in_device == adev->in_device) return; @@ -375,27 +374,31 @@ void select_devices(struct m0_audio_device *adev) /* Turn on new devices first so we don't glitch due to powerdown... */ for (i = 0; i < adev->num_dev_cfgs; i++) - if ((adev->out_device & adev->dev_cfgs[i].mask) && - !(adev->active_out_device & adev->dev_cfgs[i].mask)) + if (((adev->out_device & adev->dev_cfgs[i].mask) && + !(adev->active_out_device & adev->dev_cfgs[i].mask)) && + !(adev->dev_cfgs[i].mask & AUDIO_DEVICE_BIT_IN)) { set_route_by_array(adev->mixer, adev->dev_cfgs[i].on, adev->dev_cfgs[i].on_len); - +} for (i = 0; i < adev->num_dev_cfgs; i++) - if ((adev->in_device & adev->dev_cfgs[i].mask) && - !(adev->active_in_device & adev->dev_cfgs[i].mask)) + if (((adev->in_device & adev->dev_cfgs[i].mask) && + !(adev->active_in_device & adev->dev_cfgs[i].mask)) && + (adev->dev_cfgs[i].mask & AUDIO_DEVICE_BIT_IN)) set_route_by_array(adev->mixer, adev->dev_cfgs[i].on, adev->dev_cfgs[i].on_len); /* ...then disable old ones. */ for (i = 0; i < adev->num_dev_cfgs; i++) - if (!(adev->out_device & adev->dev_cfgs[i].mask) && - (adev->active_out_device & adev->dev_cfgs[i].mask)) + if ((!(adev->out_device & adev->dev_cfgs[i].mask) && + (adev->active_out_device & adev->dev_cfgs[i].mask)) && + !(adev->dev_cfgs[i].mask & AUDIO_DEVICE_BIT_IN)) set_route_by_array(adev->mixer, adev->dev_cfgs[i].off, adev->dev_cfgs[i].off_len); for (i = 0; i < adev->num_dev_cfgs; i++) - if (!(adev->in_device & adev->dev_cfgs[i].mask) && - (adev->active_in_device & adev->dev_cfgs[i].mask)) + if ((!(adev->in_device & adev->dev_cfgs[i].mask) && + (adev->active_in_device & adev->dev_cfgs[i].mask)) && + (adev->dev_cfgs[i].mask & AUDIO_DEVICE_BIT_IN)) set_route_by_array(adev->mixer, adev->dev_cfgs[i].off, adev->dev_cfgs[i].off_len); @@ -540,7 +543,7 @@ static void set_incall_device(struct m0_audio_device *adev) case AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET: case AUDIO_DEVICE_OUT_AUX_DIGITAL: rx_dev_id = DEVICE_SPEAKER_MONO_RX_ACDB_ID; - tx_dev_id = DEVICE_HANDSET_TX_ACDB_ID; + tx_dev_id = DEVICE_SPEAKER_TX_ACDB_ID; voice_index = 9; break; case AUDIO_DEVICE_OUT_WIRED_HEADSET: @@ -783,14 +786,6 @@ static void select_output_device(struct m0_audio_device *adev) set_bigroute_by_array(adev->mixer, default_input_disable, 1); } - if (speaker_on) { - ALOGD("%s: set voicecall route: speaker_output", __func__); - set_bigroute_by_array(adev->mixer, speaker_output, 1); - } else { - ALOGD("%s: set voicecall route: speaker_output_disable", __func__); - set_bigroute_by_array(adev->mixer, speaker_output_disable, 1); - } - if (headset_on) { ALOGD("%s: set voicecall route: headset_input", __func__); set_bigroute_by_array(adev->mixer, headset_input, 1); |