byt/cht: Add support for controlling mute LEDs using the new snd_ctl_led kmod
cover 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(-)
Signature · 1 line
2.31.1
PATCH 1/3 cht-bsw-rt5672: Add support for the components string
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.
--- ucm2/cht-bsw-rt5672/HiFi.conf | 37 +++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-)
ucm2/cht-bsw-rt5672/HiFi.conf +35 -2
@@ -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}"
Signature · 1 line
2.31.1
PATCH 2/3 cht-bsw-rt5672: Add support for controlling speaker- and mic-mute LEDs
In reply to Hans de GoedeAdd 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.
--- ucm2/cht-bsw-rt5672/cht-bsw-rt5672.conf | 6 ++++++ 1 file changed, 6 insertions(+)
ucm2/cht-bsw-rt5672/cht-bsw-rt5672.conf +6 -0
@@ -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" +]
Signature · 1 line
2.31.1
PATCH 3/3 bytcr-rt5640: Add support for controlling a speaker-mute LED
In reply to Hans de GoedeAdd 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.
--- ucm2/bytcr-rt5640/bytcr-rt5640.conf | 6 ++++++ 1 file changed, 6 insertions(+)
ucm2/bytcr-rt5640/bytcr-rt5640.conf +6 -0
@@ -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" +]
Signature · 1 line
2.31.1
Dne 07. 05. 21 v 15:11 Hans de Goede napsal(a):
Quoted 5 lines
Hi All,
This series adds support for controlling spk/mic mute LEDs one some Bay- and Cherry-Trail devices using the new
snd_ctl_ledkmod functionality.
Quoted 7 lines
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=1958210Note 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
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.