hal: MBDRC: use correct ACDB id when speaker protection is enabled
Check if speaker protection is enabled, if so get acdb id for
speaker protected sound device.
Change-Id: I74d1ad6981b2243af9a40b660935e9c5ab6cc8fe
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 875cc2c..a194184 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -741,12 +741,17 @@
if (usecase != NULL &&
usecase->type == PCM_PLAYBACK &&
- (usecase->stream.out->devices == AUDIO_DEVICE_OUT_SPEAKER ||
- usecase->stream.out->devices == AUDIO_DEVICE_OUT_SPEAKER_SAFE)) {
+ usecase->stream.out->devices == AUDIO_DEVICE_OUT_SPEAKER) {
ALOGV("%s: out device is %d", __func__, usecase->out_snd_device);
app_type = usecase->stream.out->app_type_cfg.app_type;
- acdb_dev_id = acdb_device_table[usecase->out_snd_device];
+
+ if (audio_extn_spkr_prot_is_enabled()) {
+ acdb_dev_id = audio_extn_spkr_prot_get_acdb_id(usecase->out_snd_device);
+ } else {
+ acdb_dev_id = acdb_device_table[usecase->out_snd_device];
+ }
+
if (!my_data->acdb_send_gain_dep_cal(acdb_dev_id, app_type,
acdb_dev_type, mode, level)) {
// set ret_val true if at least one calibration is set successfully