hal: prevent device switch when speaker swap channel
Issue happens while music playback with touch sound enabled.
music playback started in the first place and touch sound created
low-latency playback with device switch when device orientation
changed.
This fix disabled the device switch when acdb tuning is the same
for SPEAKER & SPEAKER_REVERSE. Since walleye uses ADSP mixer control
for swap channel, the acdb setting is the same for SPEAKER &
SPEAKER_REVERSE.
Test: self-tested for over 50 times.
Bug: 77499491
Change-Id: Ie602cf1b1ee533a46714c569fa0da9b40da9e25b
Signed-off-by: andysu <andysu@android.com>
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 4b91bcd..1f8da65 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -1701,7 +1701,13 @@
} else if (devices & AUDIO_DEVICE_OUT_LINE) {
snd_device = SND_DEVICE_OUT_LINE;
} else if (devices & AUDIO_DEVICE_OUT_SPEAKER) {
- if (my_data->speaker_lr_swap)
+ /*
+ * Perform device switch only if acdb tuning is different between SPEAKER & SPEAKER_REVERSE,
+ * Or there will be a small pause while performing device switch.
+ */
+ if (my_data->speaker_lr_swap &&
+ (acdb_device_table[SND_DEVICE_OUT_SPEAKER] !=
+ acdb_device_table[SND_DEVICE_OUT_SPEAKER_REVERSE]))
snd_device = SND_DEVICE_OUT_SPEAKER_REVERSE;
else
snd_device = SND_DEVICE_OUT_SPEAKER;