pwm: lpss: Allow duty cycle to be 0
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Sat, 28 Jan 2017 15:10:40 +0000 (17:10 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Mon, 30 Jan 2017 07:13:39 +0000 (08:13 +0100)
A duty cycle is represented by values [0..<period>] which reflects [0%..100%].
0% of the duty cycle means always off (logical "0") on output. Allow this in
the driver.

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-lpss.c

index 8642feeb8abd1628c2aa5b9757768f282e4e72d7..ffa01ab907a6f24b04cff6bb03e2581b88095915 100644 (file)
@@ -107,8 +107,6 @@ static int pwm_lpss_config(struct pwm_chip *chip, struct pwm_device *pwm,
 
        base_unit = DIV_ROUND_CLOSEST_ULL(freq, c);
 
-       if (duty_ns <= 0)
-               duty_ns = 1;
        on_time_div = 255ULL * duty_ns;
        do_div(on_time_div, period_ns);
        on_time_div = 255ULL - on_time_div;