alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH alsa-ucm-conf 0/3] byt/cht: Add support for controlling mute LEDs using the new snd_ctl_led kmod
@ 2021-05-07 13:11 Hans de Goede
  2021-05-07 13:11 ` [PATCH alsa-ucm-conf 1/3] cht-bsw-rt5672: Add support for the components string Hans de Goede
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Hans de Goede @ 2021-05-07 13:11 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

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(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH alsa-ucm-conf 1/3] cht-bsw-rt5672: Add support for the components string
  2021-05-07 13:11 [PATCH alsa-ucm-conf 0/3] byt/cht: Add support for controlling mute LEDs using the new snd_ctl_led kmod Hans de Goede
@ 2021-05-07 13:11 ` Hans de Goede
  2021-05-07 13:11 ` [PATCH alsa-ucm-conf 2/3] cht-bsw-rt5672: Add support for controlling speaker- and mic-mute LEDs Hans de Goede
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2021-05-07 13:11 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

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}"
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH alsa-ucm-conf 2/3] cht-bsw-rt5672: Add support for controlling speaker- and mic-mute LEDs
  2021-05-07 13:11 [PATCH alsa-ucm-conf 0/3] byt/cht: Add support for controlling mute LEDs using the new snd_ctl_led kmod Hans de Goede
  2021-05-07 13:11 ` [PATCH alsa-ucm-conf 1/3] cht-bsw-rt5672: Add support for the components string Hans de Goede
@ 2021-05-07 13:11 ` Hans de Goede
  2021-05-07 13:11 ` [PATCH alsa-ucm-conf 3/3] bytcr-rt5640: Add support for controlling a speaker-mute LED Hans de Goede
  2021-05-18 16:25 ` [PATCH alsa-ucm-conf 0/3] byt/cht: Add support for controlling mute LEDs using the new snd_ctl_led kmod Jaroslav Kysela
  3 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2021-05-07 13:11 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

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"
+]
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH alsa-ucm-conf 3/3] bytcr-rt5640: Add support for controlling a speaker-mute LED
  2021-05-07 13:11 [PATCH alsa-ucm-conf 0/3] byt/cht: Add support for controlling mute LEDs using the new snd_ctl_led kmod Hans de Goede
  2021-05-07 13:11 ` [PATCH alsa-ucm-conf 1/3] cht-bsw-rt5672: Add support for the components string Hans de Goede
  2021-05-07 13:11 ` [PATCH alsa-ucm-conf 2/3] cht-bsw-rt5672: Add support for controlling speaker- and mic-mute LEDs Hans de Goede
@ 2021-05-07 13:11 ` Hans de Goede
  2021-05-18 16:25 ` [PATCH alsa-ucm-conf 0/3] byt/cht: Add support for controlling mute LEDs using the new snd_ctl_led kmod Jaroslav Kysela
  3 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2021-05-07 13:11 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

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"
+]
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH alsa-ucm-conf 0/3] byt/cht: Add support for controlling mute LEDs using the new snd_ctl_led kmod
  2021-05-07 13:11 [PATCH alsa-ucm-conf 0/3] byt/cht: Add support for controlling mute LEDs using the new snd_ctl_led kmod Hans de Goede
                   ` (2 preceding siblings ...)
  2021-05-07 13:11 ` [PATCH alsa-ucm-conf 3/3] bytcr-rt5640: Add support for controlling a speaker-mute LED Hans de Goede
@ 2021-05-18 16:25 ` Jaroslav Kysela
  3 siblings, 0 replies; 5+ messages in thread
From: Jaroslav Kysela @ 2021-05-18 16:25 UTC (permalink / raw)
  To: Hans de Goede; +Cc: alsa-devel, Pierre-Louis Bossart, Bard Liao

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

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-18 16:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 13:11 [PATCH alsa-ucm-conf 0/3] byt/cht: Add support for controlling mute LEDs using the new snd_ctl_led kmod Hans de Goede
2021-05-07 13:11 ` [PATCH alsa-ucm-conf 1/3] cht-bsw-rt5672: Add support for the components string Hans de Goede
2021-05-07 13:11 ` [PATCH alsa-ucm-conf 2/3] cht-bsw-rt5672: Add support for controlling speaker- and mic-mute LEDs Hans de Goede
2021-05-07 13:11 ` [PATCH alsa-ucm-conf 3/3] bytcr-rt5640: Add support for controlling a speaker-mute LED Hans de Goede
2021-05-18 16:25 ` [PATCH alsa-ucm-conf 0/3] byt/cht: Add support for controlling mute LEDs using the new snd_ctl_led kmod Jaroslav Kysela

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).