Skip to contentSkip to conversation

Make TPS65219 poweroff handler conditional

PATCH Applied Akashdeep Kaur 3 participants 5 messages Apr 1 – May 5

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 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 v3:
- Fixed minor formatting issues in PMIC driver
- Link to v2: https://lore.kernel.org/all/[email protected]/

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
#1 lore raw

PATCH v3 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
index 3e2d8f669535..786a7d695b33 100644
@@ -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
#2 lore raw

PATCH v3 2/2 mfd: tps65219: Make poweroff handler conditional on system-power-controller

In reply to 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.

---
 drivers/mfd/tps65219.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/mfd/tps65219.c +8 -6
index 7275dcdb7c44..e52fbf1481fe 100644
@@ -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
maintainer Applied
#3 lore raw

Re: (subset) [PATCH v3 2/2] mfd: tps65219: Make poweroff handler conditional on system-power-controller

Quoted 10 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.

[...]

Applied, thanks!

[2/2] mfd: tps65219: Make poweroff handler conditional on system-power-controller

      commit: 0af600b8e3bced37afa267ac9a7f68e15764f502

--
Lee Jones [李琼斯]

maintainer Applied
#4 lore raw

Re: (subset) [PATCH v3 0/2] Make TPS65219 poweroff handler conditional

In reply to Akashdeep Kaur

Hi Akashdeep Kaur,

Quoted 10 lines · Akashdeep Kaur

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.

[...]

I have applied the following to branch ti-k3-dts-next on [1]. Thank you!

[1/2] arm64: dts: ti: k3-am62-lp-sk: Add system-power-controller

      commit: abbc2a8235944a78f0a0003fb95cdf6ec5a150a1

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent up the chain during the next merge window (or sooner if it is a relevant bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git

Signature · 4 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
https://ti.com/opensource