linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: benoit.thebaudeau@advansee.com (Benoît Thébaudeau)
To: linux-arm-kernel@lists.infradead.org
Subject: [BUG] leds-pwm: First setting of brightness does nothing
Date: Thu, 23 Aug 2012 15:36:54 +0200 (CEST)	[thread overview]
Message-ID: <320569847.2756382.1345729013971.JavaMail.root@advansee.com> (raw)
In-Reply-To: <322770447.2755463.1345727876098.JavaMail.root@advansee.com>

Hi all,

I have found a bug using leds-pwm with the i.MX PWM driver. The first time a
non-0 brightness is set through sysfs, this has no effect. It works fine from
the 2nd time.

The cause of this bug is that leds-pwm.c:led_pwm_set() calls pwm_config() before
pwm_enable(), while in the i.MX PWM driver pwm_enable() enables the PWM IP
clock, so that a call to pwm_config() has no effect before the first call to
pwm_enable().

Several other PWM drivers in drivers/pwm/ work in the same way. pwm-beeper.c and
pwm_bl.c also call pwm_config() before pwm_enable(). The PWM documentation does
not say if the wrong doers are these PWM users or the i.MX-like PWM drivers.

So what should be fixed? Fixing these PWM users would be quite easy since it's a
simple swap of the pwm_config() and pwm_enable() calls. This should not produce
any glitch since the duty cycle is always set to 0 by these PWM users before
calling pwm_disable().

Best regards,
Beno?t

       reply	other threads:[~2012-08-23 13:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <322770447.2755463.1345727876098.JavaMail.root@advansee.com>
2012-08-23 13:36 ` Benoît Thébaudeau [this message]
2012-08-23 14:19   ` [PATCH] pwm: Call pwm_enable() before pwm_config() Benoît Thébaudeau
2012-08-23 15:43     ` Lars-Peter Clausen
2012-08-23 16:57       ` Benoît Thébaudeau
2012-08-23 17:12         ` Lars-Peter Clausen
2012-08-23 17:19           ` Lars-Peter Clausen
2012-08-23 19:04             ` Thierry Reding
2012-09-20 19:05               ` Mark Brown
2012-08-23 19:11           ` Thierry Reding
2012-08-23 21:03             ` [PATCH] pwm-imx: Fix config / enable / disable Benoît Thébaudeau
2012-08-28  7:37               ` Sascha Hauer
2012-09-20 19:03           ` [PATCH] pwm: Call pwm_enable() before pwm_config() Mark Brown
2012-08-30  7:10       ` Jingoo Han

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=320569847.2756382.1345729013971.JavaMail.root@advansee.com \
    --to=benoit.thebaudeau@advansee.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).