From: Roland Stigge <stigge@antcom.de>
To: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Cc: Alban Bedel <alban.bedel@avionic-design.de>,
Thierry Reding <thierry.reding@avionic-design.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] pwm: lpc32xx - Fix the PWM polarity
Date: Fri, 23 Nov 2012 10:53:02 +0100 [thread overview]
Message-ID: <50AF477E.5020008@antcom.de> (raw)
In-Reply-To: <CAAAP30GUM31pcHxXfWJnuUBN2jYHbWz0XFX7o6x=_2wNtbHroQ@mail.gmail.com>
On 11/23/2012 10:34 AM, Alexandre Pereira da Silva wrote:
> On Wed, Nov 14, 2012 at 9:58 AM, Alban Bedel
> <alban.bedel@avionic-design.de> wrote:
>> The duty cycles value goes from 1 (99% HIGH) to 256 (0% HIGH) but it
>> is stored modulo 256 in the register as it is only 8 bits wide.
>>
>> Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
>
> Acked-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
When the below doc typos are fixed,
Acked-by: Roland Stigge <stigge@antcom.de>
>
>> ---
>> drivers/pwm/pwm-lpc32xx.c | 17 ++++++++++++++++-
>> 1 files changed, 16 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
>> index adb87f0..03ec3ff 100644
>> --- a/drivers/pwm/pwm-lpc32xx.c
>> +++ b/drivers/pwm/pwm-lpc32xx.c
>> @@ -49,9 +49,24 @@ static int lpc32xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
>> c = 0; /* 0 set division by 256 */
>> period_cycles = c;
>>
>> + /* The duty value is a follow:
>> + *
>> + * DUTY HIGH LEVEL
>> + * 1 99.9%
>> + * 25 90.0%
>> + * 128 50.0%
>> + * 220 10.0%
>> + * 255 0.1%
>> + * 0 0.0%
>> + *
>> + * In other word the in-register value is duty % 256 with duty
>> + * in the range 1-256.
>> + */
>> c = 256 * duty_ns;
>> do_div(c, period_ns);
>> - duty_cycles = c;
>> + if (c > 255)
>> + c = 255;
>> + duty_cycles = 256 - c;
>>
>> writel(PWM_ENABLE | PWM_RELOADV(period_cycles) | PWM_DUTY(duty_cycles),
>> lpc32xx->base + (pwm->hwpwm << 2));
>> --
>> 1.7.0.4
>>
next prev parent reply other threads:[~2012-11-23 9:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-14 11:58 [PATCH 0/3] pwm: lpc32xx - Various small fixes Alban Bedel
2012-11-14 11:58 ` [PATCH 1/3] pwm: lpc32xx - Fix the PWM polarity Alban Bedel
2012-11-23 9:34 ` Alexandre Pereira da Silva
2012-11-23 9:53 ` Roland Stigge [this message]
2012-11-14 11:58 ` [PATCH 2/3] pwm: lpc32xx - Properly disable the clock on device remove Alban Bedel
2012-11-16 20:16 ` Thierry Reding
[not found] ` <CAAAP30GTuCB6FCvM9v-ju8y5b+UhQdDnEnHALtewfOzWnD1v=A@mail.gmail.com>
2012-11-23 9:55 ` Roland Stigge
2012-11-14 11:58 ` [PATCH 3/3] pwm: lpc32xx - Set the chip base for dynamic allocation Alban Bedel
2012-11-23 9:35 ` Alexandre Pereira da Silva
2012-11-23 9:51 ` Roland Stigge
2012-11-22 21:43 ` [PATCH 0/3] pwm: lpc32xx - Various small fixes Thierry Reding
2012-12-06 7:58 ` Thierry Reding
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=50AF477E.5020008@antcom.de \
--to=stigge@antcom.de \
--cc=alban.bedel@avionic-design.de \
--cc=aletes.xgr@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=thierry.reding@avionic-design.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.