summaryrefslogtreecommitdiff |
diff options
author | Takashi Iwai <tiwai@suse.de> | 2018-07-10 15:45:06 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-07-10 15:45:15 +0200 |
commit | aab355b92beca55e661ca671431633f5db24fdb5 (patch) | |
tree | 8fc69a45ffaba9830ed2360993052709add86600 | |
parent | ef78980574dc515ad9d3f1b6f944b7b21a9becce (diff) |
pwm: rcar: Fix a condition to prevent mismatch value setting
to duty (bsc#1051510).
suse-commit: fa9b53af957902a0ed75b2d5398d88b5e211ef57
-rw-r--r-- | drivers/pwm/pwm-rcar.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c index 1c85ecc9e7ac..0fcf94ffad32 100644 --- a/drivers/pwm/pwm-rcar.c +++ b/drivers/pwm/pwm-rcar.c @@ -156,8 +156,12 @@ static int rcar_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, if (div < 0) return div; - /* Let the core driver set pwm->period if disabled and duty_ns == 0 */ - if (!pwm_is_enabled(pwm) && !duty_ns) + /* + * Let the core driver set pwm->period if disabled and duty_ns == 0. + * But, this driver should prevent to set the new duty_ns if current + * duty_cycle is not set + */ + if (!pwm_is_enabled(pwm) && !duty_ns && !pwm->state.duty_cycle) return 0; rcar_pwm_update(rp, RCAR_PWMCR_SYNC, RCAR_PWMCR_SYNC, RCAR_PWMCR); |