hal: Update ACDB device id retrieval for speaker protection

Modify audio HAL to retrieve acdb device ids in
a uniform manner. Remove duplicate function for
fetching acdb device.

Bug: 77292011
Test: manual audio regression tests on B1

Change-Id: I1a26c0095c7a9a38497a8807b7308961ede25b8e
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 1f8da65..170dbd8 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -1350,6 +1350,12 @@
         return -EINVAL;
     }
 
+    /*
+     * If speaker protection is enabled, function returns supported
+     * sound device for speaker. Else same sound device is returned.
+     */
+    snd_device = audio_extn_get_spkr_prot_snd_device(snd_device);
+
     if (operator_specific_device_table[snd_device] != NULL)
         return get_operator_specific_device_acdb_id(snd_device);
     else
@@ -1362,7 +1368,7 @@
     int acdb_dev_id, acdb_dev_type;
     int sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
 
-    acdb_dev_id = acdb_device_table[audio_extn_get_spkr_prot_snd_device(snd_device)];
+    acdb_dev_id = platform_get_snd_device_acdb_id(snd_device);
     if (acdb_dev_id < 0) {
         ALOGE("%s: Could not find acdb id for device(%d)",
               __func__, snd_device);
@@ -1421,10 +1427,6 @@
     if (my_data->acdb_send_voice_cal == NULL) {
         ALOGE("%s: dlsym error for acdb_send_voice_call", __func__);
     } else {
-        if (out_snd_device == SND_DEVICE_OUT_VOICE_SPEAKER &&
-            audio_extn_spkr_prot_is_enabled())
-            out_snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED;
-
         acdb_rx_id = platform_get_snd_device_acdb_id(out_snd_device);
         acdb_tx_id = platform_get_snd_device_acdb_id(in_snd_device);