Skip to content

Commit fe8255f

Browse files
Uwe Kleine-Königthierryreding
authored andcommitted
pwm: spear: Ensure configuring period and duty_cycle isn't wrongly skipped
As the last call to spear_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: 98761ce ("pwm: spear: Implement .apply() callback") Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 65e2e6c commit fe8255f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/pwm/pwm-spear.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,9 @@ static int spear_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
177177
return 0;
178178
}
179179

180-
if (state->period != pwm->state.period ||
181-
state->duty_cycle != pwm->state.duty_cycle) {
182-
err = spear_pwm_config(chip, pwm, state->duty_cycle, state->period);
183-
if (err)
184-
return err;
185-
}
180+
err = spear_pwm_config(chip, pwm, state->duty_cycle, state->period);
181+
if (err)
182+
return err;
186183

187184
if (!pwm->state.enabled)
188185
return spear_pwm_enable(chip, pwm);

0 commit comments

Comments
 (0)