Make TPS65219 poweroff handler conditional
Subsystems (4)
v2 cover Make TPS65219 poweroff handler conditional
This series makes the TPS65219 PMIC poweroff handler registration conditional based on device tree configuration, following standard kernel patterns.
Currently, the TPS65219 driver unconditionally registers as the system poweroff handler. This creates conflicts on platforms where alternative poweroff mechanisms (such as TF-A firmware or other power controllers) should handle system shutdown instead.
The standard kernel approach is to use the "system-power-controller" device tree property to explicitly designate which component is responsible for system poweroff operations.
Patch 1: Add "system-power-controller" property to AM62-LP-SK device
tree, explicitly designating the TPS65219 PMIC as the system power controller for this platform. This property was missing only on AM62-LP-SK among all in-tree TPS65219-based devices.
Patch 2: Update TPS65219 driver to only register poweroff handler when
"system-power-controller" property is present. This allows other systems using this PMIC to use alternative poweroff mechanisms.
Impact:
- AM62-LP-SK: No functional change (property added, handler still registers)
- Other TPS65219-based systems: Poweroff handler registration becomes opt-in via DT property
Tested on AM62-LP-SK - system poweroff works correctly.
Changes in v2:
- Addressed review feedback by removing comment on self explanatory code
- Link to v1: https://lore.kernel.org/all/[email protected]/
---
Akashdeep Kaur (2):
arm64: dts: ti: k3-am62-lp-sk: Add system-power-controller
mfd: tps65219: Make poweroff handler conditional on
system-power-controller
arch/arm64/boot/dts/ti/k3-am62-lp-sk.dts | 1 + drivers/mfd/tps65219.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/2 arm64: dts: ti: k3-am62-lp-sk: Add system-power-controller
On AM62-LP-SK, the TPS65219 PMIC is the system power controller responsible for handling system poweroff. Add the "system-power-controller" property to the PMIC node to explicitly designate it as such.
Among all in-tree device trees using the TPS65219 PMIC (verified via compatible string), AM62-LP-SK was the only one missing this property. This patch corrects that omission.
This property will be used by the PMIC driver to conditionally register the poweroff handler, ensuring only the designated power controller registers for system poweroff operations.
--- arch/arm64/boot/dts/ti/k3-am62-lp-sk.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/ti/k3-am62-lp-sk.dts +1 -0
@@ -206,6 +206,7 @@ tps65219: pmic@30 { interrupt-parent = <&gic500>; interrupts = <GIC_SPI 224 IRQ_TYPE_LEVEL_HIGH>; + system-power-controller; regulators { buck1_reg: buck1 {
Signature · 1 line
2.34.1
PATCH v2 2/2 mfd: tps65219: Make poweroff handler conditional on system-power-controller
In reply to Akashdeep KaurCurrently, the TPS65219 driver unconditionally registers a poweroff handler. This causes issues on systems where a different component (such as TF-A firmware) should handle system poweroff instead.
Make the poweroff handler registration conditional based on the "system-power-controller" device tree property. This follows the standard kernel pattern where only the designated power controller registers for system poweroff operations.
On systems where the property is absent, the PMIC will not register a poweroff handler, allowing other poweroff mechanisms to function.
--- drivers/mfd/tps65219.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/mfd/tps65219.c +8 -6
@@ -541,13 +541,15 @@ static int tps65219_probe(struct i2c_client *client)return ret; } - ret =devm_register_power_off_handler (tps->dev, - tps65219_power_off_handler, - tps); -if (ret) { -dev_err (tps->dev,"failed to register power-off handler: %d\n" , ret); -return ret; +if (of_device_is_system_power_controller (tps->dev->of_node)) { + ret =devm_register_power_off_handler (tps->dev, + tps65219_power_off_handler, + tps); +if (ret) +return dev_err_probe (tps->dev, ret, +"failed to register power-off handler\n" ); } +return 0 ; }
Signature · 1 line
2.34.1
Lee Jones
maintainerRe: [PATCH v2 2/2] mfd: tps65219: Make poweroff handler conditional on system-power-controller
---
Quoted 28 lines · Akashdeep Kaur
Currently, the TPS65219 driver unconditionally registers a poweroff handler. This causes issues on systems where a different component (such as TF-A firmware) should handle system poweroff instead.
Make the poweroff handler registration conditional based on the "system-power-controller" device tree property. This follows the standard kernel pattern where only the designated power controller registers for system poweroff operations.
On systems where the property is absent, the PMIC will not register a poweroff handler, allowing other poweroff mechanisms to function.
Signed-off-by Akashdeep Kaur <[email protected]>--- drivers/mfd/tps65219.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)drivers/mfd/tps65219.c +0
-3@@ -541,13 +541,15 @@ static int tps65219_probe(struct i2c_client *client)return ret; } - ret =devm_register_power_off_handler (tps->dev, - tps65219_power_off_handler, - tps);
drivers/mfd/tps65219.c static int tps65219_probe(struct i2c_client *client) · line 550
Quoted 10 lines
drivers/mfd/tps65219.c +7
-3-if (ret) { -dev_err (tps->dev,"failed to register power-off handler: %d\n" , ret); -return ret; +if (of_device_is_system_power_controller (tps->dev->of_node)) { + ret =devm_register_power_off_handler (tps->dev, + tps65219_power_off_handler, + tps); +if (ret) +return dev_err_probe (tps->dev, ret, +"failed to register power-off handler\n" );
Couple of nits to fix.
The " should be aligned with the ( and the failed should be capitalised.
Quoted 8 lines
drivers/mfd/tps65219.c +1
-0} +return 0 ; }Signature · 1 line
2.34.1
Signature · 1 line
Lee Jones [李琼斯]
Re: [PATCH v2 2/2] mfd: tps65219: Make poweroff handler conditional on system-power-controller
Hi Lee,
Quoted 45 lines · Lee Jones
---
Quoted 28 lines · Akashdeep Kaur
Currently, the TPS65219 driver unconditionally registers a poweroff handler. This causes issues on systems where a different component (such as TF-A firmware) should handle system poweroff instead.
Make the poweroff handler registration conditional based on the "system-power-controller" device tree property. This follows the standard kernel pattern where only the designated power controller registers for system poweroff operations.
On systems where the property is absent, the PMIC will not register a poweroff handler, allowing other poweroff mechanisms to function.
Signed-off-by Akashdeep Kaur <[email protected]>--- drivers/mfd/tps65219.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)drivers/mfd/tps65219.c +0
-3@@ -541,13 +541,15 @@ static int tps65219_probe(struct i2c_client *client)return ret; } - ret =devm_register_power_off_handler (tps->dev, - tps65219_power_off_handler, - tps);drivers/mfd/tps65219.c static int tps65219_probe(struct i2c_client *client) · line 550
Quoted 10 lines
drivers/mfd/tps65219.c +7
-3-if (ret) { -dev_err (tps->dev,"failed to register power-off handler: %d\n" , ret); -return ret; +if (of_device_is_system_power_controller (tps->dev->of_node)) { + ret =devm_register_power_off_handler (tps->dev, + tps65219_power_off_handler, + tps); +if (ret) +return dev_err_probe (tps->dev, ret, +"failed to register power-off handler\n" );Couple of nits to fix.
Quoted 1 line
The
"should be aligned with the(and thefailedshould be capitalised.
Fixed the formatting issues.
Quoted 10 lines
Quoted 9 lines
drivers/mfd/tps65219.c +1
-0} +return 0 ; }Signature · 1 line
2.34.1
Regards,
Akashdeep Kaur