[PATCH 2/2] regulator: pca9450: Make i2c-reset a warm reset optionally

From: Martin Kepplinger-Novakovic

Date: Thu Dec 03 2026 - 09:51:29 EST


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@xxxxxxxxxxxxx>
---
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