[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ae9784dfb98ff63b44735b903e7f4d4e3980222.1702967898.git.u.kleine-koenig@pengutronix.de>
Date: Tue, 19 Dec 2023 07:44:14 +0100
From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To: Arnd Bergmann <arnd@...db.de>
Cc: kernel@...gutronix.de,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Thierry Reding <thierry.reding@...il.com>,
linux-kernel@...r.kernel.org,
linux-pwm@...r.kernel.org
Subject: [PATCH 1/2] bus: ts-nbus: Convert to atomic pwm API
With this change the PWM hardware is only configured once (instead of
three times).
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
---
Changes since (implicit) v1
(https://lore.kernel.org/linux-kernel/c3db8ab2bb447f55aa0f2af0aa3cc6e758b6acc9.1702160838.git.u.kleine-koenig@pengutronix.de):
- Add a closing parenthesis to the commit log (xkcd#859)
- Rebase to todays next/master (trivial)
Arnd, there is no dedicated maintainer for drivers/bus. Would you take
these patches? Tell me if you prefer a PR.
Best regards
Uwe
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;
/*
base-commit: aa4db8324c4d0e67aa4670356df4e9fae14b4d37
--
2.42.0
Powered by blists - more mailing lists