hal: Add device sidetone support for USB audio ADSP solution
Add device sidetone support for USB ADSP solution if the USB headset
has the sidetone capability.
CRs-Fixed: 1019158
Change-Id: Ie40c286eb9988aeb5093f32c7f81cdb142e88eb6
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index b7d326c..d60d67c 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -3567,6 +3567,7 @@
set_audiocal(platform, parms, value, len);
native_audio_set_params(platform, parms, value, len);
audio_extn_spkr_prot_set_parameters(parms, value, len);
+ audio_extn_usb_set_sidetone_gain(parms, value, len);
perf_lock_set_params(platform, parms, value, len);
done:
ALOGV("%s: exit with code(%d)", __func__, ret);
@@ -5163,4 +5164,25 @@
return ret;
}
+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) {
+ 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;
+}