* [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:04 ` sashiko-bot
2026-12-03 15:07 ` [PATCH 1/2] dt-bindings: regulator: pca9450: add warm reset for i2c-reset pin Mark Brown
2026-12-03 15:10 ` sashiko-bot
2 siblings, 1 reply; 5+ 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 related [flat|nested] 5+ messages in thread* Re: [PATCH 2/2] regulator: pca9450: Make i2c-reset a warm reset optionally
2026-12-03 14:50 ` [PATCH 2/2] regulator: pca9450: Make i2c-reset a warm reset optionally Martin Kepplinger-Novakovic
@ 2026-12-03 15:04 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-03 15:04 UTC (permalink / raw)
To: Martin Kepplinger-Novakovic; +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] regulator: pca9450: hardcoding SW reset mode in DT ignores
reboot_mode
- [Low] regulator: pca9450: commit message mislabels I2C SW_RST as a pin
--
commit ddf73cff1946d2e4ed9535b9671c2901505af39d
Author: Martin Kepplinger-Novakovic <martink@posteo.de>
regulator: pca9450: Make i2c-reset a warm reset optionally
This commit adds the nxp,i2c-warm-reset DT property to make
pca9450_i2c_restart_handler() issue a warm reset command (0x35) to
PCA9450_REG_SWRST instead of the default cold reset command (0x14).
> 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.
[Severity: Low]
Is "i2c-reset pin" accurate here? PCA9450_REG_SWRST is an I2C software
reset command issued by pca9450_i2c_restart_handler(), not a hardware
reset pin like WDOG_B.
The commit message also does not explain what board-level constraint
requires fixing warm reset in DT rather than selecting it at runtime.
> 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
[ ... ]
> @@ -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);
[Severity: Medium]
Should pca9450_i2c_restart_handler() select warm vs cold reset from
data->mode instead of hardcoding it via the nxp,i2c-warm-reset DT
property?
Unlike nxp,wdog_b-warm-reset, which configures the hardware WDOG_B input,
PCA9450_REG_SWRST is a software command sent during restart. Fixing it in
DT ignores reboot=warm/reboot=cold and /sys/kernel/reboot/mode, preventing
boards with the property from forcing a cold reset.
Checking data->mode == REBOOT_WARM in pca9450_i2c_restart_handler()
(matching tps65219_restart() in drivers/mfd/tps65219.c) would support both
modes at runtime without adding a vendor DT property.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203145051.489939-1-martin.kepplinger-novakovic@ginzinger.com?part=2
^ permalink raw reply [flat|nested] 5+ 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
2026-12-03 15:10 ` sashiko-bot
2 siblings, 0 replies; 5+ 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] 5+ 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 ` [PATCH 1/2] dt-bindings: regulator: pca9450: add warm reset for i2c-reset pin Mark Brown
@ 2026-12-03 15:10 ` sashiko-bot
2 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-03 15:10 UTC (permalink / raw)
To: Martin Kepplinger-Novakovic; +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] dt-bindings: pca9450: nxp,i2c-warm-reset encodes reboot
policy in DT
- [Low] dt-bindings: pca9450: commit message misnames SWRST as i2c-reset
pin
--
commit 6e93067008e7e3d0a4d8aec9f49f40a9c494db06
Author: Martin Kepplinger-Novakovic <martink@posteo.de>
dt-bindings: regulator: pca9450: add warm reset for i2c-reset pin
This commit adds the nxp,i2c-warm-reset boolean property to the PCA9450
regulator Device Tree binding.
> dt-bindings: regulator: pca9450: add warm reset for i2c-reset pin
>
> When resetting via i2c-reset pin, the pca9450 does a cold reset by default
[Severity: Low]
Does the PCA9450 have an i2c-reset pin?
Unlike WDOG_B, I2C reset is a software reset command written to
PCA9450_REG_SWRST in pca9450_i2c_restart_handler(), where software selects
the command byte rather than the hardware defaulting to cold reset.
The binding description similarly says "i2c-reset" rather than identifying
the I2C SWRST software command.
> 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:
[Severity: Medium]
Should nxp,i2c-warm-reset be a Device Tree property rather than using
reboot_mode at runtime?
Device Tree bindings describe hardware topology and board-level constraints,
not software reboot policy, and adding this boolean creates a permanent DT
ABI for a software preference.
Unlike WDOG_B, a hardware pin whose response must be pre-configured in
PCA9450_REG_RESET_CTRL, I2C reset is triggered by software in
pca9450_i2c_restart_handler(). That SYS_OFF_MODE_RESTART handler already
receives data->mode (REBOOT_WARM vs REBOOT_COLD).
Other PMIC drivers such as tps65219_restart() in drivers/mfd/tps65219.c
select warm or cold I2C reset directly from data->mode == REBOOT_WARM
without adding a vendor DT property.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203145051.489939-1-martin.kepplinger-novakovic@ginzinger.com?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread