Re: [PATCH v2 2/2] ASoC: rt715:add Mic Mute LED control support

From: Pierre-Louis Bossart
Date: Mon Jan 11 2021 - 15:31:39 EST





@@ -268,6 +269,7 @@ static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,
unsigned int reg2 = mc->rreg;
unsigned int reg = mc->reg;
unsigned int max = mc->max;
+ unsigned int val0, val1;
int err;
val = ucontrol->value.integer.value[0];
@@ -286,7 +288,22 @@ static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,
if (err < 0)
return err;
}
-
+#if IS_ENABLED(CONFIG_DELL_PRIVACY)
+ /* Privacy LED Trigger State Changed by muted/unmute switch */
+ if (mc->invert) {
+ val0 = ucontrol->value.integer.value[0];
+ val1 = ucontrol->value.integer.value[1];
+ if (val0 == 1 && val1 == 1) {
+ rt715->micmute_led = LED_OFF;
+ ledtrig_audio_set(LED_AUDIO_MICMUTE,
+ rt715->micmute_led ? LED_ON : LED_OFF);
+ } else if (val0 == 0 && val1 == 0) {
+ rt715->micmute_led = LED_ON;
+ ledtrig_audio_set(LED_AUDIO_MICMUTE,
+ rt715->micmute_led ? LED_ON : LED_OFF);
+ }
+ }
+#endif

Should this be activated for specific DMI quirks? This driver is used in non-Dell platforms (I am thinking of Intel RVPs or Realtek daughterboards), I am not sure if a build-time behavior change makes sense.

Or conversely could we just set the LEDs unconditionally if doing so is harmless?