mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
pwm: rockchip: add one period delay before disabling the dclk
For pwm v4, the disable operation, which sets polarity to inactive state, will not take effect until the end of current period. Change-Id: Ie632b69d06495d96b79b9c743e69175cd5c175ed Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
This commit is contained in:
@@ -783,6 +783,8 @@ static void rockchip_pwm_config_v4(struct pwm_chip *chip, struct pwm_device *pwm
|
||||
static int rockchip_pwm_enable_v4(struct pwm_chip *chip, struct pwm_device *pwm, bool enable)
|
||||
{
|
||||
struct rockchip_pwm_chip *pc = to_rockchip_pwm_chip(chip);
|
||||
struct pwm_state curstate;
|
||||
unsigned long delay_us;
|
||||
int ret;
|
||||
|
||||
if (enable) {
|
||||
@@ -793,8 +795,12 @@ static int rockchip_pwm_enable_v4(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||
|
||||
writel_relaxed(PWM_EN(enable) | PWM_CLK_EN(enable), pc->base + ENABLE);
|
||||
|
||||
if (!enable)
|
||||
if (!enable) {
|
||||
pwm_get_state(pwm, &curstate);
|
||||
delay_us = DIV_ROUND_UP_ULL(curstate.period, NSEC_PER_USEC);
|
||||
fsleep(delay_us);
|
||||
clk_disable(pc->clk);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user