Linux LED subsystem development
 help / color / mirror / Atom feed
From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Markus Hofstaetter <markus.hofstaetter@ait.ac.at>
Cc: Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>,
	linux-leds@vger.kernel.org
Subject: Re: [PATCH 1/1] leds: call led_pwm_set() in leds-pwm to enforce default LED_OFF
Date: Mon, 16 Nov 2015 12:20:19 +0100	[thread overview]
Message-ID: <5649BBF3.6050104@samsung.com> (raw)
In-Reply-To: <1447242029-29335-1-git-send-email-markus.hofstaetter@ait.ac.at>

Hi Markus,

On 11/11/2015 12:40 PM, Markus Hofstaetter wrote:
> Some PWMs are disabled by default or the default pin setting
> does not match the LED_OFF state (e.g., active-low leds).
> Hence, the driver may end up reporting 0 brightness, but
> the leds are actually on using full brightness, because
> it never enforces its default configuration.

AFAICS default brightness is hard coded to LED_OFF, so this
will turn active-low LEDs on.

> So enforce it by calling led_pwm_set() after successfully
> registering the device.
>
> Tested on a Phytec phyFLEX i.MX6Q board based on kernel
> v3.19.5.
>
> Signed-off-by: Markus Hofstaetter <markus.hofstaetter@ait.ac.at>
> Tested-by: Markus Hofstaetter <markus.hofstaetter@ait.ac.at>
> ---
>   drivers/leds/leds-pwm.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
> index 1d07e3e..3149dbe 100644
> --- a/drivers/leds/leds-pwm.c
> +++ b/drivers/leds/leds-pwm.c
> @@ -132,6 +132,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
>   	ret = led_classdev_register(dev, &led_data->cdev);
>   	if (ret == 0) {
>   		priv->num_leds++;
> +		led_pwm_set(&led_data->cdev, led_data->cdev.brightness);
>   	} else {
>   		dev_err(dev, "failed to register PWM led for %s: %d\n",
>   			led->name, ret);
>


-- 
Best Regards,
Jacek Anaszewski

  reply	other threads:[~2015-11-16 11:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11 11:40 [PATCH 1/1] leds: call led_pwm_set() in leds-pwm to enforce default LED_OFF Markus Hofstaetter
2015-11-16 11:20 ` Jacek Anaszewski [this message]
     [not found]   ` <683FCC1FA91F7D4681B11BC13D4A787754C8A721@S0MSMAIL112.arc.local>
2015-11-16 13:48     ` Hofstätter Markus
2015-11-16 14:06       ` Jacek Anaszewski

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=5649BBF3.6050104@samsung.com \
    --to=j.anaszewski@samsung.com \
    --cc=cooloney@gmail.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=markus.hofstaetter@ait.ac.at \
    --cc=rpurdie@rpsys.net \
    /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