[PATCH alsa-ucm-conf 0/3] byt/cht: Add support for controlling mute LEDs using the new snd_ctl_led kmod
Hi All,
This series adds support for controlling spk/mic mute LEDs one some Bay- and Cherry-Trail devices using the new snd_ctl_led kmod functionality.
This requires the latest alsa-lib and alsa-utils git code and when running on Fedora it also requires putting selinux in permissive mode for now. I've filed a bug against the selinux-policy to get this fixed: https://bugzilla.redhat.com/show_bug.cgi?id=1958210
Note the first patch is mostly unrelated, it is a resend of an earlier patch which seems to have fallen through the cracks.
Regards,
Hans
Hans de Goede (3): cht-bsw-rt5672: Add support for the components string cht-bsw-rt5672: Add support for controlling speaker- and mic-mute LEDs bytcr-rt5640: Add support for controlling a speaker-mute LED
ucm2/bytcr-rt5640/bytcr-rt5640.conf | 6 ++++ ucm2/cht-bsw-rt5672/HiFi.conf | 37 +++++++++++++++++++++++-- ucm2/cht-bsw-rt5672/cht-bsw-rt5672.conf | 6 ++++ 3 files changed, 47 insertions(+), 2 deletions(-)
Upcoming kernel versions will report which speaker and dmic config is used by the device in a components strings so that we don't need to duplicate the DMI quirks in both the kernel and the UCM profile.
Add support for getting the speaker and dmic config from the components string.
Note the old DMI matching is kept for support of older kernels, this means that on devices where the old DMI matching was used things like:
Define.MonoSpeaker ""
Will now be done twice, this is harmless as long as the kernel and UCM profile DMI quirks are in sync, which they are.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- ucm2/cht-bsw-rt5672/HiFi.conf | 37 +++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/ucm2/cht-bsw-rt5672/HiFi.conf b/ucm2/cht-bsw-rt5672/HiFi.conf index 5e5f78f..41828ef 100644 --- a/ucm2/cht-bsw-rt5672/HiFi.conf +++ b/ucm2/cht-bsw-rt5672/HiFi.conf @@ -7,7 +7,40 @@ Define.DigitalMic1 "yes" Define.DigitalMic2 "yes" Define.HeadsetMic "yes"
-If.cfg-dmic1 { +# Figure out which components are in use on the device, we check both the +# components string (present on newer kernels) as well as checking for DMI +# strings for compatibility with older kernels. Note DMI matches for new +# models should only be added to the kernel, this UCM profile will then +# automatically pick up the info from the components string. + +If.components-stereo-spk { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-spk:2" + } + True.Define.MonoSpeaker "" +} + +If.components-dmic1 { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-mic:dmic1" + } + True.Define.DigitalMic2 "" +} + +If.components-dmic2 { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-mic:dmic2" + } + True.Define.DigitalMic1 "" +} + +If.dmi-dmic1 { Condition { Type RegexMatch String "${CardLongName}" @@ -19,7 +52,7 @@ If.cfg-dmic1 { } }
-If.cfg-dmic2 { +If.dmi-dmic2 { Condition { Type RegexMatch String "${CardLongName}"
Add support for controlling speaker- and mic-mute LEDs using the new snd_ctl_led kernel module for generic mute LED control.
Tested on a Thinkpad 10 tablet which has a detachable USB keyboard with a speaker mute LED embedded in the volume-mute button and a mic mute LED embedded in the mic-mute button.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- ucm2/cht-bsw-rt5672/cht-bsw-rt5672.conf | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/ucm2/cht-bsw-rt5672/cht-bsw-rt5672.conf b/ucm2/cht-bsw-rt5672/cht-bsw-rt5672.conf index db2924f..c961967 100644 --- a/ucm2/cht-bsw-rt5672/cht-bsw-rt5672.conf +++ b/ucm2/cht-bsw-rt5672/cht-bsw-rt5672.conf @@ -6,3 +6,9 @@ SectionUseCase."HiFi" { File "HiFi.conf" Comment "Play HiFi quality Music" } + +FixedBootSequence [ + exec "/sbin/modprobe snd_ctl_led" + sysw "-/class/sound/ctl-led/speaker/card${CardNumber}/attach:DAC1 Playback Switch" + sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:ADC Capture Switch" +]
Add support for controlling a speaker-mute LED using the new snd_ctl_led kernel module for generic mute LED control.
Tested on a HP Pavilion X2 10-n000nd and a HP Pavilion X2 10-p002nd both of which have a detachable USB keyboard with a speaker mute LED embedded in the audio-mute button.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- ucm2/bytcr-rt5640/bytcr-rt5640.conf | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/ucm2/bytcr-rt5640/bytcr-rt5640.conf b/ucm2/bytcr-rt5640/bytcr-rt5640.conf index af966ef..6b54d8f 100644 --- a/ucm2/bytcr-rt5640/bytcr-rt5640.conf +++ b/ucm2/bytcr-rt5640/bytcr-rt5640.conf @@ -4,3 +4,9 @@ SectionUseCase."HiFi" { File "HiFi.conf" Comment "Play HiFi quality Music" } + +FixedBootSequence [ + exec "/sbin/modprobe snd_ctl_led" + sysw "-/class/sound/ctl-led/speaker/card${CardNumber}/attach:Speaker Channel Switch" + sysw "-/class/sound/ctl-led/speaker/card${CardNumber}/attach:HP Channel Switch" +]
Dne 07. 05. 21 v 15:11 Hans de Goede napsal(a):
Hi All,
This series adds support for controlling spk/mic mute LEDs one some Bay- and Cherry-Trail devices using the new snd_ctl_led kmod functionality.
This requires the latest alsa-lib and alsa-utils git code and when running on Fedora it also requires putting selinux in permissive mode for now. I've filed a bug against the selinux-policy to get this fixed: https://bugzilla.redhat.com/show_bug.cgi?id=1958210
Note the first patch is mostly unrelated, it is a resend of an earlier patch which seems to have fallen through the cracks.
Hi,
I applied all three patches with a minor correction for the latest alsa-lib - I added the '-' prefix for the /sbin/modprobe to ignore errors when the snd_ctl_led module does not exists.
Thank you, Jaroslav
participants (2)
-
Hans de Goede
-
Jaroslav Kysela