mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: regulator: pca9450: add warm reset for i2c-reset pin
@ 2026-12-03 14:50 Martin Kepplinger-Novakovic
  2026-12-03 14:50 ` [PATCH 2/2] regulator: pca9450: Make i2c-reset a warm reset optionally Martin Kepplinger-Novakovic
  2026-12-03 15:07 ` [PATCH 1/2] dt-bindings: regulator: pca9450: add warm reset for i2c-reset pin Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Martin Kepplinger-Novakovic @ 2026-12-03 14:50 UTC (permalink / raw)
  To: lgirdwood, broonie, robh, krzk+dt, conor+dt, yibin.gong
  Cc: linux-kernel, devicetree, linux-pm

When resetting via i2c-reset pin, the pca9450 does a cold reset by default
(Power recycle all regulators except LDO1, LDO2 and CLK_32K_OUT). Add
support for doing Warm Reset (Toggle POR_B for 20 ms) instead if needed.

This is similar to the other reset source, WDOG_B, where this option
already exists as DT property.

Chapter 7.4 of the datasheet has the details:
https://www.nxp.com/docs/en/data-sheet/PCA9450.pdf

Signed-off-by: Martin Kepplinger-Novakovic <martin.kepplinger-novakovic@ginzinger.com>
---
 .../bindings/regulator/nxp,pca9450-regulator.yaml           | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
index ec04adfb9d1cb..e96c8873c1762 100644
--- a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml
@@ -133,6 +133,12 @@ properties:
     description:
       Indicates that the I2C Level Translator is used.
 
+  nxp,i2c-warm-reset:
+    type: boolean
+    description:
+      On i2c-reset, a warm reset (Toggle POR_B) will be done instead of cold
+      reset.
+
   nxp,wdog_b-warm-reset:
     type: boolean
     description:
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] regulator: pca9450: Make i2c-reset a warm reset optionally
  2026-12-03 14:50 [PATCH 1/2] dt-bindings: regulator: pca9450: add warm reset for i2c-reset pin Martin Kepplinger-Novakovic
@ 2026-12-03 14:50 ` Martin Kepplinger-Novakovic
  2026-12-03 15:07 ` [PATCH 1/2] dt-bindings: regulator: pca9450: add warm reset for i2c-reset pin Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Kepplinger-Novakovic @ 2026-12-03 14:50 UTC (permalink / raw)
  To: lgirdwood, broonie, robh, krzk+dt, conor+dt, yibin.gong
  Cc: linux-kernel, devicetree, linux-pm

When resetting via i2c-reset pin, the pca9450 does a cold reset by default
("Power recycle all regulators except LDO1, LDO2 and CLK_32K_OUT"). Add
support for doing Warm Reset ("Toggle POR_B for 20 ms") instead if needed.

Implement this using the DT property nxp,i2c-warm-reset.

Chapter 7.4 of the datasheet has the details, see
https://www.nxp.com/docs/en/data-sheet/PCA9450.pdf

Signed-off-by: Martin Kepplinger-Novakovic <martin.kepplinger-novakovic@ginzinger.com>
---
 drivers/regulator/pca9450-regulator.c | 8 +++++++-
 include/linux/regulator/pca9450.h     | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
index f1c787e6db8bf..8423abc55612f 100644
--- a/drivers/regulator/pca9450-regulator.c
+++ b/drivers/regulator/pca9450-regulator.c
@@ -45,6 +45,7 @@ struct pca9450 {
 	int irq;
 	bool sd_vsel_fixed_low;
 	int default_t_off_deb;
+	int sw_reset_cmd;
 };
 
 static const struct regmap_range pca9450_status_range = {
@@ -1195,7 +1196,7 @@ static int pca9450_i2c_restart_handler(struct sys_off_data *data)
 	struct i2c_client *i2c = container_of(pca9450->dev, struct i2c_client, dev);
 
 	dev_dbg(&i2c->dev, "Restarting device..\n");
-	if (i2c_smbus_write_byte_data(i2c, PCA9450_REG_SWRST, SW_RST_COMMAND) == 0) {
+	if (i2c_smbus_write_byte_data(i2c, PCA9450_REG_SWRST, pca9450->sw_reset_cmd) == 0) {
 		/* tRESTART is 250ms, so 300 should be enough to make sure it happened */
 		mdelay(300);
 		/* When we get here, the PMIC didn't power cycle for some reason. so warn.*/
@@ -1223,6 +1224,11 @@ static int pca9450_of_init(struct pca9450 *pca9450)
 	else
 		reset_ctrl = WDOG_B_CFG_COLD_LDO12;
 
+	if (of_property_read_bool(i2c->dev.of_node, "nxp,i2c-warm-reset"))
+		pca9450->sw_reset_cmd = SW_RST_WARM_COMMAND;
+	else
+		pca9450->sw_reset_cmd = SW_RST_COMMAND;
+
 	/* Set reset behavior on assertion of WDOG_B signal */
 	ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_RESET_CTRL,
 				 WDOG_B_CFG_MASK, reset_ctrl);
diff --git a/include/linux/regulator/pca9450.h b/include/linux/regulator/pca9450.h
index bf94df5fafe30..599bf43713a17 100644
--- a/include/linux/regulator/pca9450.h
+++ b/include/linux/regulator/pca9450.h
@@ -273,5 +273,6 @@ enum {
 
 /* PCA9450_REG_SW_RST command */
 #define SW_RST_COMMAND			0x14
+#define SW_RST_WARM_COMMAND		0x35
 
 #endif /* __LINUX_REG_PCA9450_H__ */
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] dt-bindings: regulator: pca9450: add warm reset for i2c-reset pin
  2026-12-03 14:50 [PATCH 1/2] dt-bindings: regulator: pca9450: add warm reset for i2c-reset pin Martin Kepplinger-Novakovic
  2026-12-03 14:50 ` [PATCH 2/2] regulator: pca9450: Make i2c-reset a warm reset optionally Martin Kepplinger-Novakovic
@ 2026-12-03 15:07 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-12-03 15:07 UTC (permalink / raw)
  To: Martin Kepplinger-Novakovic
  Cc: lgirdwood, robh, krzk+dt, conor+dt, yibin.gong, linux-kernel,
	devicetree, linux-pm

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

On Thu, Dec 03, 2026 at 03:50:50PM +0100, Martin Kepplinger-Novakovic wrote:
> When resetting via i2c-reset pin, the pca9450 does a cold reset by default
> (Power recycle all regulators except LDO1, LDO2 and CLK_32K_OUT). Add
> support for doing Warm Reset (Toggle POR_B for 20 ms) instead if needed.

Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-03 15:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 14:50 [PATCH 1/2] dt-bindings: regulator: pca9450: add warm reset for i2c-reset pin Martin Kepplinger-Novakovic
2026-12-03 14:50 ` [PATCH 2/2] regulator: pca9450: Make i2c-reset a warm reset optionally Martin Kepplinger-Novakovic
2026-12-03 15:07 ` [PATCH 1/2] dt-bindings: regulator: pca9450: add warm reset for i2c-reset pin Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®