diff mbox series

[alsa-lib,5/5] mixer: simple - Add exceptions for some Playback Switches with a " Channel Switch" suffix

Message ID 20210503205231.167346-6-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series Add generic exception mechanism for non-standard control-names | expand

Commit Message

Hans de Goede May 3, 2021, 8:52 p.m. UTC
The following ASoC codec drivers:
sound/soc/codecs/rt5640.c
sound/soc/codecs/rt5645.c

Use the following troublesome playback-switch-control names:

"Headphone Channel Switch"
"HP Channel Switch"
"Speaker Channel Switch"

There are 2 problems with these names:

1. They are the mute controls for the matching:
"Headphone Playback Volume"
"HP Playback Volume"
"Speaker Playback Volume"
controls, to be properly paired, which is necessary for HW volume-control
support, the simple mixer code needs to recognize that the base-name for
these is e.g. "Headphone" not "Headphone Channel".

2. They are playback-switches, yet they get recognized as global-switches.

Add these to the exceptions table so that they get the proper basename
and type set.

Note we can NOT fix this by adding " Channel Switch" as a suffix to the
suffixes table, because the line-out output on these codecs has the
following controls:

"OUT Playback Switch"
"OUT Channel Switch"
"OUT Playback Volume"

Where the 2 switches describe mutes in 2 different places in the graph.

So if we were to add a " Channel Switch" suffix map to CTL_PLAYBACK_SWITCH
then we would get 2 CTL_PLAYBACK_SWITCH controls for the "OUT" mixer
element, which is not allowed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 src/mixer/simple_none.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/src/mixer/simple_none.c b/src/mixer/simple_none.c
index de81966f..d5025f68 100644
--- a/src/mixer/simple_none.c
+++ b/src/mixer/simple_none.c
@@ -933,6 +933,9 @@  static const struct excep {
 	{"3D Control - Depth", 18, CTL_PLAYBACK_VOLUME},
 	{"3D Control Sigmatel - Depth", 27, CTL_PLAYBACK_VOLUME},
 	{"3D Control Sigmatel - Rear Depth", 32, CTL_PLAYBACK_VOLUME},
+	{"Headphone Channel Switch", 9, CTL_PLAYBACK_SWITCH},
+	{"HP Channel Switch", 2, CTL_PLAYBACK_SWITCH},
+	{"Speaker Channel Switch", 7, CTL_PLAYBACK_SWITCH},
 	/* Capture Volume/Switch controls without a " Capture ..." suffix */
 	{"ADC Boost Gain", 14, CTL_CAPTURE_VOLUME},
 	{"IN1 Boost", 9, CTL_CAPTURE_VOLUME},