* [PATCH 0/2] bus: ts-nbus: Two improvements
@ 2023-12-09 22:35 Uwe Kleine-König
2023-12-09 22:35 ` [PATCH 1/2] bus: ts-nbus: Convert to atomic pwm API Uwe Kleine-König
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2023-12-09 22:35 UTC (permalink / raw)
To: Sebastien Bourdelin, Arnd Bergmann; +Cc: linux-pwm, linux-kernel, kernel
Hello,
while looking at the few last users of pwm_config() I found this driver
to be easily convertible to the atomic API. The second change is another
patch opportunity I noticed while modifying this driver.
Best regards
Uwe
Uwe Kleine-König (2):
bus: ts-nbus: Convert to atomic pwm API
bus: ts-nbus: Improve error reporting
drivers/bus/ts-nbus.c | 80 ++++++++++++++++++-------------------------
1 file changed, 33 insertions(+), 47 deletions(-)
base-commit: bc63de6e6ba0b16652c5fb4b9c9916b9e7ca1f23
--
2.42.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/2] bus: ts-nbus: Convert to atomic pwm API
2023-12-09 22:35 [PATCH 0/2] bus: ts-nbus: Two improvements Uwe Kleine-König
@ 2023-12-09 22:35 ` Uwe Kleine-König
0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2023-12-09 22:35 UTC (permalink / raw)
To: Sebastien Bourdelin, Arnd Bergmann; +Cc: linux-pwm, linux-kernel, kernel
With this change the PWM hardware is only configured once (instead of
three times.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/bus/ts-nbus.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/bus/ts-nbus.c b/drivers/bus/ts-nbus.c
index 4fa932cb0915..19c5d1f4e4d7 100644
--- a/drivers/bus/ts-nbus.c
+++ b/drivers/bus/ts-nbus.c
@@ -273,7 +273,7 @@ EXPORT_SYMBOL_GPL(ts_nbus_write);
static int ts_nbus_probe(struct platform_device *pdev)
{
struct pwm_device *pwm;
- struct pwm_args pargs;
+ struct pwm_state state;
struct device *dev = &pdev->dev;
struct ts_nbus *ts_nbus;
int ret;
@@ -296,25 +296,22 @@ static int ts_nbus_probe(struct platform_device *pdev)
return ret;
}
- pwm_get_args(pwm, &pargs);
- if (!pargs.period) {
+ pwm_init_state(pwm, &state);
+ if (!state.period) {
dev_err(&pdev->dev, "invalid PWM period\n");
return -EINVAL;
}
- /*
- * FIXME: pwm_apply_args() should be removed when switching to
- * the atomic PWM API.
- */
- pwm_apply_args(pwm);
- ret = pwm_config(pwm, pargs.period, pargs.period);
+ state.duty_cycle = state.period;
+ state.enabled = true;
+
+ ret = pwm_apply_state(pwm, &state);
if (ret < 0)
return ret;
/*
* we can now start the FPGA and populate the peripherals.
*/
- pwm_enable(pwm);
ts_nbus->pwm = pwm;
/*
--
2.42.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-09 22:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-09 22:35 [PATCH 0/2] bus: ts-nbus: Two improvements Uwe Kleine-König
2023-12-09 22:35 ` [PATCH 1/2] bus: ts-nbus: Convert to atomic pwm API Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).