Skip to content

Commit 7d6d4aa

Browse files
Uwe Kleine-Königthierryreding
authored andcommitted
pwm: berlin: Ensure configuring period and duty_cycle isn't wrongly skipped
As the last call to berlin_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: 30dffb4 ("pwm: berlin: Implement .apply() callback") Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 25f70b8 commit 7d6d4aa

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/pwm/pwm-berlin.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,9 @@ static int berlin_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
190190
return 0;
191191
}
192192

193-
if (state->period != pwm->state.period ||
194-
state->duty_cycle != pwm->state.duty_cycle) {
195-
err = berlin_pwm_config(chip, pwm, state->duty_cycle, state->period);
196-
if (err)
197-
return err;
198-
}
193+
err = berlin_pwm_config(chip, pwm, state->duty_cycle, state->period);
194+
if (err)
195+
return err;
199196

200197
if (!enabled)
201198
return berlin_pwm_enable(chip, pwm);

0 commit comments

Comments
 (0)