Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1428733

[PATCH 2/5] pwm: tegra: Allow 100% duty cycle

From Laxman Dewangan <ldewangan@nvidia.com>
Newsgroups linux.kernel
Subject [PATCH 2/5] pwm: tegra: Allow 100% duty cycle
Date 2016-06-22 14:10 +0200
Message-ID <rMP8K-3bX-35@gated-at.bofh.it> (permalink)
References <rMP8J-3bX-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: "Victor(Weiguo) Pan" <wpan@nvidia.com>

To get 100% duty cycle (always high), pulse width needs to be
set to 256.

Signed-off-by: Victor(Weiguo) Pan <wpan@nvidia.com>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/pwm/pwm-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c
index 71b9c4d..575ca8e 100644
--- a/drivers/pwm/pwm-tegra.c
+++ b/drivers/pwm/pwm-tegra.c
@@ -79,7 +79,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 	 * per (1 << PWM_DUTY_WIDTH) cycles and make sure to round to the
 	 * nearest integer during division.
 	 */
-	c = duty_ns * ((1 << PWM_DUTY_WIDTH) - 1) + period_ns / 2;
+	c = duty_ns * (1 << PWM_DUTY_WIDTH) + period_ns / 2;
 	do_div(c, period_ns);
 
 	val = (u32)c << PWM_DUTY_SHIFT;
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] pwm: Fixes and support for Tegra186 Laxman Dewangan <ldewangan@nvidia.com> - 2016-06-22 14:10 +0200
  [PATCH 3/5] pwm: tegra: fix overflow when calculating duty cycle Laxman Dewangan <ldewangan@nvidia.com> - 2016-06-22 14:10 +0200
  [PATCH 2/5] pwm: tegra: Allow 100% duty cycle Laxman Dewangan <ldewangan@nvidia.com> - 2016-06-22 14:10 +0200
  [PATCH 4/5] pwm: tegra: Add DT node compatible for Tegra186 Laxman Dewangan <ldewangan@nvidia.com> - 2016-06-22 14:10 +0200
    Re: [PATCH 4/5] pwm: tegra: Add DT node compatible for Tegra186 Thierry Reding <thierry.reding@gmail.com> - 2016-06-22 14:50 +0200
  [PATCH 5/5] pwm: tegra: Add support for Tegra186 Laxman Dewangan <ldewangan@nvidia.com> - 2016-06-22 14:10 +0200

csiph-web