diff options
author | Maíra Canal <maira.canal@usp.br> | 2021-11-04 21:50:18 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2021-11-15 11:29:29 +0300 |
commit | 99076cd117c4cb51c684c066fb6bb85e23cb0624 (patch) | |
tree | c74a4734e42f7bbb2922a5ba8954a63cb4ac5c56 | |
parent | 8985696ad985f5311975d177f83e95127f0523c7 (diff) | |
download | linux-99076cd117c4cb51c684c066fb6bb85e23cb0624.tar.xz |
media: ir-rx51: Switch to atomic PWM API
Remove legacy PWM interface (pwm_config, pwm_enable, pwm_disable) and
replace it for the atomic PWM API.
Signed-off-by: Maíra Canal <maira.canal@usp.br>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r-- | drivers/media/rc/ir-rx51.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c index a0d9c02a7588..a3b145183260 100644 --- a/drivers/media/rc/ir-rx51.c +++ b/drivers/media/rc/ir-rx51.c @@ -19,6 +19,7 @@ struct ir_rx51 { struct rc_dev *rcdev; struct pwm_device *pwm; + struct pwm_state state; struct hrtimer timer; struct device *dev; wait_queue_head_t wqueue; @@ -32,22 +33,20 @@ struct ir_rx51 { static inline void ir_rx51_on(struct ir_rx51 *ir_rx51) { - pwm_enable(ir_rx51->pwm); + ir_rx51->state.enabled = true; + pwm_apply_state(ir_rx51->pwm, &ir_rx51->state); } static inline void ir_rx51_off(struct ir_rx51 *ir_rx51) { - pwm_disable(ir_rx51->pwm); + ir_rx51->state.enabled = false; + pwm_apply_state(ir_rx51->pwm, &ir_rx51->state); } static int init_timing_params(struct ir_rx51 *ir_rx51) { - struct pwm_device *pwm = ir_rx51->pwm; - int duty, period = DIV_ROUND_CLOSEST(NSEC_PER_SEC, ir_rx51->freq); - - duty = DIV_ROUND_CLOSEST(ir_rx51->duty_cycle * period, 100); - - pwm_config(pwm, duty, period); + ir_rx51->state.period = DIV_ROUND_CLOSEST(NSEC_PER_SEC, ir_rx51->freq); + pwm_set_relative_duty_cycle(&ir_rx51->state, ir_rx51->duty_cycle, 100); return 0; } @@ -242,6 +241,7 @@ static int ir_rx51_probe(struct platform_device *dev) /* Use default, in case userspace does not set the carrier */ ir_rx51.freq = DIV_ROUND_CLOSEST_ULL(pwm_get_period(pwm), NSEC_PER_SEC); + pwm_init_state(pwm, &ir_rx51.state); pwm_put(pwm); hrtimer_init(&ir_rx51.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |