All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ALSA: hda/realtek - Introduce polarity for micmute LED GPIO
@ 2020-04-30  8:32 ` Kai-Heng Feng
  0 siblings, 0 replies; 17+ messages in thread
From: Kai-Heng Feng @ 2020-04-30  8:32 UTC (permalink / raw)
  To: tiwai
  Cc: Kai-Heng Feng, Jaroslav Kysela, Kailang Yang, Hui Wang,
	Jian-Hong Pan, Tomas Espeleta, Thomas Hebb,
	Michał Mirosław, moderated list:SOUND, open list

Currently mute LED and micmute LED share the same GPIO polarity.

So split the polarity for mute and micmute, in case they have different
polarities.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index c16f63957c5a..3150a61befc5 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -81,6 +81,7 @@ struct alc_spec {
 
 	/* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
 	int mute_led_polarity;
+	int micmute_led_polarity;
 	hda_nid_t mute_led_nid;
 	hda_nid_t cap_mute_led_nid;
 
@@ -4075,11 +4076,9 @@ static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
 
 /* update LED status via GPIO */
 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
-				bool enabled)
+				int polarity, bool enabled)
 {
-	struct alc_spec *spec = codec->spec;
-
-	if (spec->mute_led_polarity)
+	if (polarity)
 		enabled = !enabled;
 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
 }
@@ -4090,7 +4089,8 @@ static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
 	struct hda_codec *codec = private_data;
 	struct alc_spec *spec = codec->spec;
 
-	alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
+	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
+			    spec->mute_led_polarity, enabled);
 }
 
 /* turn on/off mic-mute LED via GPIO per capture hook */
@@ -4099,6 +4099,7 @@ static void alc_gpio_micmute_update(struct hda_codec *codec)
 	struct alc_spec *spec = codec->spec;
 
 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
+			    spec->micmute_led_polarity,
 			    spec->gen.micmute_led.led_value);
 }
 
@@ -5795,7 +5796,8 @@ static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
 
 	snd_hda_gen_hp_automute(codec, jack);
 	/* mute_led_polarity is set to 0, so we pass inverted value here */
-	alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
+	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
+			    !spec->gen.hp_jack_present);
 }
 
 /* Manage GPIOs for HP EliteBook Folio 9480m.
-- 
2.17.1


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

end of thread, other threads:[~2020-05-01  8:11 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30  8:32 [PATCH 1/3] ALSA: hda/realtek - Introduce polarity for micmute LED GPIO Kai-Heng Feng
2020-04-30  8:32 ` Kai-Heng Feng
2020-04-30  8:32 ` [PATCH 2/3] ALSA: hda/realtek - Enable micmute LED on and HP system Kai-Heng Feng
2020-04-30  8:32   ` Kai-Heng Feng
2020-04-30 17:22   ` Takashi Iwai
2020-04-30 17:22     ` Takashi Iwai
2020-04-30  8:32 ` [PATCH 3/3] ALSA: hda/realtek - Add LED class support for micmute LED Kai-Heng Feng
2020-04-30  8:32   ` Kai-Heng Feng
2020-04-30 11:26   ` Takashi Iwai
2020-04-30 11:26     ` Takashi Iwai
2020-04-30 13:52   ` [PATCH v2 " Kai-Heng Feng
2020-04-30 13:52     ` Kai-Heng Feng
2020-04-30 17:22     ` Takashi Iwai
2020-04-30 17:22       ` Takashi Iwai
2020-05-01  8:11   ` [PATCH " kbuild test robot
2020-04-30 17:21 ` [PATCH 1/3] ALSA: hda/realtek - Introduce polarity for micmute LED GPIO Takashi Iwai
2020-04-30 17:21   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.