From: Takashi Iwai <tiwai@suse.de> To: Kai-Heng Feng <kai.heng.feng@canonical.com> Cc: tiwai@suse.com, "Jaroslav Kysela" <perex@perex.cz>, "Kailang Yang" <kailang@realtek.com>, "Hui Wang" <hui.wang@canonical.com>, "Jian-Hong Pan" <jian-hong@endlessm.com>, "Tomas Espeleta" <tomas.espeleta@gmail.com>, "Thomas Hebb" <tommyhebb@gmail.com>, "Michał Mirosław" <mirq-linux@rere.qmqm.pl>, "moderated list:SOUND" <alsa-devel@alsa-project.org>, "open list" <linux-kernel@vger.kernel.org> Subject: Re: [PATCH 3/3] ALSA: hda/realtek - Add LED class support for micmute LED Date: Thu, 30 Apr 2020 13:26:34 +0200 [thread overview] Message-ID: <s5hd07pi591.wl-tiwai@suse.de> (raw) In-Reply-To: <20200430083255.5093-3-kai.heng.feng@canonical.com> On Thu, 30 Apr 2020 10:32:53 +0200, Kai-Heng Feng wrote: > > Currently DMIC controls micmute LED via "audio mute LED trigger". > > However, unlike Dell and Lenovo platforms, HP platforms don't provide a > way to control micmute LED via ACPI, it's controlled by HDA codec > instead. > > So let's register an LED class for micmute so other subsystems like DMIC > can facilitate the codec-controlled LED. > > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> I guess this requires the Kconfig change to select CONFIG_LEDS_* or make the code conditionally built. So far the latter strategy is taken for the code in hda_generic.c. thanks, Takashi > --- > sound/pci/hda/patch_realtek.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c > index 6f164ccddde3..82eb7624bbba 100644 > --- a/sound/pci/hda/patch_realtek.c > +++ b/sound/pci/hda/patch_realtek.c > @@ -17,6 +17,7 @@ > #include <linux/dmi.h> > #include <linux/module.h> > #include <linux/input.h> > +#include <linux/leds.h> > #include <sound/core.h> > #include <sound/jack.h> > #include <sound/hda_codec.h> > @@ -4103,6 +4104,24 @@ static void alc_gpio_micmute_update(struct hda_codec *codec) > spec->gen.micmute_led.led_value); > } > > +static int micmute_led_set(struct led_classdev *led_cdev, > + enum led_brightness brightness) > +{ > + struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); > + struct alc_spec *spec = codec->spec; > + > + alc_update_gpio_led(codec, spec->gpio_mic_led_mask, > + spec->micmute_led_polarity, !!brightness); > + return 0; > +} > + > +static struct led_classdev micmute_led_cdev = { > + .name = "hda::micmute", > + .max_brightness = 1, > + .brightness_set_blocking = micmute_led_set, > + .default_trigger = "audio-micmute", > +}; > + > /* setup mute and mic-mute GPIO bits, add hooks appropriately */ > static void alc_fixup_hp_gpio_led(struct hda_codec *codec, > int action, > @@ -4110,6 +4129,7 @@ static void alc_fixup_hp_gpio_led(struct hda_codec *codec, > unsigned int micmute_mask) > { > struct alc_spec *spec = codec->spec; > + int err; > > alc_fixup_gpio(codec, action, mute_mask | micmute_mask); > > @@ -4122,6 +4142,11 @@ static void alc_fixup_hp_gpio_led(struct hda_codec *codec, > if (micmute_mask) { > spec->gpio_mic_led_mask = micmute_mask; > snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update); > + > + micmute_led_cdev.brightness = ledtrig_audio_get(LED_AUDIO_MICMUTE); > + err = devm_led_classdev_register(&codec->core.dev, &micmute_led_cdev); > + if (err) > + codec_warn(codec, "failed to register micmute LED\n"); > } > } > > -- > 2.17.1 >
WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de> To: Kai-Heng Feng <kai.heng.feng@canonical.com> Cc: "moderated list:SOUND" <alsa-devel@alsa-project.org>, "Kailang Yang" <kailang@realtek.com>, "Tomas Espeleta" <tomas.espeleta@gmail.com>, "open list" <linux-kernel@vger.kernel.org>, tiwai@suse.com, "Hui Wang" <hui.wang@canonical.com>, "Thomas Hebb" <tommyhebb@gmail.com>, "Jian-Hong Pan" <jian-hong@endlessm.com>, "Michał Mirosław" <mirq-linux@rere.qmqm.pl> Subject: Re: [PATCH 3/3] ALSA: hda/realtek - Add LED class support for micmute LED Date: Thu, 30 Apr 2020 13:26:34 +0200 [thread overview] Message-ID: <s5hd07pi591.wl-tiwai@suse.de> (raw) In-Reply-To: <20200430083255.5093-3-kai.heng.feng@canonical.com> On Thu, 30 Apr 2020 10:32:53 +0200, Kai-Heng Feng wrote: > > Currently DMIC controls micmute LED via "audio mute LED trigger". > > However, unlike Dell and Lenovo platforms, HP platforms don't provide a > way to control micmute LED via ACPI, it's controlled by HDA codec > instead. > > So let's register an LED class for micmute so other subsystems like DMIC > can facilitate the codec-controlled LED. > > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> I guess this requires the Kconfig change to select CONFIG_LEDS_* or make the code conditionally built. So far the latter strategy is taken for the code in hda_generic.c. thanks, Takashi > --- > sound/pci/hda/patch_realtek.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c > index 6f164ccddde3..82eb7624bbba 100644 > --- a/sound/pci/hda/patch_realtek.c > +++ b/sound/pci/hda/patch_realtek.c > @@ -17,6 +17,7 @@ > #include <linux/dmi.h> > #include <linux/module.h> > #include <linux/input.h> > +#include <linux/leds.h> > #include <sound/core.h> > #include <sound/jack.h> > #include <sound/hda_codec.h> > @@ -4103,6 +4104,24 @@ static void alc_gpio_micmute_update(struct hda_codec *codec) > spec->gen.micmute_led.led_value); > } > > +static int micmute_led_set(struct led_classdev *led_cdev, > + enum led_brightness brightness) > +{ > + struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); > + struct alc_spec *spec = codec->spec; > + > + alc_update_gpio_led(codec, spec->gpio_mic_led_mask, > + spec->micmute_led_polarity, !!brightness); > + return 0; > +} > + > +static struct led_classdev micmute_led_cdev = { > + .name = "hda::micmute", > + .max_brightness = 1, > + .brightness_set_blocking = micmute_led_set, > + .default_trigger = "audio-micmute", > +}; > + > /* setup mute and mic-mute GPIO bits, add hooks appropriately */ > static void alc_fixup_hp_gpio_led(struct hda_codec *codec, > int action, > @@ -4110,6 +4129,7 @@ static void alc_fixup_hp_gpio_led(struct hda_codec *codec, > unsigned int micmute_mask) > { > struct alc_spec *spec = codec->spec; > + int err; > > alc_fixup_gpio(codec, action, mute_mask | micmute_mask); > > @@ -4122,6 +4142,11 @@ static void alc_fixup_hp_gpio_led(struct hda_codec *codec, > if (micmute_mask) { > spec->gpio_mic_led_mask = micmute_mask; > snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update); > + > + micmute_led_cdev.brightness = ledtrig_audio_get(LED_AUDIO_MICMUTE); > + err = devm_led_classdev_register(&codec->core.dev, &micmute_led_cdev); > + if (err) > + codec_warn(codec, "failed to register micmute LED\n"); > } > } > > -- > 2.17.1 >
next prev parent reply other threads:[~2020-04-30 11:26 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 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 [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=s5hd07pi591.wl-tiwai@suse.de \ --to=tiwai@suse.de \ --cc=alsa-devel@alsa-project.org \ --cc=hui.wang@canonical.com \ --cc=jian-hong@endlessm.com \ --cc=kai.heng.feng@canonical.com \ --cc=kailang@realtek.com \ --cc=linux-kernel@vger.kernel.org \ --cc=mirq-linux@rere.qmqm.pl \ --cc=perex@perex.cz \ --cc=tiwai@suse.com \ --cc=tomas.espeleta@gmail.com \ --cc=tommyhebb@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.