pwm: sun4i: Properly check current state
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 25 Feb 2018 01:55:58 +0000 (02:55 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Tue, 27 Mar 2018 23:07:57 +0000 (01:07 +0200)
commit989ae7a5b2f965dc5e6de132f1d8c0ea8c23c3c5
tree6021a938ed865b1f2008a78d0cd7c6347bb94b92
parent120cc2fff40096fb99d96d8671ad7469dd44862f
pwm: sun4i: Properly check current state

Correctly extract the prescaler value from CTRL_REG before comparing it
to PWM_PRESCAL_MASK.

Also, check that both PWM_CLK_GATING and PWM_EN to ensure the PWM is
enabled instead of relying on only one of those.

Fixes: 93e0dfb2c52f ("pwm: sun4i: Improve hardware read out")
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-sun4i.c