Loading hal/audio_extn/audio_extn.c +21 −9 Original line number Diff line number Diff line Loading @@ -211,6 +211,10 @@ static int32_t afe_proxy_set_channel_mapping(struct audio_device *adev, ALOGV("%s channel_count:%d",__func__, channel_count); switch (channel_count) { case 2: set_values[0] = PCM_CHANNEL_FL; set_values[1] = PCM_CHANNEL_FR; break; case 6: set_values[0] = PCM_CHANNEL_FL; set_values[1] = PCM_CHANNEL_FR; Loading Loading @@ -248,7 +252,8 @@ static int32_t afe_proxy_set_channel_mapping(struct audio_device *adev, return ret; } int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev) int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev, int channel_count) { int32_t ret = 0; const char *channel_cnt_str = NULL; Loading @@ -259,9 +264,8 @@ int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev) /* use the existing channel count set by hardware params to configure the back end for stereo as usb/a2dp would be stereo by default */ ALOGD("%s: channels = %d", __func__, aextnmod.proxy_channel_num); switch (aextnmod.proxy_channel_num) { ALOGD("%s: channels = %d", __func__, channel_count); switch (channel_count) { case 8: channel_cnt_str = "Eight"; break; case 7: channel_cnt_str = "Seven"; break; case 6: channel_cnt_str = "Six"; break; Loading @@ -271,7 +275,7 @@ int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev) default: channel_cnt_str = "Two"; break; } if(aextnmod.proxy_channel_num >= 2 && aextnmod.proxy_channel_num < 8) { if(channel_count >= 2 && channel_count <= 8) { ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); if (!ctl) { ALOGE("%s: could not get ctl for mixer cmd - %s", Loading @@ -281,10 +285,12 @@ int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev) } mixer_ctl_set_enum_by_string(ctl, channel_cnt_str); if (aextnmod.proxy_channel_num == 6 || aextnmod.proxy_channel_num == 8) ret = afe_proxy_set_channel_mapping(adev, aextnmod.proxy_channel_num); if (channel_count == 6 || channel_count == 8 || channel_count == 2) { ret = afe_proxy_set_channel_mapping(adev, channel_count); } else { ALOGE("%s: set unsupported channel count(%d)", __func__, channel_count); ret = -EINVAL; } ALOGD("%s: exit", __func__); return ret; Loading Loading @@ -354,6 +360,12 @@ int32_t audio_extn_read_afe_proxy_channel_masks(struct stream_out *out) } return ret; } int32_t audio_extn_get_afe_proxy_channel_count() { return aextnmod.proxy_channel_num; } #endif /* AFE_PROXY_ENABLED */ void audio_extn_set_parameters(struct audio_device *adev, Loading hal/audio_extn/audio_extn.h +7 −3 Original line number Diff line number Diff line Loading @@ -40,11 +40,15 @@ bool audio_extn_should_use_handset_anc(int in_channels); #endif #ifndef AFE_PROXY_ENABLED #define audio_extn_set_afe_proxy_channel_mixer(adev) (0) #define audio_extn_set_afe_proxy_channel_mixer(adev,channel_count) (0) #define audio_extn_read_afe_proxy_channel_masks(out) (0) #define audio_extn_get_afe_proxy_channel_count() (0) #else int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev); int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev, int channel_count); int32_t audio_extn_read_afe_proxy_channel_masks(struct stream_out *out); int32_t audio_extn_get_afe_proxy_channel_count(); #endif #ifndef USB_HEADSET_ENABLED Loading hal/msm8916/platform.c +5 −2 Original line number Diff line number Diff line Loading @@ -1179,14 +1179,17 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi snd_device = SND_DEVICE_OUT_HDMI ; } else if (devices & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET || devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) { ALOGD("%s: setting USB hadset channel capability(2) for Proxy", __func__); audio_extn_set_afe_proxy_channel_mixer(adev, 2); snd_device = SND_DEVICE_OUT_USB_HEADSET; } else if (devices & AUDIO_DEVICE_OUT_FM_TX) { snd_device = SND_DEVICE_OUT_TRANSMISSION_FM; } else if (devices & AUDIO_DEVICE_OUT_EARPIECE) { snd_device = SND_DEVICE_OUT_HANDSET; } else if (devices & AUDIO_DEVICE_OUT_PROXY) { ALOGD("%s: setting sink capability for Proxy", __func__); audio_extn_set_afe_proxy_channel_mixer(adev); channel_count = audio_extn_get_afe_proxy_channel_count(); ALOGD("%s: setting sink capability(%d) for Proxy", __func__, channel_count); audio_extn_set_afe_proxy_channel_mixer(adev, channel_count); snd_device = SND_DEVICE_OUT_AFE_PROXY; } else { ALOGE("%s: Unknown device(s) %#x", __func__, devices); Loading hal/msm8974/platform.c +5 −2 Original line number Diff line number Diff line Loading @@ -1254,14 +1254,17 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi snd_device = SND_DEVICE_OUT_HDMI ; } else if (devices & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET || devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) { ALOGD("%s: setting USB hadset channel capability(2) for Proxy", __func__); audio_extn_set_afe_proxy_channel_mixer(adev, 2); snd_device = SND_DEVICE_OUT_USB_HEADSET; } else if (devices & AUDIO_DEVICE_OUT_FM_TX) { snd_device = SND_DEVICE_OUT_TRANSMISSION_FM; } else if (devices & AUDIO_DEVICE_OUT_EARPIECE) { snd_device = SND_DEVICE_OUT_HANDSET; } else if (devices & AUDIO_DEVICE_OUT_PROXY) { ALOGD("%s: setting sink capability for Proxy", __func__); audio_extn_set_afe_proxy_channel_mixer(adev); channel_count = audio_extn_get_afe_proxy_channel_count(); ALOGD("%s: setting sink capability(%d) for Proxy", __func__, channel_count); audio_extn_set_afe_proxy_channel_mixer(adev, channel_count); snd_device = SND_DEVICE_OUT_AFE_PROXY; } else { ALOGE("%s: Unknown device(s) %#x", __func__, devices); Loading Loading
hal/audio_extn/audio_extn.c +21 −9 Original line number Diff line number Diff line Loading @@ -211,6 +211,10 @@ static int32_t afe_proxy_set_channel_mapping(struct audio_device *adev, ALOGV("%s channel_count:%d",__func__, channel_count); switch (channel_count) { case 2: set_values[0] = PCM_CHANNEL_FL; set_values[1] = PCM_CHANNEL_FR; break; case 6: set_values[0] = PCM_CHANNEL_FL; set_values[1] = PCM_CHANNEL_FR; Loading Loading @@ -248,7 +252,8 @@ static int32_t afe_proxy_set_channel_mapping(struct audio_device *adev, return ret; } int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev) int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev, int channel_count) { int32_t ret = 0; const char *channel_cnt_str = NULL; Loading @@ -259,9 +264,8 @@ int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev) /* use the existing channel count set by hardware params to configure the back end for stereo as usb/a2dp would be stereo by default */ ALOGD("%s: channels = %d", __func__, aextnmod.proxy_channel_num); switch (aextnmod.proxy_channel_num) { ALOGD("%s: channels = %d", __func__, channel_count); switch (channel_count) { case 8: channel_cnt_str = "Eight"; break; case 7: channel_cnt_str = "Seven"; break; case 6: channel_cnt_str = "Six"; break; Loading @@ -271,7 +275,7 @@ int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev) default: channel_cnt_str = "Two"; break; } if(aextnmod.proxy_channel_num >= 2 && aextnmod.proxy_channel_num < 8) { if(channel_count >= 2 && channel_count <= 8) { ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); if (!ctl) { ALOGE("%s: could not get ctl for mixer cmd - %s", Loading @@ -281,10 +285,12 @@ int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev) } mixer_ctl_set_enum_by_string(ctl, channel_cnt_str); if (aextnmod.proxy_channel_num == 6 || aextnmod.proxy_channel_num == 8) ret = afe_proxy_set_channel_mapping(adev, aextnmod.proxy_channel_num); if (channel_count == 6 || channel_count == 8 || channel_count == 2) { ret = afe_proxy_set_channel_mapping(adev, channel_count); } else { ALOGE("%s: set unsupported channel count(%d)", __func__, channel_count); ret = -EINVAL; } ALOGD("%s: exit", __func__); return ret; Loading Loading @@ -354,6 +360,12 @@ int32_t audio_extn_read_afe_proxy_channel_masks(struct stream_out *out) } return ret; } int32_t audio_extn_get_afe_proxy_channel_count() { return aextnmod.proxy_channel_num; } #endif /* AFE_PROXY_ENABLED */ void audio_extn_set_parameters(struct audio_device *adev, Loading
hal/audio_extn/audio_extn.h +7 −3 Original line number Diff line number Diff line Loading @@ -40,11 +40,15 @@ bool audio_extn_should_use_handset_anc(int in_channels); #endif #ifndef AFE_PROXY_ENABLED #define audio_extn_set_afe_proxy_channel_mixer(adev) (0) #define audio_extn_set_afe_proxy_channel_mixer(adev,channel_count) (0) #define audio_extn_read_afe_proxy_channel_masks(out) (0) #define audio_extn_get_afe_proxy_channel_count() (0) #else int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev); int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev, int channel_count); int32_t audio_extn_read_afe_proxy_channel_masks(struct stream_out *out); int32_t audio_extn_get_afe_proxy_channel_count(); #endif #ifndef USB_HEADSET_ENABLED Loading
hal/msm8916/platform.c +5 −2 Original line number Diff line number Diff line Loading @@ -1179,14 +1179,17 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi snd_device = SND_DEVICE_OUT_HDMI ; } else if (devices & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET || devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) { ALOGD("%s: setting USB hadset channel capability(2) for Proxy", __func__); audio_extn_set_afe_proxy_channel_mixer(adev, 2); snd_device = SND_DEVICE_OUT_USB_HEADSET; } else if (devices & AUDIO_DEVICE_OUT_FM_TX) { snd_device = SND_DEVICE_OUT_TRANSMISSION_FM; } else if (devices & AUDIO_DEVICE_OUT_EARPIECE) { snd_device = SND_DEVICE_OUT_HANDSET; } else if (devices & AUDIO_DEVICE_OUT_PROXY) { ALOGD("%s: setting sink capability for Proxy", __func__); audio_extn_set_afe_proxy_channel_mixer(adev); channel_count = audio_extn_get_afe_proxy_channel_count(); ALOGD("%s: setting sink capability(%d) for Proxy", __func__, channel_count); audio_extn_set_afe_proxy_channel_mixer(adev, channel_count); snd_device = SND_DEVICE_OUT_AFE_PROXY; } else { ALOGE("%s: Unknown device(s) %#x", __func__, devices); Loading
hal/msm8974/platform.c +5 −2 Original line number Diff line number Diff line Loading @@ -1254,14 +1254,17 @@ snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devi snd_device = SND_DEVICE_OUT_HDMI ; } else if (devices & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET || devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) { ALOGD("%s: setting USB hadset channel capability(2) for Proxy", __func__); audio_extn_set_afe_proxy_channel_mixer(adev, 2); snd_device = SND_DEVICE_OUT_USB_HEADSET; } else if (devices & AUDIO_DEVICE_OUT_FM_TX) { snd_device = SND_DEVICE_OUT_TRANSMISSION_FM; } else if (devices & AUDIO_DEVICE_OUT_EARPIECE) { snd_device = SND_DEVICE_OUT_HANDSET; } else if (devices & AUDIO_DEVICE_OUT_PROXY) { ALOGD("%s: setting sink capability for Proxy", __func__); audio_extn_set_afe_proxy_channel_mixer(adev); channel_count = audio_extn_get_afe_proxy_channel_count(); ALOGD("%s: setting sink capability(%d) for Proxy", __func__, channel_count); audio_extn_set_afe_proxy_channel_mixer(adev, channel_count); snd_device = SND_DEVICE_OUT_AFE_PROXY; } else { ALOGE("%s: Unknown device(s) %#x", __func__, devices); Loading