UPSTREAM: pwm: Fix pwm_apply_args()
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Wed, 22 Jun 2016 07:25:14 +0000 (09:25 +0200)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 6 Mar 2017 10:28:40 +0000 (18:28 +0800)
commit19994c65c7ff9e113462bb8b1bc1b4a8189a865b
treedc72313a926812b6d8a3dc313109cc47c7d11b9b
parent60dc7d8eda74f19a77e7df386df56c9e58e1a7b0
UPSTREAM: pwm: Fix pwm_apply_args()

Commit 5ec803edcb70 ("pwm: Add core infrastructure to allow atomic
updates"), implemented pwm_disable() as a wrapper around
pwm_apply_state(), and then, commit ef2bf4997f7d ("pwm: Improve args
checking in pwm_apply_state()") added missing checks on the ->period
value in pwm_apply_state() to ensure we were not passing inappropriate
values to the ->config() or ->apply() methods.

The conjunction of these 2 commits led to a case where pwm_disable()
was no longer succeeding, thus preventing the polarity setting done
in pwm_apply_args().

Set a valid period in pwm_apply_args() to ensure polarity setting
won't be rejected.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Suggested-by: Brian Norris <briannorris@chromium.org>
Fixes: 5ec803edcb70 ("pwm: Add core infrastructure to allow atomic updates")
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 33cdcee04be3b4482be97393167e7561b2584e1e)

Change-Id: I9f28ae411953208b31c8d17214fce21e5177cee1
Signed-off-by: David Wu <david.wu@rock-chips.com>
include/linux/pwm.h