From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Juergen Borleis <jbe@pengutronix.de>
Cc: linux-leds@vger.kernel.org, Pavel Machek <pavel@ucw.cz>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] leds: trigger/tty: Use led_set_brightness() to support all use cases
Date: Mon, 9 Jan 2023 09:43:20 +0100 [thread overview]
Message-ID: <20230109084320.nj7erwh3eu4jlw7y@pengutronix.de> (raw)
In-Reply-To: <20210503092542.14497-1-jbe@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 2392 bytes --]
Hello Jürgen,
On Mon, May 03, 2021 at 11:25:42AM +0200, Juergen Borleis wrote:
> Using led_set_brightness_sync() only works for LEDs which are connected
> via some kind of external bus like I²C or SPI. But it doesn't work for
> the simple use case of directly connected LEDs via GPIOs.
> Because this function only honors the led_classdev::brightness_set_blocking
> callback. But the LED-GPIO driver registers the
> led_classdev::brightness_set member if the GPIO can be modified directly
> and thus, TTY triggers fail silently with -ENOTSUPP.
>
> With the previously used led_set_brightness() it works for both use cases.
> This function first checks for the simple case where the GPIO can be changed
> without additional overhead, and if it fails, does the modification via a
> workqueue.
>
> Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
> ---
> drivers/leds/trigger/ledtrig-tty.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/leds/trigger/ledtrig-tty.c b/drivers/leds/trigger/ledtrig-tty.c
> index f62db7e..af61281 100644
> --- a/drivers/leds/trigger/ledtrig-tty.c
> +++ b/drivers/leds/trigger/ledtrig-tty.c
> @@ -122,12 +122,12 @@ static void ledtrig_tty_work(struct work_struct *work)
>
> if (icount.rx != trigger_data->rx ||
> icount.tx != trigger_data->tx) {
> - led_set_brightness_sync(trigger_data->led_cdev, LED_ON);
> + led_set_brightness(trigger_data->led_cdev, LED_ON);
>
> trigger_data->rx = icount.rx;
> trigger_data->tx = icount.tx;
> } else {
> - led_set_brightness_sync(trigger_data->led_cdev, LED_OFF);
> + led_set_brightness(trigger_data->led_cdev, LED_OFF);
> }
This problem still exists, right?
I think the right thing here is to call led_set_brightness_nosleep()
however.
Having said that, I think there are too many variants of
led_set_brightness which makes it difficult to pick the right one.
(I'm aware of
- led_set_brightness_nosleep
- led_set_brightness_nopm
- led_set_brightness_sync
- led_set_brightness
and there are a few more static variants in led-core.c
(__led_set_brightness, __led_set_brightness_blocking,
set_brightness_delayed).)
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 484 bytes --]
next prev parent reply other threads:[~2023-01-09 8:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-03 9:25 [PATCH] leds: trigger/tty: Use led_set_brightness() to support all use cases Juergen Borleis
2021-05-03 10:16 ` Pavel Machek
2023-01-09 8:43 ` Uwe Kleine-König [this message]
2024-02-23 14:22 ` Lee Jones
2024-02-23 14:24 ` Lee Jones
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=20230109084320.nj7erwh3eu4jlw7y@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=jbe@pengutronix.de \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).