hal: add sidetone support for USB
if usb device provides sidetone contols
- disable sidetone when usb is detected
- enable side tone only for calls.
Bug: 37404459
Test: made voice call, confirmed sidetone. Following call,
music capture and playback does not have sidetone present.
Change-Id: If2e4926f50aaaae07ea72fd5528ab0cd6658d8ab
Signed-off-by: Andrew Chant <achant@google.com>
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 6d92d93..628d1d6 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -2335,3 +2335,25 @@
return -ENOSYS;
}
+int platform_set_sidetone(struct audio_device *adev,
+ snd_device_t out_snd_device,
+ bool enable, char *str)
+{
+ int ret;
+ if (out_snd_device == SND_DEVICE_OUT_USB_HEADSET ||
+ out_snd_device == SND_DEVICE_OUT_VOICE_USB_HEADSET) {
+ ret = audio_extn_usb_enable_sidetone(out_snd_device, enable);
+ if (ret)
+ ALOGI("%s: usb device %d does not support device sidetone\n",
+ __func__, out_snd_device);
+ } else {
+ ALOGV("%s: sidetone out device(%d) mixer cmd = %s\n",
+ __func__, out_snd_device, str);
+
+ if (enable)
+ audio_route_apply_and_update_path(adev->audio_route, str);
+ else
+ audio_route_reset_and_update_path(adev->audio_route, str);
+ }
+ return 0;
+}