audio: Update hal to handle 32bit/384kHz playback.
Update the mixer control string used to configure BE at 32bit format
with correct value.
For HDMI backend, as it does not support 32bit/384kHz, configure
BE to 24bit/192kHz if supported by the connected device.
Configure speaker device to bit width supported on the device
if stream bit width is greater than 24 bit.
Change-Id: Ic1c437d4cb15db709941eec065d40b2ae173ea9d
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index fa5d0e4..a5cc804 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -4304,7 +4304,7 @@
else
mixer_ctl_set_enum_by_string(ctl, "S24_LE");
} else if (bit_width == 32) {
- mixer_ctl_set_enum_by_string(ctl, "S24_LE");
+ mixer_ctl_set_enum_by_string(ctl, "S32_LE");
} else {
mixer_ctl_set_enum_by_string(ctl, "S16_LE");
}
@@ -4640,6 +4640,13 @@
} else if ((usecase->devices & AUDIO_DEVICE_OUT_SPEAKER) ||
(usecase->devices & AUDIO_DEVICE_OUT_EARPIECE) ) {
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
+
+ if (bit_width >= 24) {
+ bit_width = platform_get_snd_device_bit_width(SND_DEVICE_OUT_SPEAKER);
+ ALOGD("%s:becf: afe: reset bitwidth to %d (based on supported"
+ " value for this platform)", __func__, bit_width);
+ }
+
ALOGD("%s:becf: afe: playback on codec device not supporting native playback set "
"default Sample Rate(48k)", __func__);
}
@@ -4660,6 +4667,13 @@
hdmi_backend_cfg.channels = channels;
hdmi_backend_cfg.passthrough_enabled = false;
+ /*HDMI does not support 384Khz/32bit playback hence configure BE to 24b/192Khz*/
+ /* TODO: Instead have the validation against edid return the next best match*/
+ if (bit_width > 24)
+ hdmi_backend_cfg.bit_width = 24;
+ if (sample_rate > 192000)
+ hdmi_backend_cfg.sample_rate = 192000;
+
platform_check_hdmi_backend_cfg(adev, usecase, backend_idx, &hdmi_backend_cfg);
bit_width = hdmi_backend_cfg.bit_width;