pwm: sunxi: fix off-by-one that prevented PWM to use prescaler bypass
authorVasily Khoruzhick <anarsoul@gmail.com>
Wed, 17 Oct 2018 04:56:33 +0000 (21:56 -0700)
committerJagan Teki <jagan@amarulasolutions.com>
Wed, 24 Oct 2018 16:26:57 +0000 (21:56 +0530)
Fix off-by-one that prevented PWM driver to use prescaler bypass.
Without this change prescaler is always enabled.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
drivers/pwm/sunxi_pwm.c

index 3c7dffdd9098e129475009a4c3a484f7d40c3e38..baee503730672558662de07e9980af629ab2df74 100644 (file)
@@ -74,7 +74,7 @@ static int sunxi_pwm_set_config(struct udevice *dev, uint channel,
 
        debug("%s: period_ns=%u, duty_ns=%u\n", __func__, period_ns, duty_ns);
 
-       for (prescaler = 0; prescaler < SUNXI_PWM_CTRL_PRESCALE0_MASK;
+       for (prescaler = 0; prescaler <= SUNXI_PWM_CTRL_PRESCALE0_MASK;
             prescaler++) {
                if (!prescaler_table[prescaler])
                        continue;