diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 4ab683a30629..449ba161877d 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -474,7 +474,14 @@ int pwm_apply_state(struct pwm_device *pwm, struct pwm_state *state) if (err) return err; - pwm->state = *state; + /* + * .apply might have to round some values in *state, if possible + * read the actually implemented value back. + */ + if (chip->ops->get_state) + chip->ops->get_state(chip, pwm, &pwm->state); + else + pwm->state = *state; } else { /* * FIXME: restore the initial state in case of error.