The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Guodong Xu <guodong@riscstar.com>
To: ukleinek@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, paul.walmsley@sifive.com,
	palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
	dlan@gentoo.org, p.zabel@pengutronix.de, drew@pdp7.com,
	inochiama@gmail.com, geert+renesas@glider.be, heylenay@4d2.org,
	tglx@linutronix.de, hal.feng@starfivetech.com,
	unicorn_wang@outlook.com, duje.mihanovic@skole.hr,
	heikki.krogerus@linux.intel.com
Cc: elder@riscstar.com, linux-pwm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
	guodong@riscstar.com
Subject: [PATCH v3 2/6] pwm: pxa: add optional reset control
Date: Tue, 29 Apr 2025 16:50:44 +0800	[thread overview]
Message-ID: <20250429085048.1310409-3-guodong@riscstar.com> (raw)
In-Reply-To: <20250429085048.1310409-1-guodong@riscstar.com>

Support optional reset control for the PWM PXA driver.

During the probe, it acquires the reset controller using
devm_reset_control_get_optional_exclusive_deasserted() to get and deassert
the reset controller to enable the PWM channel.

Signed-off-by: Guodong Xu <guodong@riscstar.com>
---
v3: Dropped the addition of a reset_control field to the struct pxa_pwm_chip
    Using a local variable for reset in pwm_probe() instead
v2: No change

 drivers/pwm/pwm-pxa.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
index 430bd6a709e9..f6a862531601 100644
--- a/drivers/pwm/pwm-pxa.c
+++ b/drivers/pwm/pwm-pxa.c
@@ -25,6 +25,7 @@
 #include <linux/io.h>
 #include <linux/pwm.h>
 #include <linux/of.h>
+#include <linux/reset.h>
 
 #include <asm/div64.h>
 
@@ -160,6 +161,7 @@ static int pwm_probe(struct platform_device *pdev)
 	const struct platform_device_id *id = platform_get_device_id(pdev);
 	struct pwm_chip *chip;
 	struct pxa_pwm_chip *pc;
+	struct reset_control *rst;
 	int ret = 0;
 
 	if (IS_ENABLED(CONFIG_OF) && id == NULL)
@@ -179,6 +181,11 @@ static int pwm_probe(struct platform_device *pdev)
 	if (IS_ERR(pc->clk))
 		return PTR_ERR(pc->clk);
 
+	rst = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev,
+								   NULL);
+	if (IS_ERR(rst))
+		return PTR_ERR(rst);
+
 	chip->ops = &pxa_pwm_ops;
 
 	if (IS_ENABLED(CONFIG_OF))
-- 
2.43.0


  parent reply	other threads:[~2025-04-29  8:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29  8:50 [PATCH v3 0/6] pwm: Update PWM_PXA driver for SpacemiT K1 Guodong Xu
2025-04-29  8:50 ` [PATCH v3 1/6] dt-bindings: pwm: marvell,pxa-pwm: Add SpacemiT K1 PWM support Guodong Xu
2025-04-29  8:50 ` Guodong Xu [this message]
2025-04-29  8:50 ` [PATCH v3 3/6] riscv: dts: spacemit: add PWM support for K1 SoC Guodong Xu
2025-04-29  8:50 ` [PATCH v3 4/6] riscv: dts: spacemit: add pwm14_1 pinctrl setting Guodong Xu
2025-05-26 16:54   ` Uwe Kleine-König
2025-05-26 21:52     ` Yixun Lan
2025-05-27  2:48       ` Guodong Xu
2025-05-27  3:27         ` Yixun Lan
2025-05-27  4:36           ` Guodong Xu
2025-04-29  8:50 ` [PATCH v3 5/6] pwm: Kconfig: add depends on ARCH_SPACEMIT to PWM_PXA Guodong Xu
2025-04-29  8:50 ` [PATCH v3 6/6] riscv: defconfig: Enable PWM support for SpacemiT K1 SoC Guodong Xu
2025-07-07 22:29   ` Yixun Lan
2025-07-08 16:50     ` Conor Dooley
2025-05-14  7:21 ` [PATCH v3 0/6] pwm: Update PWM_PXA driver for SpacemiT K1 Guodong Xu
2025-05-26 17:22 ` Uwe Kleine-König
2025-05-27  2:41   ` Guodong Xu
2025-05-27  9:03     ` Uwe Kleine-König
2025-07-08 14:33 ` (subset) " Yixun Lan
2025-07-09  6:37   ` Yixun Lan
2025-07-10  6:33     ` Guodong Xu

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=20250429085048.1310409-3-guodong@riscstar.com \
    --to=guodong@riscstar.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@gentoo.org \
    --cc=drew@pdp7.com \
    --cc=duje.mihanovic@skole.hr \
    --cc=elder@riscstar.com \
    --cc=geert+renesas@glider.be \
    --cc=hal.feng@starfivetech.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=heylenay@4d2.org \
    --cc=inochiama@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=p.zabel@pengutronix.de \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh@kernel.org \
    --cc=spacemit@lists.linux.dev \
    --cc=tglx@linutronix.de \
    --cc=ukleinek@kernel.org \
    --cc=unicorn_wang@outlook.com \
    /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