From patchwork Wed Jan 24 08:12:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13528765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF2E8C46CD2 for ; Wed, 24 Jan 2024 08:12:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 9E816C43394; Wed, 24 Jan 2024 08:12:38 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 7A7A1C433C7 for ; Wed, 24 Jan 2024 08:12:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 7A7A1C433C7 Authentication-Results: smtp.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rSYN2-0005Lx-2P; Wed, 24 Jan 2024 09:12:28 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rSYN1-0020vP-LW; Wed, 24 Jan 2024 09:12:27 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rSYN1-006z9q-1s; Wed, 24 Jan 2024 09:12:27 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= List-Id: To: Arnd Bergmann , soc@kernel.org Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sebastien Bourdelin Subject: [PATCH v3 1/2] bus: ts-nbus: Convert to atomic pwm API Date: Wed, 24 Jan 2024 09:12:04 +0100 Message-ID: <4c9621d72bf6a7dc427e174edde6c1b0ae7a0469.1706083174.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1441; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=61dg6kJV4BhcvrrnMUjQLyQd3kNaWCq2zXIx0/k9U3g=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlsMZWF1DSFYTy/INHYTUKoolpuICB1d242jI87 XOdP26vtgKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZbDGVgAKCRCPgPtYfRL+ Trt9B/9HFBycopmSADO6lpJHTnQ20qenZLqzsmvUa84D1ZL7gwQf47ei1LsQ+Gf1DcK3ZGISEvV H2IEJP1EjCK91kw89jA6+fAZDbi9Pykcn81RWh+HUW/j/gu4vN4dA6Xk1c6jHhh17STC9pKRRLV MoOFea5PsBonii9uCaW1McyGVG5pjz3Z30AB6iI0RgmQYHUwvDUsdGKYJEJdzlEDNhWgQWHtlrQ ei6rVQC72wn4lHqcPQW90BiUfM+wWo3vnJ3Z9jbkON/j3pJSduk63ncCl2Ws/dM6cB39DiyM/6a /bxFNr/q2o+IT8dYsFRr9kIn0UMHJw7kOpq+2brfK8Y9Wque X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: soc@kernel.org With this change the PWM hardware is only configured once (instead of three times). Signed-off-by: Uwe Kleine-König --- 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; /*