From: Pavel Machek <pavel@ucw.cz>
To: Hans de Goede <hdegoede@redhat.com>
Cc: "Marek Behún" <kabel@kernel.org>, "Takashi Iwai" <tiwai@suse.de>,
alsa-devel@alsa-project.org, linux-leds@vger.kernel.org
Subject: Re: [PATCH v2] leds: trigger: audio: Add an activate callback to ensure the initial brightness is set
Date: Tue, 23 Feb 2021 10:12:30 +0100 [thread overview]
Message-ID: <20210223091230.GI9750@amd> (raw)
In-Reply-To: <20210221115208.105203-1-hdegoede@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1453 bytes --]
Hi!
> Some 2-in-1s with a detachable (USB) keyboard(dock) have mute-LEDs in
> the speaker- and/or mic-mute keys on the keyboard.
>
> Examples of this are the Lenovo Thinkpad10 tablet (with its USB kbd-dock)
> and the HP x2 10 series.
>
> The detachable nature of these keyboards means that the keyboard and
> thus the mute LEDs may show up after the user (or userspace restoring
> old mixer settings) has muted the speaker and/or mic.
>
> Current LED-class devices with a default_trigger of "audio-mute" or
> "audio-micmute" initialize the brightness member of led_classdev with
> ledtrig_audio_get() before registering the LED.
>
> This makes the software state after attaching the keyboard match the
> actual audio mute state, e.g. cat /sys/class/leds/foo/brightness will
> show the right value.
Makes sense.
> +++ b/drivers/leds/trigger/ledtrig-audio.c
> @@ -6,10 +6,33 @@
> #include <linux/kernel.h>
> #include <linux/leds.h>
> #include <linux/module.h>
> +#include "../leds.h"
>
> -static struct led_trigger *ledtrig_audio[NUM_AUDIO_LEDS];
> static enum led_brightness audio_state[NUM_AUDIO_LEDS];
>
> +static int ledtrig_audio_mute_activate(struct led_classdev *led_cdev)
> +{
> + led_set_brightness_nosleep(led_cdev, audio_state[LED_AUDIO_MUTE]);
> + return 0;
> +}
Is mute_activate called from atomic context?
Best regards,
Pavel
--
http://www.livejournal.com/~pavelmachek
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Pavel Machek <pavel@ucw.cz>
To: Hans de Goede <hdegoede@redhat.com>
Cc: "Marek Behún" <kabel@kernel.org>,
linux-leds@vger.kernel.org, alsa-devel@alsa-project.org,
"Takashi Iwai" <tiwai@suse.de>
Subject: Re: [PATCH v2] leds: trigger: audio: Add an activate callback to ensure the initial brightness is set
Date: Tue, 23 Feb 2021 10:12:30 +0100 [thread overview]
Message-ID: <20210223091230.GI9750@amd> (raw)
In-Reply-To: <20210221115208.105203-1-hdegoede@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1453 bytes --]
Hi!
> Some 2-in-1s with a detachable (USB) keyboard(dock) have mute-LEDs in
> the speaker- and/or mic-mute keys on the keyboard.
>
> Examples of this are the Lenovo Thinkpad10 tablet (with its USB kbd-dock)
> and the HP x2 10 series.
>
> The detachable nature of these keyboards means that the keyboard and
> thus the mute LEDs may show up after the user (or userspace restoring
> old mixer settings) has muted the speaker and/or mic.
>
> Current LED-class devices with a default_trigger of "audio-mute" or
> "audio-micmute" initialize the brightness member of led_classdev with
> ledtrig_audio_get() before registering the LED.
>
> This makes the software state after attaching the keyboard match the
> actual audio mute state, e.g. cat /sys/class/leds/foo/brightness will
> show the right value.
Makes sense.
> +++ b/drivers/leds/trigger/ledtrig-audio.c
> @@ -6,10 +6,33 @@
> #include <linux/kernel.h>
> #include <linux/leds.h>
> #include <linux/module.h>
> +#include "../leds.h"
>
> -static struct led_trigger *ledtrig_audio[NUM_AUDIO_LEDS];
> static enum led_brightness audio_state[NUM_AUDIO_LEDS];
>
> +static int ledtrig_audio_mute_activate(struct led_classdev *led_cdev)
> +{
> + led_set_brightness_nosleep(led_cdev, audio_state[LED_AUDIO_MUTE]);
> + return 0;
> +}
Is mute_activate called from atomic context?
Best regards,
Pavel
--
http://www.livejournal.com/~pavelmachek
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2021-02-23 9:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-21 11:52 [PATCH v2] leds: trigger: audio: Add an activate callback to ensure the initial brightness is set Hans de Goede
2021-02-21 11:52 ` Hans de Goede
2021-02-23 9:12 ` Pavel Machek [this message]
2021-02-23 9:12 ` Pavel Machek
2021-02-23 9:52 ` Hans de Goede
2021-02-23 9:52 ` Hans de Goede
2021-02-24 7:58 ` Takashi Iwai
2021-02-24 7:58 ` 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=20210223091230.GI9750@amd \
--to=pavel@ucw.cz \
--cc=alsa-devel@alsa-project.org \
--cc=hdegoede@redhat.com \
--cc=kabel@kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=tiwai@suse.de \
/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: link
Be 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.