summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2018-11-16 01:52:08 -0500
committerThierry Reding <thierry.reding@gmail.com>2018-11-16 05:02:47 -0500
commitf82d15e223403b05fffb33ba792b87a8620f6fee (patch)
tree542dacf632e6b6ec2818b6a1bc7831e42e6e6fa7 /drivers
parent651022382c7f8da46cb4872a545ee1da6d097d2a (diff)
pwm: lpc18xx-sct: Don't reconfigure PWM in .request and .free
Regarding the .request case: The consumer might be interested in taking over the configured state from the boot loader. So the initially configured state should be retained. For the free case the PWM consumer is responsible for disabling the PWM before calling pwm_put() and there are three subcases to consider: a) The PWM is already off. Then there is no gain in disabling the PWM once more. b) The PWM is still running and there is a good reason for that. (Not sure this is a valid case, I cannot imagine such a good reason.) Then it is counterproductive to disable the PWM. c) The PWM is still running because the consumer failed to disable the PWM. Then the consumer needs fixing and there is little incentive to paper over the problem in the backend driver. This aligns the lpc18xx-sct driver to the other PWM drivers that also don't reconfigure the hardware in .request and .free. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pwm/pwm-lpc18xx-sct.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c
index d7f5f7de030d..475918d9f543 100644
--- a/drivers/pwm/pwm-lpc18xx-sct.c
+++ b/drivers/pwm/pwm-lpc18xx-sct.c
@@ -296,7 +296,6 @@ static int lpc18xx_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
296 296
297 set_bit(event, &lpc18xx_pwm->event_map); 297 set_bit(event, &lpc18xx_pwm->event_map);
298 lpc18xx_data->duty_event = event; 298 lpc18xx_data->duty_event = event;
299 lpc18xx_pwm_config_duty(chip, pwm, pwm_get_duty_cycle(pwm));
300 299
301 return 0; 300 return 0;
302} 301}
@@ -306,8 +305,6 @@ static void lpc18xx_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
306 struct lpc18xx_pwm_chip *lpc18xx_pwm = to_lpc18xx_pwm_chip(chip); 305 struct lpc18xx_pwm_chip *lpc18xx_pwm = to_lpc18xx_pwm_chip(chip);
307 struct lpc18xx_pwm_data *lpc18xx_data = pwm_get_chip_data(pwm); 306 struct lpc18xx_pwm_data *lpc18xx_data = pwm_get_chip_data(pwm);
308 307
309 pwm_disable(pwm);
310 pwm_set_duty_cycle(pwm, 0);
311 clear_bit(lpc18xx_data->duty_event, &lpc18xx_pwm->event_map); 308 clear_bit(lpc18xx_data->duty_event, &lpc18xx_pwm->event_map);
312} 309}
313 310