hal: send correct ACDB id
- wrong usage of function is resulting in invalid ACDB id to be passed
to ACDB loader.
- ACDB id for o/p device is incorrectly converted to sound device and
is passed to get corresponding ACDB id. This results in passing invalid
ACDB id below.
Bug: 22460430.
Change-Id: I24a470c453daea68ff14a94c03a157487f33ac66
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 63808c4..03aa596 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -463,7 +463,6 @@
int mode = CAL_MODE_RTAC;
struct listnode *node;
struct audio_usecase *usecase;
- snd_device_t snd_device;
if (my_data->acdb_send_gain_dep_cal == NULL) {
ALOGE("%s: dlsym error for acdb_send_gain_dep_cal", __func__);
@@ -484,8 +483,12 @@
(usecase->stream.out->devices == AUDIO_DEVICE_OUT_SPEAKER)) {
ALOGV("%s: out device is %d", __func__, usecase->out_snd_device);
- snd_device = audio_extn_spkr_prot_get_acdb_id(usecase->out_snd_device);
- acdb_dev_id = acdb_device_table[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