]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mfd: tps65219: Make poweroff handler conditional on system-power-controller
authorAkashdeep Kaur <a-kaur@ti.com>
Wed, 1 Apr 2026 11:22:57 +0000 (16:52 +0530)
committerLee Jones <lee@kernel.org>
Wed, 17 Jun 2026 10:30:19 +0000 (11:30 +0100)
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 <a-kaur@ti.com>
Link: https://patch.msgid.link/20260401112257.1248437-3-a-kaur@ti.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/tps65219.c

index 7275dcdb7c44fcaefd7ffdec7e46108d29a687d8..e52fbf1481fefdc89a1c108f56ecc858155f3b62 100644 (file)
@@ -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;
 }