From: Stefan Wahren <stefan.wahren@i2se.com>
To: "Bryan Wu" <cooloney@gmail.com>,
"Thierry Reding" <thierry.reding@gmail.com>,
linux-pwm@vger.kernel.org, linux-leds@vger.kernel.org,
"Richard Purdie" <rpurdie@rpsys.net>,
"\"Uwe Kleine-König\"" <u.kleine-koenig@pengutronix.de>
Cc: Sascha Hauer <s.hauer@pengutronix.de>,
kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] leds/pwm: Don't disable pwm when setting brightness to 0
Date: Tue, 24 Feb 2015 19:56:52 +0100 (CET) [thread overview]
Message-ID: <1151818200.134325.1424804213026.JavaMail.open-xchange@oxbsltgw03.schlund.de> (raw)
In-Reply-To: <1423734290-19750-3-git-send-email-u.kleine-koenig@pengutronix.de>
Hi Uwe,
> Uwe Kleine-König <u.kleine-koenig@pengutronix.de> hat am 12. Februar 2015 um
> 10:44 geschrieben:
>
>
> This fixes disabling the LED on i.MX28. The PWM hardware delays using
> the newly set pwm-config until the beginning of a new period. It's very
> likely that pwm_disable is called before the current period ends. In
> case the LED was on brightness=max before the LED stays on because in
> the disabled PWM block the period never ends.
>
> Also only call pwm_enable only once in the probe call back and the
> matching pwm_disable in .remove(). Moreover the pwm is explicitly
> initialized to off.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/leds/leds-pwm.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
> index f668500a2157..5dae0d2dc3dc 100644
> --- a/drivers/leds/leds-pwm.c
> +++ b/drivers/leds/leds-pwm.c
> @@ -44,11 +44,6 @@ static void __led_pwm_set(struct led_pwm_data *led_dat)
> int new_duty = led_dat->duty;
>
> pwm_config(led_dat->pwm, new_duty, led_dat->period);
> -
> - if (new_duty == 0)
> - pwm_disable(led_dat->pwm);
> - else
> - pwm_enable(led_dat->pwm);
> }
>
> static void led_pwm_work(struct work_struct *work)
> @@ -93,6 +88,7 @@ static void led_pwm_cleanup(struct led_pwm_priv *priv)
> led_classdev_unregister(&priv->leds[priv->num_leds].cdev);
> if (priv->leds[priv->num_leds].can_sleep)
> cancel_work_sync(&priv->leds[priv->num_leds].work);
> + pwm_disable(priv->leds[i].pwm);
> }
> }
>
After replacing "i" with "priv->num_leds" in this patch we are able to use pwm
led with trigger heartbeat.
This is the functional part of this issue, since the warning has been fixed [1]
Thanks Stefan
[1] -
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-April/244925.html
next prev parent reply other threads:[~2015-02-24 18:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 9:44 [PATCH 0/2] leds/pwm: don't call pwm_disable when setting brightness Uwe Kleine-König
2015-02-12 9:44 ` [PATCH 1/2] pwm/doc: Clearify that the pin state after pwm_disable is undefined Uwe Kleine-König
2015-02-12 9:44 ` [PATCH 2/2] leds/pwm: Don't disable pwm when setting brightness to 0 Uwe Kleine-König
2015-02-12 9:47 ` Uwe Kleine-König
2015-02-24 18:56 ` Stefan Wahren [this message]
2015-02-24 19:06 ` Uwe Kleine-König
2015-02-25 8:13 ` Stefan Wahren
2015-02-25 8:42 ` Uwe Kleine-König
2015-03-25 10:14 ` [PATCH 0/2] leds/pwm: don't call pwm_disable when setting brightness Uwe Kleine-König
2015-03-25 12:00 ` Thierry Reding
2015-03-27 8:59 ` Uwe Kleine-König
2015-03-27 11:26 ` Thierry Reding
2015-03-27 14:35 ` Uwe Kleine-König
2015-03-27 15:43 ` Thierry Reding
2015-03-27 18:49 ` Sascha Hauer
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=1151818200.134325.1424804213026.JavaMail.open-xchange@oxbsltgw03.schlund.de \
--to=stefan.wahren@i2se.com \
--cc=cooloney@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=rpurdie@rpsys.net \
--cc=s.hauer@pengutronix.de \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.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 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).