Hi Svyatoslav,

On 2/9/26 7:39 PM, Svyatoslav Ryhel wrote:
Add a condition to enable the PMIC sysreset function via the
system-power-controller device tree property in addition to the existing
Kconfig dependency, provided the PMIC supports it.


Reviewed-by: Quentin Schulz <[email protected]> # RK8xx

I've added in Cc people who have contributed to devices that will lose support for sysreset once this gets merged.

Because they are missing a system-power-controller property in the RK8xx PMIC Device Tree node, the following device trees will be impacted:

dts/upstream/src/arm64/amlogic/meson-g12b-odroid-go-ultra.dts
dts/upstream/src/arm64/rockchip/rk3326-anbernic-rg351m.dtsi
dts/upstream/src/arm64/rockchip/rk3326-odroid-go.dtsi
dts/upstream/src/arm64/rockchip/rk3399-evb-ind.dts
dts/upstream/src/arm64/rockchip/rk3566-anbernic-rgxx3.dtsi
dts/upstream/src/arm64/rockchip/rk3566-powkiddy-rk2023.dtsi
dts/upstream/src/arm64/rockchip/rk3566-powkiddy-x55.dts
dts/upstream/src/arm64/rockchip/rk3588-coolpi-cm5.dtsi
dts/upstream/src/arm64/rockchip/rk3588s-coolpi-4b.dts
dts/upstream/src/arm64/rockchip/rk3588s-indiedroid-nova.dts

If it's an oversight, you may want to add the property in a -u-boot.dtsi and upstream the property to the kernel DTS to avoid carrying it forever. From my side, this patch does what's expected based on the (lack of) presence of the property so this is a green light for me regardless if the above Device Trees are actually wrong.

As far as I could tell, the sysreset driver only implements the poweroff functionality which can be called by either the poweroff CLI command or the efi_reset_system_boottime function (no clue when/where this is called, some EFI thing I guess).

Thanks!
Quentin

Signed-off-by: Svyatoslav Ryhel <[email protected]>
---
  drivers/power/pmic/max77663.c         | 4 +++-
  drivers/power/pmic/max8907.c          | 3 ++-
  drivers/power/pmic/palmas.c           | 4 +++-
  drivers/power/pmic/pmic_tps65910_dm.c | 4 +++-
  drivers/power/pmic/rk8xx.c            | 4 +++-
  drivers/power/pmic/tps80031.c         | 4 +++-
  6 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/power/pmic/max77663.c b/drivers/power/pmic/max77663.c
index c2a7cbf7e40..a06042e2918 100644
--- a/drivers/power/pmic/max77663.c
+++ b/drivers/power/pmic/max77663.c
@@ -46,7 +46,9 @@ static int max77663_bind(struct udevice *dev)
        ofnode regulators_node;
        int children, ret;
- if (IS_ENABLED(CONFIG_SYSRESET_MAX77663)) {
+       if (IS_ENABLED(CONFIG_SYSRESET_MAX77663) &&
+           (dev_read_bool(dev, "maxim,system-power-controller") ||
+            dev_read_bool(dev, "system-power-controller"))) {
                ret = device_bind_driver_to_node(dev, MAX77663_RST_DRIVER,
                                                 "sysreset", dev_ofnode(dev),
                                                 NULL);
diff --git a/drivers/power/pmic/max8907.c b/drivers/power/pmic/max8907.c
index a7ef70177de..34bef0c8cd6 100644
--- a/drivers/power/pmic/max8907.c
+++ b/drivers/power/pmic/max8907.c
@@ -48,7 +48,8 @@ static int max8907_bind(struct udevice *dev)
        int children, ret;
if (IS_ENABLED(CONFIG_SYSRESET_MAX8907) &&
-           dev_read_bool(dev, "maxim,system-power-controller")) {
+           (dev_read_bool(dev, "maxim,system-power-controller") ||
+            dev_read_bool(dev, "system-power-controller"))) {
                ret = device_bind_driver_to_node(dev, MAX8907_RST_DRIVER,
                                                 "sysreset", dev_ofnode(dev),
                                                 NULL);
diff --git a/drivers/power/pmic/palmas.c b/drivers/power/pmic/palmas.c
index 37d4190fabe..e5b497dfc39 100644
--- a/drivers/power/pmic/palmas.c
+++ b/drivers/power/pmic/palmas.c
@@ -48,7 +48,9 @@ static int palmas_bind(struct udevice *dev)
        ofnode subnode, gpio_node;
        int children, ret;
- if (IS_ENABLED(CONFIG_SYSRESET_PALMAS)) {
+       if (IS_ENABLED(CONFIG_SYSRESET_PALMAS) &&
+           (dev_read_bool(dev, "ti,system-power-controller") ||
+            dev_read_bool(dev, "system-power-controller"))) {
                ret = device_bind_driver_to_node(dev, PALMAS_RST_DRIVER,
                                                 "sysreset", dev_ofnode(dev),
                                                 NULL);
diff --git a/drivers/power/pmic/pmic_tps65910_dm.c 
b/drivers/power/pmic/pmic_tps65910_dm.c
index de8d805566a..bce35603275 100644
--- a/drivers/power/pmic/pmic_tps65910_dm.c
+++ b/drivers/power/pmic/pmic_tps65910_dm.c
@@ -61,7 +61,9 @@ static int pmic_tps65910_bind(struct udevice *dev)
        ofnode regulators_node;
        int children, ret;
- if (IS_ENABLED(CONFIG_SYSRESET_TPS65910)) {
+       if (IS_ENABLED(CONFIG_SYSRESET_TPS65910) &&
+           (dev_read_bool(dev, "ti,system-power-controller") ||
+            dev_read_bool(dev, "system-power-controller"))) {
                ret = device_bind_driver(dev, TPS65910_RST_DRIVER,
                                         "sysreset", NULL);
                if (ret) {
diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c
index d11f7a7886e..95b71d2fe49 100644
--- a/drivers/power/pmic/rk8xx.c
+++ b/drivers/power/pmic/rk8xx.c
@@ -220,7 +220,9 @@ static int rk8xx_bind(struct udevice *dev)
debug("%s: '%s' - found regulators subnode\n", __func__, dev->name); - if (CONFIG_IS_ENABLED(SYSRESET)) {
+       if (CONFIG_IS_ENABLED(SYSRESET) &&
+           (dev_read_bool(dev, "rockchip,system-power-controller") ||
+            dev_read_bool(dev, "system-power-controller"))) {
                ret = device_bind_driver_to_node(dev, "rk8xx_sysreset",
                                                 "rk8xx_sysreset",
                                                 dev_ofnode(dev), NULL);
diff --git a/drivers/power/pmic/tps80031.c b/drivers/power/pmic/tps80031.c
index a2f935b0c6d..6004a14cd6c 100644
--- a/drivers/power/pmic/tps80031.c
+++ b/drivers/power/pmic/tps80031.c
@@ -46,7 +46,9 @@ static int tps80031_bind(struct udevice *dev)
        ofnode regulators_node;
        int children, ret;
- if (IS_ENABLED(CONFIG_SYSRESET_TPS80031)) {
+       if (IS_ENABLED(CONFIG_SYSRESET_TPS80031) &&
+           (dev_read_bool(dev, "ti,system-power-controller") ||
+            dev_read_bool(dev, "system-power-controller"))) {
                ret = device_bind_driver(dev, TPS80031_RST_DRIVER,
                                         "sysreset", NULL);
                if (ret) {

Reply via email to