From 77a98ada1255ecf38b7f59924bb13673a5fd4121 Mon Sep 17 00:00:00 2001 From: Dana Conrad Date: Tue, 10 Aug 2021 18:14:32 -0500 Subject: [PATCH] Eros Q Native: Make Mute logic channel-independent An oversight on my part meant that setting channel balance to 100% L or 100% R would mute both channels - this logic will prevent that. Change-Id: I912c2745784fbbbd7a773e1234179801f2ca4680 --- firmware/drivers/audio/eros_qn_codec.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/firmware/drivers/audio/eros_qn_codec.c b/firmware/drivers/audio/eros_qn_codec.c index 17b0acf13e..da50d62fe5 100644 --- a/firmware/drivers/audio/eros_qn_codec.c +++ b/firmware/drivers/audio/eros_qn_codec.c @@ -70,14 +70,10 @@ void audiohw_set_volume(int vol_l, int vol_r) } #endif - if (l <= PCM5102A_VOLUME_MIN || r <= PCM5102A_VOLUME_MIN) - { - pcm_set_master_volume(PCM_MUTE_LEVEL, PCM_MUTE_LEVEL); - } - else - { - pcm_set_master_volume(l/20, r/20); - } + l = l <= PCM5102A_VOLUME_MIN ? PCM_MUTE_LEVEL : (l / 20); + r = r <= PCM5102A_VOLUME_MIN ? PCM_MUTE_LEVEL : (r / 20); + + pcm_set_master_volume(l, r); } void audiohw_mute_hp(int mute)