[RFC 2/2] ASoC: rt5670: Add LED trigger support

Hans de Goede hdegoede at redhat.com
Mon Feb 15 15:24:19 CET 2021


Add support for controlling a speaker and/or microphone mute LED through
LED triggers using the new generic LED trigger module.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 sound/soc/codecs/rt5670.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
index feab15d0686a..9233710e3a4f 100644
--- a/sound/soc/codecs/rt5670.c
+++ b/sound/soc/codecs/rt5670.c
@@ -690,7 +690,8 @@ static const struct snd_kcontrol_new rt5670_snd_controls[] = {
 	/* DAC Digital Volume */
 	SOC_DOUBLE("DAC2 Playback Switch", RT5670_DAC_CTRL,
 		RT5670_M_DAC_L2_VOL_SFT, RT5670_M_DAC_R2_VOL_SFT, 1, 1),
-	SOC_DOUBLE_EXT("DAC1 Playback Switch", SND_SOC_NOPM, 0, 1, 1, 0,
+	SOC_DOUBLE_EXT_ACCESS("DAC1 Playback Switch", SND_SOC_NOPM, 0, 1, 1, 0,
+			SNDRV_CTL_ELEM_ACCESS_SPK_LED,
 			rt5670_dac1_playback_switch_get, rt5670_dac1_playback_switch_put),
 	SOC_DOUBLE_TLV("DAC1 Playback Volume", RT5670_DAC1_DIG_VOL,
 			RT5670_L_VOL_SFT, RT5670_R_VOL_SFT,
@@ -708,8 +709,9 @@ static const struct snd_kcontrol_new rt5670_snd_controls[] = {
 			RT5670_INL_VOL_SFT, RT5670_INR_VOL_SFT,
 			31, 1, in_vol_tlv),
 	/* ADC Digital Volume Control */
-	SOC_DOUBLE("ADC Capture Switch", RT5670_STO1_ADC_DIG_VOL,
-		RT5670_L_MUTE_SFT, RT5670_R_MUTE_SFT, 1, 1),
+	SOC_DOUBLE_ACCESS("ADC Capture Switch", RT5670_STO1_ADC_DIG_VOL,
+			  RT5670_L_MUTE_SFT, RT5670_R_MUTE_SFT, 1, 1,
+			  SNDRV_CTL_ELEM_ACCESS_MIC_LED),
 	SOC_DOUBLE_TLV("ADC Capture Volume", RT5670_STO1_ADC_DIG_VOL,
 			RT5670_L_VOL_SFT, RT5670_R_VOL_SFT,
 			127, 0, adc_vol_tlv),
@@ -3253,6 +3255,8 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
 
 	}
 
+	snd_ctl_led_request();
+
 	pm_runtime_enable(&i2c->dev);
 	pm_request_idle(&i2c->dev);
 
-- 
2.30.1



More information about the Alsa-devel mailing list