pwm: rockchip: State of PWM clock should synchronize with PWM enabled state
authorDavid Wu <david.wu@rock-chips.com>
Wed, 1 Mar 2017 11:10:55 +0000 (19:10 +0800)
committerThierry Reding <thierry.reding@gmail.com>
Thu, 6 Apr 2017 13:08:52 +0000 (15:08 +0200)
commita900152b5c29aea8134cc7a4c5db25552b3cd8f7
treeb2c1710e98c98cf6cfb2db2bcdf8c2778e9422c8
parentb997e3edca4fb4ab7732ab7240c545da0c360a44
pwm: rockchip: State of PWM clock should synchronize with PWM enabled state

If the PWM was not enabled at U-Boot loader, PWM could not work for
clock always disabled at PWM driver. The PWM clock is enabled at
beginning of pwm_apply(), but disabled at end of pwm_apply().

If the PWM was enabled at U-Boot loader, PWM clock is always enabled
unless closed by ATF. The pwm-backlight might turn off the power at
early suspend, should disable PWM clock for saving power consume.

It is important to provide opportunity to enable/disable clock at PWM
driver, the PWM consumer should ensure correct order to call PWM enable
and disable, and PWM driver ensure state of PWM clock synchronized with
PWM enabled state.

Fixes: 2bf1c98aa5a4 ("pwm: rockchip: Add support for atomic update")
Cc: stable@vger.kernel.org
Signed-off-by: David Wu <david.wu@rock-chips.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-rockchip.c