linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pwm: lpc32xx - Fix the PWM polarity
@ 2012-11-05 16:48 Alban Bedel
  2012-11-05 21:03 ` Thierry Reding
  0 siblings, 1 reply; 13+ messages in thread
From: Alban Bedel @ 2012-11-05 16:48 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-kernel, Alban Bedel

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
---
 drivers/pwm/pwm-lpc32xx.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
index adb87f0..a2704b8 100644
--- a/drivers/pwm/pwm-lpc32xx.c
+++ b/drivers/pwm/pwm-lpc32xx.c
@@ -51,7 +51,11 @@ static int lpc32xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 
 	c = 256 * duty_ns;
 	do_div(c, period_ns);
-	duty_cycles = c;
+	if (c > 255)
+		c = 255;
+	if (c < 1)
+		c = 1;
+	duty_cycles = 256 - c;
 
 	writel(PWM_ENABLE | PWM_RELOADV(period_cycles) | PWM_DUTY(duty_cycles),
 		lpc32xx->base + (pwm->hwpwm << 2));
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-11-08 13:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-05 16:48 [PATCH] pwm: lpc32xx - Fix the PWM polarity Alban Bedel
2012-11-05 21:03 ` Thierry Reding
2012-11-06  9:36   ` Roland Stigge
     [not found]     ` <CAAAP30HwBzYFpy942UyiQX2SkzV4naBbhwichp201bvfEm2mxA@mail.gmail.com>
2012-11-06 17:19       ` Alban Bedel
2012-11-07 15:25         ` Alban Bedel
2012-11-07 15:58           ` Alexandre Pereira da Silva
2012-11-08  9:51           ` Roland Stigge
2012-11-08 10:33             ` Alban Bedel
2012-11-08 10:44               ` Roland Stigge
2012-11-08 11:23                 ` Alban Bedel
2012-11-08 11:46                   ` Alban Bedel
2012-11-08 13:12                   ` Roland Stigge
2012-11-08 13:49                     ` Alexandre Pereira da Silva

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).