From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] PWM: atmel-pwm: use request/free instead of enable/disable
Date: Tue, 8 Oct 2013 14:05:17 +0200 [thread overview]
Message-ID: <20131008120516.GA16196@ulmo.nvidia.com> (raw)
In-Reply-To: <1380554553-25676-1-git-send-email-alexandre.belloni@free-electrons.com>
On Mon, Sep 30, 2013 at 05:22:33PM +0200, Alexandre Belloni wrote:
> I found that disabling a pwm while it is at a low level will actually put it
> back at a high level. The main symptom is that leds-pwm is calling pwm_disable()
> after setting the duty cycle to 0. Hence, instead of getting a switched off LED,
> you get an LED lit up at full brightness.
I wonder why that's the case. What's causing the PWM to go back to full
duty cycle when disabled? There was a similar issue with some other PWM
driver a while back and the cause was tracked down to be that you had to
wait for a full period to make sure the signal was constantly low before
switching off the clock. Perhaps something similar is the issue here?
> Solve that by using the request and free callbacks to enable and disable the
> pwm channels and the clock.
"pwm" -> "PWM", please.
> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
[...]
> +static int atmel_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
> +{
> + /*
> + * This is a dummy function, required to be able to register the pwm
> + * chip, see pwmadd_chip() in pwm/core.c
> + */
> + return 0;
> +}
> +
> +static void atmel_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
> +{
> + /*
> + * This is a dummy function, required to be able to register the pwm
> + * chip, see pwmadd_chip() in pwm/core.c
> + */
> +}
This just doesn't feel right. Can somebody please investigate what the
real reason is for the behaviour described in the commit message and see
if we can't solve this in some other way? .request() and .free() are
typically called very early or very late, respectively, so this patch
will keep the PWM clock on forever (pretty much).
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131008/e603fb7f/attachment.sig>
next prev parent reply other threads:[~2013-10-08 12:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-30 15:22 [PATCH v2] PWM: atmel-pwm: use request/free instead of enable/disable Alexandre Belloni
2013-10-08 12:05 ` Thierry Reding [this message]
2013-10-09 11:14 ` Alexandre Belloni
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=20131008120516.GA16196@ulmo.nvidia.com \
--to=thierry.reding@gmail.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).