pwm: pca9685: Fix period change with same duty cycle
authorClemens Gruber <clemens.gruber@pqgruber.com>
Tue, 13 Dec 2016 15:52:50 +0000 (16:52 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Fri, 20 Jan 2017 06:43:22 +0000 (07:43 +0100)
commit8d254a340efb12b40c4c1ff25a48a4f48f7bbd6b
tree943df008c9e7718d8fba67687c4fb200cbd877f8
parentb2ec9efc1f4fb1dc13a599db88019d5472deef9b
pwm: pca9685: Fix period change with same duty cycle

When first implementing support for changing the output frequency, an
optimization was added to continue the PWM after changing the prescaler
without having to reprogram the ON and OFF registers for the duty cycle,
in case the duty cycle stayed the same. This was flawed, because we
compared the absolute value of the duty cycle in nanoseconds instead of
the ratio to the period.

Fix the problem by removing the shortcut.

Fixes: 01ec8472009c9 ("pwm-pca9685: Support changing the output frequency")
Cc: <stable@vger.kernel.org> # v4.3+
Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-pca9685.c