Skip to content

Commit d92337b

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
pwm: sprd: Ensure configuring period and duty_cycle isn't wrongly skipped
[ Upstream commit 65e2e6c ] As the last call to sprd_pwm_apply() might have exited early if state->enabled was false, the values for period and duty_cycle stored in pwm->state might not have been written to hardware and it must be ensured that they are configured before enabling the PWM. Fixes: 8aae4b0 ("pwm: sprd: Add Spreadtrum PWM support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f1edbcc commit d92337b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/pwm/pwm-sprd.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,10 @@ static int sprd_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
180180
}
181181
}
182182

183-
if (state->period != cstate->period ||
184-
state->duty_cycle != cstate->duty_cycle) {
185-
ret = sprd_pwm_config(spc, pwm, state->duty_cycle,
186-
state->period);
187-
if (ret)
188-
return ret;
189-
}
183+
ret = sprd_pwm_config(spc, pwm, state->duty_cycle,
184+
state->period);
185+
if (ret)
186+
return ret;
190187

191188
sprd_pwm_write(spc, pwm->hwpwm, SPRD_PWM_ENABLE, 1);
192189
} else if (cstate->enabled) {

0 commit comments

Comments
 (0)