ASoC: rt715:add micmute led state control supports
Subsystems (4)
PATCH v4 2/2 ASoC: rt715:add micmute led state control supports
From: Perry Yuan <[email protected]>
Some new Dell system is going to support audio internal micphone privacy setting from hardware level with micmute led state changing When micmute hotkey pressed by user, soft mute will need to be enabled firstly in case of pop noise, and codec driver need to react to mic mute event to EC(embedded controller) notifying that SW mute is completed Then EC will do the hardware mute physically within the timeout reached
This patch allow codec rt715 and rt715 sdca driver to change the local micmute led state. Dell privacy led trigger driver will ack EC when micmute key pressed through this micphone led control interface like hda_generic provided ACPI method defined in dell-privacy micmute led trigger will be called for notifying the EC that software mute has been completed, then hardware audio circuit solution controlled by EC will switch the audio input source off/on
--------
v3 -> v4:
* remove unused debug log
* remove compile flag of DELL privacy
* move the micmute_led to local from rt715_priv
* when Jaroslav upstream his gerneric LED trigger driver,I will rebase this patch,please consider merge this at first
https://lore.kernel.org/alsa-devel/[email protected]/
v2 -> v3:
* simplify the patch to reuse some val value
* add more detail to the commit info
v1 -> v2:
* fix some format issue
--------
--- sound/soc/codecs/rt715-sdca.c | 12 ++++++++++++ sound/soc/codecs/rt715.c | 12 ++++++++++++ 2 files changed, 24 insertions(+)
sound/soc/codecs/rt715-sdca.c +12 -0
@@ -12,6 +12,7 @@#include <linux/version.h> #include <linux/kernel.h> #include <linux/init.h> +#include <linux/leds.h> #include <linux/pm_runtime.h> #include <linux/pm.h> #include <linux/soundwire/sdw.h>
@@ -269,6 +270,7 @@ static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,unsigned int reg = mc->reg;unsigned int max = mc->max;int err; +bool micmute_led; val = ucontrol->value.integer.value[0 ];if (invert)
@@ -287,6 +289,16 @@ static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,return err; } +/* Micmute LED state changed by muted/unmute switch */ +if (mc->invert) { +if (ucontrol->value.integer.value[0 ] || ucontrol->value.integer.value[1 ]) { + micmute_led =LED_OFF ; + }else { + micmute_led =LED_ON ; + } +ledtrig_audio_set (LED_AUDIO_MICMUTE , micmute_led); + } +return 0 ; }
sound/soc/codecs/rt715.c +12 -0
@@ -13,6 +13,7 @@#include <linux/init.h> #include <linux/delay.h> #include <linux/i2c.h> +#include <linux/leds.h> #include <linux/pm_runtime.h> #include <linux/pm.h> #include <linux/soundwire/sdw.h>
@@ -88,6 +89,7 @@ static int rt715_set_amp_gain_put(struct snd_kcontrol *kcontrol, RT715_SET_GAIN_MIX_ADC2_L};unsigned int addr_h, addr_l, val_h, val_ll, val_lr;unsigned int read_ll, read_rl, i, j, loop_cnt; +bool micmute_led;if (strstr (ucontrol->id.name,"Main Capture Switch" ) ||strstr (ucontrol->id.name,"Main Capture Volume" ))
@@ -95,6 +97,16 @@ static int rt715_set_amp_gain_put(struct snd_kcontrol *kcontrol,else loop_cnt =1 ; +/* Micmute LED state changed by muted/unmute switch */ +if (mc->invert) { +if (ucontrol->value.integer.value[0 ] || ucontrol->value.integer.value[1 ]) { + micmute_led =LED_OFF ; + }else { + micmute_led =LED_ON ; + } +ledtrig_audio_set (LED_AUDIO_MICMUTE , micmute_led); + } +for (j =0 ; j < loop_cnt; j++) {/* Can't use update bit function, so read the original value first */ if (loop_cnt ==1 ) {
Signature · 1 line
2.25.1
Quoted 32 lines · Perry Yuan
From: Perry Yuan <[email protected]>
Some new Dell system is going to support audio internal micphone privacy setting from hardware level with micmute led state changing When micmute hotkey pressed by user, soft mute will need to be enabled firstly in case of pop noise, and codec driver need to react to mic mute event to EC(embedded controller) notifying that SW mute is completed Then EC will do the hardware mute physically within the timeout reached
This patch allow codec rt715 and rt715 sdca driver to change the local micmute led state. Dell privacy led trigger driver will ack EC when micmute key pressed through this micphone led control interface like
hda_genericprovided ACPI method defined in dell-privacy micmute led trigger will be called for notifying the EC that software mute has been completed, then hardware audio circuit solution controlled by EC will switch the audio input source off/onSigned-off-by Perry Yuan <[email protected]>--------
v3 -> v4:
* remove unused debug log
* remove compile flag of DELL privacy
* move themicmute_ledto local fromrt715_priv
* when Jaroslav upstream his gerneric LED trigger driver,I will rebase this patch,please consider merge this at first
https://lore.kernel.org/alsa-devel/[email protected]/
v2 -> v3:
* simplify the patch to reuse some val value
* add more detail to the commit info
v1 -> v2:
* fix some format issue
--------
Quoted 2 lines
--- sound/soc/codecs/rt715-sdca.c | 12 ++++++++++++
that file is not yet in Mark Brown's tree, so that patch wouldn't apply.
Quoted 78 lines
sound/soc/codecs/rt715.c | 12 ++++++++++++ 2 files changed, 24 insertions(+)sound/soc/codecs/rt715-sdca.c +12
-0@@ -12,6 +12,7 @@#include <linux/version.h> #include <linux/kernel.h> #include <linux/init.h> +#include <linux/leds.h> #include <linux/pm_runtime.h> #include <linux/pm.h> #include <linux/soundwire/sdw.h> @@ -269,6 +270,7 @@ static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,unsigned int reg = mc->reg;unsigned int max = mc->max;int err; +bool micmute_led; val = ucontrol->value.integer.value[0 ];if (invert)@@ -287,6 +289,16 @@ static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,return err; } +/* Micmute LED state changed by muted/unmute switch */ +if (mc->invert) { +if (ucontrol->value.integer.value[0 ] || ucontrol->value.integer.value[1 ]) { + micmute_led =LED_OFF ; + }else { + micmute_led =LED_ON ; + } +ledtrig_audio_set (LED_AUDIO_MICMUTE , micmute_led); + } +return 0 ; }sound/soc/codecs/rt715.c +12
-0@@ -13,6 +13,7 @@#include <linux/init.h> #include <linux/delay.h> #include <linux/i2c.h> +#include <linux/leds.h> #include <linux/pm_runtime.h> #include <linux/pm.h> #include <linux/soundwire/sdw.h> @@ -88,6 +89,7 @@ static int rt715_set_amp_gain_put(struct snd_kcontrol *kcontrol, RT715_SET_GAIN_MIX_ADC2_L};unsigned int addr_h, addr_l, val_h, val_ll, val_lr;unsigned int read_ll, read_rl, i, j, loop_cnt; +bool micmute_led;if (strstr (ucontrol->id.name,"Main Capture Switch" ) ||strstr (ucontrol->id.name,"Main Capture Volume" ))@@ -95,6 +97,16 @@ static int rt715_set_amp_gain_put(struct snd_kcontrol *kcontrol,else loop_cnt =1 ; +/* Micmute LED state changed by muted/unmute switch */ +if (mc->invert) { +if (ucontrol->value.integer.value[0 ] || ucontrol->value.integer.value[1 ]) { + micmute_led =LED_OFF ; + }else { + micmute_led =LED_ON ; + } +ledtrig_audio_set (LED_AUDIO_MICMUTE , micmute_led); + } +for (j =0 ; j < loop_cnt; j++) {/* Can't use update bit function, so read the original value first */ if (loop_cnt ==1 ) {
Mark Brown
maintainersound/soc/codecs/rt715-sdca.c static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol, · line 300
Quoted 9 lines · Perry Yuan
sound/soc/codecs/rt715-sdca.c +9
-0+/* Micmute LED state changed by muted/unmute switch */ +if (mc->invert) { +if (ucontrol->value.integer.value[0 ] || ucontrol->value.integer.value[1 ]) { + micmute_led =LED_OFF ; + }else { + micmute_led =LED_ON ; + } +ledtrig_audio_set (LED_AUDIO_MICMUTE , micmute_led); + }
These conditionals on inversion seem weird and counterintuitive. If we're going with this approach it would probably be clearer to define a custom operation for the affected controls that wraps the standard one and adds the LED setting rather than keying off invert like this.
Hi Mark:
Quoted 14 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Tuesday, March 9, 2021 1:24 AM
To: Yuan, Perry
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Limonciello, Mario; [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supportsOn Mon, Mar 01, 2021 at 05:38:34PM +0800, Perry Yuan wrote:
Quoted 15 lines
sound/soc/codecs/rt715-sdca.c static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol, · line 300
Quoted 10 lines
sound/soc/codecs/rt715-sdca.c +3
-0+/* Micmute LED state changed by muted/unmute switch */ + if (mc->invert) { + if (ucontrol->value.integer.value[0] || ucontrol-value.integer.value[1]) {
sound/soc/codecs/rt715-sdca.c +6
-0+ micmute_led =LED_OFF ; + }else { + micmute_led =LED_ON ; + } +ledtrig_audio_set (LED_AUDIO_MICMUTE , micmute_led); + }These conditionals on inversion seem weird and counterintuitive. If we're going with this approach it would probably be clearer to define a custom operation for the affected controls that wraps the standard one and adds the LED setting rather than keying off invert like this.
Currently the sof soundwire driver has no generic led control yet.
This patch can handle the led control needs for MIC mute LED, definitely the patch is a short term solution. There is a feature request discussion when we started to implement this solution.
https://github.com/thesofproject/linux/issues/2496#issuecomment-713892620
The workable way for now is that we put the LED mute control to the codec driver. When there is new and full sound LED solution implemented, this part will be also optimized. The Hardware privacy feature needs this patch to handle the Mic mute led state change. Before that full solution ready in kernel, could we take this as short term solution?
Perry
Jaroslav Kysela
maintainerDne 22. 03. 21 v 10:25 Yuan, Perry napsal(a):
Quoted 37 lines
Hi Mark:
Quoted 14 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Tuesday, March 9, 2021 1:24 AM
To: Yuan, Perry
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Limonciello, Mario; [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supportsOn Mon, Mar 01, 2021 at 05:38:34PM +0800, Perry Yuan wrote:
Quoted 15 lines
sound/soc/codecs/rt715-sdca.c static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol, · line 300
Quoted 10 lines
sound/soc/codecs/rt715-sdca.c +3
-0+/* Micmute LED state changed by muted/unmute switch */ + if (mc->invert) { + if (ucontrol->value.integer.value[0] || ucontrol-value.integer.value[1]) {
sound/soc/codecs/rt715-sdca.c +6
-0+ micmute_led =LED_OFF ; + }else { + micmute_led =LED_ON ; + } +ledtrig_audio_set (LED_AUDIO_MICMUTE , micmute_led); + }These conditionals on inversion seem weird and counterintuitive. If we're going with this approach it would probably be clearer to define a custom operation for the affected controls that wraps the standard one and adds the LED setting rather than keying off invert like this.
Currently the sof soundwire driver has no generic led control yet.
This patch can handle the led control needs for MIC mute LED, definitely the patch is a short term solution. There is a feature request discussion when we started to implement this solution.
https://github.com/thesofproject/linux/issues/2496#issuecomment-713892620
Quoted 4 lines
The workable way for now is that we put the LED mute control to the codec driver. When there is new and full sound LED solution implemented, this part will be also optimized. The Hardware privacy feature needs this patch to handle the Mic mute led state change. Before that full solution ready in kernel, could we take this as short term solution?
Perry, it's about the machine detection. Your code is too much generic even for the top-level LED trigger implementation. We need an extra check, if the proper LED's are really controlled on the specific hardware. Other hardware may use RT715 for a different purpose. Use DMI / ACPI checks to detect this hardware and don't misuse the inversion flag to enable this code.
Jaroslav
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Hi,
Quoted 43 lines · Jaroslav Kysela
Dne 22. 03. 21 v 10:25 Yuan, Perry napsal(a):
Quoted 37 lines
Hi Mark:
Quoted 14 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Tuesday, March 9, 2021 1:24 AM
To: Yuan, Perry
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Limonciello, Mario; [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supportsOn Mon, Mar 01, 2021 at 05:38:34PM +0800, Perry Yuan wrote:
Quoted 15 lines
sound/soc/codecs/rt715-sdca.c static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol, · line 300
Quoted 10 lines
sound/soc/codecs/rt715-sdca.c +3
-0+/* Micmute LED state changed by muted/unmute switch */ + if (mc->invert) { + if (ucontrol->value.integer.value[0] || ucontrol-value.integer.value[1]) {
sound/soc/codecs/rt715-sdca.c +6
-0+ micmute_led =LED_OFF ; + }else { + micmute_led =LED_ON ; + } +ledtrig_audio_set (LED_AUDIO_MICMUTE , micmute_led); + }These conditionals on inversion seem weird and counterintuitive. If we're going with this approach it would probably be clearer to define a custom operation for the affected controls that wraps the standard one and adds the LED setting rather than keying off invert like this.
Currently the sof soundwire driver has no generic led control yet.
This patch can handle the led control needs for MIC mute LED, definitely the patch is a short term solution. There is a feature request discussion when we started to implement this solution.
https://github.com/thesofproject/linux/issues/2496#issuecomment-713892620Quoted 4 lines
The workable way for now is that we put the LED mute control to the codec driver. When there is new and full sound LED solution implemented, this part will be also optimized. The Hardware privacy feature needs this patch to handle the Mic mute led state change. Before that full solution ready in kernel, could we take this as short term solution?
Quoted 5 lines
Perry, it's about the machine detection. Your code is too much generic even for the top-level LED trigger implementation. We need an extra check, if the proper LED's are really controlled on the specific hardware. Other hardware may use RT715 for a different purpose. Use DMI / ACPI checks to detect this hardware and don't misuse the inversion flag to enable this code.
I think this would be a goo candidate for the new generic LED handling:
https://lore.kernel.org/alsa-devel/[email protected]/
And then use a udev-rule + hwdb and/or UCM profiles to configure the LED trigger for specific models from userspace ?
Regards,
Hans
Hi Hans
Quoted 81 lines
-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: Monday, March 22, 2021 11:02 PM
To: Jaroslav Kysela; Yuan, Perry; Mark Brown; pierre- [email protected]; Limonciello, Mario
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supports[EXTERNAL EMAIL]
Hi,
Quoted 32 lines · Jaroslav Kysela
Dne 22. 03. 21 v 10:25 Yuan, Perry napsal(a):
Quoted 31 lines
Hi Mark:
Quoted 29 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Tuesday, March 9, 2021 1:24 AM
To: Yuan, Perry
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Limonciello, Mario; [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supportssound/soc/codecs/rt715-sdca.c static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol, · line 300
Quoted 10 lines · Perry Yuan
sound/soc/codecs/rt715-sdca.c +3
-0+/* Micmute LED state changed by muted/unmute switch */ + if (mc->invert) { + if (ucontrol->value.integer.value[0] || ucontrol-value.integer.value[1]) {
sound/soc/codecs/rt715-sdca.c +6
-0+ micmute_led =LED_OFF ; + }else { + micmute_led =LED_ON ; + } +ledtrig_audio_set (LED_AUDIO_MICMUTE , micmute_led); + }These conditionals on inversion seem weird and counterintuitive. If we're going with this approach it would probably be clearer to define a custom operation for the affected controls that wraps the standard one and adds the LED setting rather than keying off invert like
this.
Quoted 3 lines
Quoted 3 lines
Currently the sof soundwire driver has no generic led control yet. This patch can handle the led control needs for MIC mute LED, definitely
the patch is a short term solution.
Quoted 1 line
Quoted 1 line
There is a feature request discussion when we started to implement this
solution.
Quoted 1 line
71389
Quoted 3 lines
Quoted 3 lines
2620
The workable way for now is that we put the LED mute control to the
codec driver.
Quoted 1 line
Quoted 1 line
When there is new and full sound LED solution implemented, this part will
be also optimized.
Quoted 1 line
Quoted 1 line
The Hardware privacy feature needs this patch to handle the Mic mute led
state change.
Quoted 1 line
Quoted 1 line
Before that full solution ready in kernel, could we take this as short term
solution?
Quoted 6 lines
Perry, it's about the machine detection. Your code is too much generic even for the top-level LED trigger implementation. We need an extra check, if the proper LED's are really controlled on the specific hardware. Other hardware may use RT715 for a different purpose. Use DMI / ACPI checks to detect this hardware and don't misuse the inversion
flag to enable this code.
I think this would be a goo candidate for the new generic LED handling:
https://lore.kernel.org/alsa-devel/20210317172945.842280-1-
[email protected]/
Quoted 9 lines
And then use a udev-rule + hwdb and/or UCM profiles to configure the LED trigger for specific models from userspace ?
Regards,
Hans
Because the SOF SDW design has no mic mute led control yet.
So I add one short term solution to make Dell privacy working for now
Definitely , that is new solution I can add my patch on that to test as one user case .
We really need to take the short term solution work for some system which support new SOF soundwire hardware which have dependence on the MIC mute feature Meanwhile we can continue working on the new "udev-rule + hwdb and/or UCM profiles" solution as to replace this one.
If we agree that, I will submit another V6 addressing new feedback.
Perry
Hi,
Quoted 92 lines · Perry
Hi Hans
Quoted 81 lines
-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: Monday, March 22, 2021 11:02 PM
To: Jaroslav Kysela; Yuan, Perry; Mark Brown; pierre- [email protected]; Limonciello, Mario
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supports[EXTERNAL EMAIL]
Hi,
Quoted 32 lines · Jaroslav Kysela
Dne 22. 03. 21 v 10:25 Yuan, Perry napsal(a):
Quoted 31 lines
Hi Mark:
Quoted 29 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Tuesday, March 9, 2021 1:24 AM
To: Yuan, Perry
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Limonciello, Mario; [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supportssound/soc/codecs/rt715-sdca.c static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol, · line 300
Quoted 10 lines · Perry Yuan
sound/soc/codecs/rt715-sdca.c +3
-0+/* Micmute LED state changed by muted/unmute switch */ + if (mc->invert) { + if (ucontrol->value.integer.value[0] || ucontrol-value.integer.value[1]) {
sound/soc/codecs/rt715-sdca.c +6
-0+ micmute_led =LED_OFF ; + }else { + micmute_led =LED_ON ; + } +ledtrig_audio_set (LED_AUDIO_MICMUTE , micmute_led); + }These conditionals on inversion seem weird and counterintuitive. If we're going with this approach it would probably be clearer to define a custom operation for the affected controls that wraps the standard one and adds the LED setting rather than keying off invert like
this.
Quoted 3 lines
Quoted 3 lines
Currently the sof soundwire driver has no generic led control yet. This patch can handle the led control needs for MIC mute LED, definitely
the patch is a short term solution.
Quoted 1 line
Quoted 1 line
There is a feature request discussion when we started to implement this
solution.
Quoted 1 line
71389
Quoted 3 lines
Quoted 3 lines
2620
The workable way for now is that we put the LED mute control to the
codec driver.
Quoted 1 line
Quoted 1 line
When there is new and full sound LED solution implemented, this part will
be also optimized.
Quoted 1 line
Quoted 1 line
The Hardware privacy feature needs this patch to handle the Mic mute led
state change.
Quoted 1 line
Quoted 1 line
Before that full solution ready in kernel, could we take this as short term
solution?
Quoted 6 lines
Perry, it's about the machine detection. Your code is too much generic even for the top-level LED trigger implementation. We need an extra check, if the proper LED's are really controlled on the specific hardware. Other hardware may use RT715 for a different purpose. Use DMI / ACPI checks to detect this hardware and don't misuse the inversion
flag to enable this code.
I think this would be a goo candidate for the new generic LED handling:
https://lore.kernel.org/alsa-devel/20210317172945.842280-1-
[email protected]/Quoted 9 lines
And then use a udev-rule + hwdb and/or UCM profiles to configure the LED trigger for specific models from userspace ?
Regards,
Hans
Quoted 6 lines
Because the SOF SDW design has no mic mute led control yet.
So I add one short term solution to make Dell privacy working for now
Definitely , that is new solution I can add my patch on that to test as one user case .
We really need to take the short term solution work for some system which support new SOF soundwire hardware which have dependence on the MIC mute feature Meanwhile we can continue working on the new "udev-rule + hwdb and/or UCM profiles" solution as to replace this one.
If we agree that, I will submit another V6 addressing new feedback.
The triggering of the LED trigger and the code registering the led_classdev are in 2 separate subsystems; and should be merged separately.
If you post a new version of patch 1/2 addressing my review remarks then I can merge that.
For merging the sound side of this you need to talk to the sound folks (Jaroslav Kysela, Takashi Iwai, Mark Brown for files under sound/soc).
Regards,
Hans
Hi Hans,Jaroslav
Quoted 134 lines
-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: 2021年3月25日 23:07
To: Yuan, Perry; Jaroslav Kysela; Mark Brown; pierre- [email protected]; Limonciello, Mario
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supports[EXTERNAL EMAIL]
Hi,
Quoted 37 lines · Perry
Hi Hans
Quoted 35 lines
-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: Monday, March 22, 2021 11:02 PM
To: Jaroslav Kysela; Yuan, Perry; Mark Brown; pierre- [email protected]; Limonciello, Mario
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supports[EXTERNAL EMAIL]
Hi,
Quoted 17 lines · Jaroslav Kysela
Dne 22. 03. 21 v 10:25 Yuan, Perry napsal(a):
Quoted 16 lines
Hi Mark:
Quoted 14 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Tuesday, March 9, 2021 1:24 AM
To: Yuan, Perry
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Limonciello, Mario; [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supportsOn Mon, Mar 01, 2021 at 05:38:34PM +0800, Perry Yuan wrote:
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Review
Quoted 9 lines
(quoted diff) +3
-0+ /* Micmute LED state changed by muted/unmute switch */ + if (mc->invert) { + if (ucontrol->value.integer.value[0] || ucontrol-value.integer.value[1]) {
(quoted diff) +5
-0+ micmute_led = LED_OFF; + } else { + micmute_led = LED_ON; + } + ledtrig_audio_set(LED_AUDIO_MICMUTE,
micmute_led);Quoted 50 lines
Quoted 50 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ }These conditionals on inversion seem weird and counterintuitive. If we're going with this approach it would probably be clearer to define a custom operation for the affected controls that wraps the standard one and adds the LED setting rather than keying off invert like
this.
Quoted 4 lines
Quoted 4 lines
Currently the sof soundwire driver has no generic led control yet. This patch can handle the led control needs for MIC mute LED, definitely
the patch is a short term solution.
Quoted 2 lines
Quoted 2 lines
There is a feature request discussion when we started to implement this
solution.
Quoted 1 line
71389
Quoted 3 lines
Quoted 3 lines
2620
The workable way for now is that we put the LED mute control to the
codec driver.
Quoted 2 lines
Quoted 2 lines
When there is new and full sound LED solution implemented, this part will
be also optimized.
Quoted 2 lines
Quoted 2 lines
The Hardware privacy feature needs this patch to handle the Mic mute led
state change.
Quoted 2 lines
Quoted 2 lines
Before that full solution ready in kernel, could we take this as short term
solution?
Quoted 7 lines
Perry, it's about the machine detection. Your code is too much generic even for the top-level LED trigger implementation. We need an extra check, if the proper LED's are really controlled on the specific hardware. Other hardware may use RT715 for a different purpose. Use DMI / ACPI checks to detect this hardware and don't misuse the inversion
flag to enable this code.
I think this would be a goo candidate for the new generic LED handling:
https://lore.kernel.org/alsa-devel/20210317172945.842280-1-
[email protected]/And then use a udev-rule + hwdb and/or UCM profiles to configure the LED trigger for specific models from userspace ?
Regards,
Quoted 7 lines
Quoted 4 lines
Hans
Because the SOF SDW design has no mic mute led control yet.
So I add one short term solution to make Dell privacy working for now Definitely , that is new solution I can add my patch on that to test as oneuser case .
Quoted 2 lines
We really need to take the short term solution work for some system which support new SOF soundwire hardware which have dependence on
the MIC mute feature Meanwhile we can continue working on the new "udev- rule + hwdb and/or UCM profiles" solution as to replace this one.
Quoted 1 line
If we agree that, I will submit another V6 addressing new feedback.
The triggering of the LED trigger and the code registering the
led_classdevare in 2 separate subsystems; and should be merged separately.If you post a new version of patch 1/2 addressing my review remarks then I can merge that.
Quoted 6 lines
For merging the sound side of this you need to talk to the sound folks (Jaroslav Kysela, Takashi Iwai, Mark Brown for files under
sound/soc).Regards,
Hans
Got it!
I am working the V6 today, will post it ASAP.
* addressing Hans Feedback
* add runtime machine detection with DMI checking (from Jaroslav Feedback)
Perry Yuan
Dell | Client Software Group | CDC Linux OS
Hi Jaroslav:
Quoted 72 lines
-----Original Message-----
From: Jaroslav Kysela <[email protected]>
Sent: Monday, March 22, 2021 10:38 PM
To: Yuan, Perry; Mark Brown; [email protected]; Limonciello, Mario; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; alsa-devel@alsa- project.org; [email protected]; platform-driver- [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supports[EXTERNAL EMAIL]
Dne 22. 03. 21 v 10:25 Yuan, Perry napsal(a):
Quoted 32 lines
Hi Mark:
Quoted 14 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Tuesday, March 9, 2021 1:24 AM
To: Yuan, Perry
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Limonciello, Mario; [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supportsOn Mon, Mar 01, 2021 at 05:38:34PM +0800, Perry Yuan wrote:
Quoted 15 lines
sound/soc/codecs/rt715-sdca.c static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol, · line 300
Quoted 10 lines
sound/soc/codecs/rt715-sdca.c +3
-0+/* Micmute LED state changed by muted/unmute switch */ + if (mc->invert) { + if (ucontrol->value.integer.value[0] || ucontrol-value.integer.value[1]) {
sound/soc/codecs/rt715-sdca.c +6
-0+ micmute_led =LED_OFF ; + }else { + micmute_led =LED_ON ; + } +ledtrig_audio_set (LED_AUDIO_MICMUTE , micmute_led); + }These conditionals on inversion seem weird and counterintuitive. If we're going with this approach it would probably be clearer to define a custom operation for the affected controls that wraps the standard one and adds the LED setting rather than keying off invert like this.
Quoted 2 lines
Currently the sof soundwire driver has no generic led control yet. This patch can handle the led control needs for MIC mute LED, definitely
the patch is a short term solution.
Quoted 1 line
There is a feature request discussion when we started to implement this
solution.
713892
Quoted 3 lines
620
The workable way for now is that we put the LED mute control to the
codec driver.
Quoted 1 line
When there is new and full sound LED solution implemented, this part
will be also optimized.
Quoted 1 line
The Hardware privacy feature needs this patch to handle the Mic mute
led state change.
Quoted 1 line
Before that full solution ready in kernel, could we take this as short term
solution?
Perry, it's about the machine detection. Your code is too much generic even for the top-level LED trigger implementation. We need an extra check, if the proper LED's are really controlled on the specific hardware. Other hardware may use RT715 for a different purpose. Use DMI / ACPI checks to detect this hardware and don't misuse the inversion flag to enable this code.
Quoted 5 lines
Jaroslav
--
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
In the V2 patch, I have added the machine detection, but some guys thought that I should remove the detection for it is harmless to other system So I remove it in the following patches.
Is it Ok for you if I add below detection of Dell system which enable the privacy feature ?
Then the mute led control will be called normally and Mic mute will be successfully configured. There is no any impaction to other systems.
+#if IS_ENABLED(CONFIG_DELL_PRIVACY)
.....
+#endif
Jaroslav Kysela
maintainerDne 25. 03. 21 v 9:19 Yuan, Perry napsal(a):
Quoted 89 lines
Hi Jaroslav:
Quoted 72 lines
-----Original Message-----
From: Jaroslav Kysela <[email protected]>
Sent: Monday, March 22, 2021 10:38 PM
To: Yuan, Perry; Mark Brown; [email protected]; Limonciello, Mario; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; alsa-devel@alsa- project.org; [email protected]; platform-driver- [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supports[EXTERNAL EMAIL]
Dne 22. 03. 21 v 10:25 Yuan, Perry napsal(a):
Quoted 32 lines
Hi Mark:
Quoted 14 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Tuesday, March 9, 2021 1:24 AM
To: Yuan, Perry
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Limonciello, Mario; [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supportsOn Mon, Mar 01, 2021 at 05:38:34PM +0800, Perry Yuan wrote:
Quoted 15 lines
sound/soc/codecs/rt715-sdca.c static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol, · line 300
Quoted 10 lines
sound/soc/codecs/rt715-sdca.c +3
-0+/* Micmute LED state changed by muted/unmute switch */ + if (mc->invert) { + if (ucontrol->value.integer.value[0] || ucontrol-value.integer.value[1]) {
sound/soc/codecs/rt715-sdca.c +6
-0+ micmute_led =LED_OFF ; + }else { + micmute_led =LED_ON ; + } +ledtrig_audio_set (LED_AUDIO_MICMUTE , micmute_led); + }These conditionals on inversion seem weird and counterintuitive. If we're going with this approach it would probably be clearer to define a custom operation for the affected controls that wraps the standard one and adds the LED setting rather than keying off invert like this.
Quoted 2 lines
Currently the sof soundwire driver has no generic led control yet. This patch can handle the led control needs for MIC mute LED, definitely
the patch is a short term solution.
Quoted 1 line
There is a feature request discussion when we started to implement this
solution.
713892
Quoted 3 lines
620
The workable way for now is that we put the LED mute control to the
codec driver.
Quoted 1 line
When there is new and full sound LED solution implemented, this part
will be also optimized.
Quoted 1 line
The Hardware privacy feature needs this patch to handle the Mic mute
led state change.
Quoted 1 line
Before that full solution ready in kernel, could we take this as short term
solution?
Perry, it's about the machine detection. Your code is too much generic even for the top-level LED trigger implementation. We need an extra check, if the proper LED's are really controlled on the specific hardware. Other hardware may use RT715 for a different purpose. Use DMI / ACPI checks to detect this hardware and don't misuse the inversion flag to enable this code.
Quoted 5 lines
Jaroslav
--
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.In the V2 patch, I have added the machine detection, but some guys thought that I should remove the detection for it is harmless to other system So I remove it in the following patches.
Is it Ok for you if I add below detection of Dell system which enable the privacy feature ?
Then the mute led control will be called normally and Mic mute will be successfully configured. There is no any impaction to other systems.
Review
Quoted 3 lines
(quoted diff) +2
-0+#if IS_ENABLED(CONFIG_DELL_PRIVACY) +#endif
I think that you misunderstood the request. It's about the runtime detection not about the compile time detection. An example for DMI check is in sound/soc/intel/boards/sof_sdw.c / sof_sdw_quirk_table .
Jaroslav
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.