Merge "hal: Avoid setting wrong sample rate for headset device"
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 2cd0db0..d2017c5 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -6340,7 +6340,7 @@
* Handset and speaker may have diffrent backend. Check if the device is speaker or handset,
* and these devices are restricited to 48kHz.
*/
- if ((platform_get_backend_index(snd_device) == DEFAULT_CODEC_BACKEND) &&
+ if (!codec_device_supports_native_playback(usecase->devices) &&
(platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, snd_device) ||
platform_check_backends_match(SND_DEVICE_OUT_HANDSET, snd_device))) {
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 987e7a8..e03792c 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -6513,7 +6513,7 @@
* Handset and speaker may have diffrent backend. Check if the device is speaker or handset,
* and these devices are restricited to 48kHz.
*/
- if ((platform_get_backend_index(snd_device) == DEFAULT_CODEC_BACKEND) &&
+ if (!codec_device_supports_native_playback(usecase->devices) &&
(platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, snd_device) ||
platform_check_backends_match(SND_DEVICE_OUT_HANDSET, snd_device))) {
if (bit_width >= 24) {