pwm: tegra: Allow 100 % duty cycle
authorVictor(Weiguo) Pan <wpan@nvidia.com>
Wed, 22 Jun 2016 11:47:20 +0000 (17:17 +0530)
committerThierry Reding <thierry.reding@gmail.com>
Mon, 11 Jul 2016 10:49:32 +0000 (12:49 +0200)
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>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-tegra.c

index 097658e..2026eaa 100644 (file)
@@ -77,7 +77,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;