summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorDana Conrad <dconrad@fastmail.com>2021-08-10 18:14:32 -0500
committerDana Conrad <dconrad@fastmail.com>2021-08-10 18:15:53 -0500
commit77a98ada1255ecf38b7f59924bb13673a5fd4121 (patch)
tree3d2e831eba6d03ac27394aa158e479cf9c0e3a56 /firmware
parentcdd1f901313a15d13531aecf85b97bc668af4793 (diff)
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
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/audio/eros_qn_codec.c12
1 files 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)