From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Arnd Bergmann <arnd@arndb.de>, soc@kernel.org
Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de,
Sebastien Bourdelin <sebastien.bourdelin@gmail.com>
Subject: [PATCH v3 1/2] bus: ts-nbus: Convert to atomic pwm API
Date: Wed, 24 Jan 2024 09:12:04 +0100 [thread overview]
Message-ID: <4c9621d72bf6a7dc427e174edde6c1b0ae7a0469.1706083174.git.u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <cover.1706083174.git.u.kleine-koenig@pengutronix.de>
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.43.0
next prev parent reply other threads:[~2024-01-24 8:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 8:12 [PATCH v3 0/2] bus: ts-nbus: Two improvements Uwe Kleine-König
2024-01-24 8:12 ` Uwe Kleine-König [this message]
2024-03-12 20:09 ` [PATCH v3 1/2] bus: ts-nbus: Convert to atomic pwm API Arnd Bergmann
2024-01-24 8:12 ` [PATCH v3 2/2] bus: ts-nbus: Improve error reporting Uwe Kleine-König
2024-03-12 20:30 ` [PATCH v3 0/2] bus: ts-nbus: Two improvements patchwork-bot+linux-soc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4c9621d72bf6a7dc427e174edde6c1b0ae7a0469.1706083174.git.u.kleine-koenig@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=arnd@arndb.de \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=sebastien.bourdelin@gmail.com \
--cc=soc@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).