hal: configure headphone quality based on backend configuration
Newer generation of WCD CODEC support different modes on headphone
path in order to provide trade off between power and quality.
Update audio HAL to configure CODEC headphone path to different mode
depending on desired back-end configuration when output sound device
to be enabled is headphone.
Change-Id: Iafa281843bcf8871df55b985ecd697880175e282
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index f12114a..7d6f02b 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -4251,6 +4251,17 @@
}
}
+ if (snd_device == SND_DEVICE_OUT_HEADPHONES || snd_device ==
+ SND_DEVICE_OUT_HEADPHONES_44_1) {
+ if (sample_rate > 48000 || (sample_rate == 48000 && bit_width >= 24)) {
+ ALOGV("%s: apply HPH HQ mode\n", __func__);
+ audio_route_apply_and_update_path(adev->audio_route, "hph-highquality-mode");
+ } else {
+ ALOGV("%s: apply HPH LP mode\n", __func__);
+ audio_route_apply_and_update_path(adev->audio_route, "hph-lowpower-mode");
+ }
+ }
+
return ret;
}