From: Dylan Van Assche <me@dylanvanassche.be>
To: Pavel Machek <pavel@ucw.cz>
Cc: dmurphy@ti.com, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] leds: gpio: Set max brightness to 1
Date: Tue, 29 Dec 2020 19:09:11 +0100 [thread overview]
Message-ID: <cbfba11f00850e610d0a6ca1e0da2ead977f1574.camel@dylanvanassche.be> (raw)
In-Reply-To: <20201229160450.GA9564@duo.ucw.cz>
Hi!
Thanks for the feedback!
Indeed, this can be even more simplified with your suggestion.
I will send a new version of the patch soon.
Happy holidays!
Kind regards,
Dylan Van Assche
On Tue, 2020-12-29 at 17:04 +0100, Pavel Machek wrote:
> Hi!
>
> > GPIO LEDs only know 2 states: ON or OFF and do not have PWM
> > capabilities.
> > However, the max brightness is reported as 255.
> >
> > This patch sets the max brightness value of a GPIO controlled LED
> > to 1.
> >
> > Tested on my PinePhone 1.2.
> >
> > Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>
> > ---
> > v2 drops an obsolete change in include/linux/leds.h
>
> I thought that one looked odd.
>
> > +++ b/drivers/leds/leds-gpio.c
> > @@ -96,7 +96,8 @@ static int create_gpio_led(const struct gpio_led
> > *template,
> > } else {
> > state = (template->default_state ==
> > LEDS_GPIO_DEFSTATE_ON);
> > }
> > - led_dat->cdev.brightness = state ? LED_FULL : LED_OFF;
> > + led_dat->cdev.brightness = state ? LED_ON : LED_OFF;
> > + led_dat->cdev.max_brightness = LED_ON;
>
> Would simpler version work:
>
> > + led_dat->cdev.brightness = state;
> > + led_dat->cdev.max_brightness = 1;
>
> ? Easier to understand... I'd prefer that version unless it causes
> warnings or something.
>
> Pavel
prev parent reply other threads:[~2020-12-29 18:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-29 14:24 Dylan Van Assche
2020-12-29 16:04 ` Pavel Machek
2020-12-29 18:09 ` Dylan Van Assche [this message]
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=cbfba11f00850e610d0a6ca1e0da2ead977f1574.camel@dylanvanassche.be \
--to=me@dylanvanassche.be \
--cc=dmurphy@ti.com \
--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
all inboxes | Powered by JetHome®