@@ -11,6 +11,7 @@
#include <linux/moduleparam.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>
@@ -358,6 +359,7 @@ static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,
unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = p->invert;
int err;
+ bool micmute_led;
for (i = 0; i < 4; i++) {
if (ucontrol->value.integer.value[i] != rt715->kctl_switch_orig[i]) {
@@ -393,6 +395,15 @@ static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,
if (err < 0)
return err;
}
+ /* Micmute LED state changed by muted/unmute switch */
+ if (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 k_changed;
}
@@ -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) {