Skip to content

Commit 65e2e6c

Browse files
Uwe Kleine-Königthierryreding
authored andcommitted
pwm: sprd: Ensure configuring period and duty_cycle isn't wrongly skipped
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 <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent bebedf2 commit 65e2e6c

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
@@ -183,13 +183,10 @@ static int sprd_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
183183
}
184184
}
185185

186-
if (state->period != cstate->period ||
187-
state->duty_cycle != cstate->duty_cycle) {
188-
ret = sprd_pwm_config(spc, pwm, state->duty_cycle,
189-
state->period);
190-
if (ret)
191-
return ret;
192-
}
186+
ret = sprd_pwm_config(spc, pwm, state->duty_cycle,
187+
state->period);
188+
if (ret)
189+
return ret;
193190

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

0 commit comments

Comments
 (0)