power: pmic: enable sysreset function with device tree property
cover power: pmic: enable sysreset function with device tree property
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.
Rockchip change can be removed if required since rockchip seems to use PMIC in the SPL stage too and at that time device tree may not be available.
Svyatoslav Ryhel (1):
power: pmic: enable sysreset function with device tree property
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(-)
Signature · 1 line
2.51.0
PATCH 1/1 power: pmic: enable sysreset function with device tree property
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.
--- 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(-)
drivers/power/pmic/max77663.c +3 -1
@@ -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 );
drivers/power/pmic/max8907.c +2 -1
@@ -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 );
drivers/power/pmic/palmas.c +3 -1
@@ -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 );
drivers/power/pmic/pmic_tps65910_dm.c +3 -1
@@ -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) {
drivers/power/pmic/rk8xx.c +3 -1
@@ -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 );
drivers/power/pmic/tps80031.c +3 -1
@@ -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) {
Signature · 1 line
2.51.0
Hi Svyatoslav,
Quoted 4 lines · Svyatoslav Ryhel
Add a condition to enable the PMIC sysreset function via the system-power-controller device tree property in addition to the existing
Kconfigdependency, provided the PMIC supports it.
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
Quoted 99 lines
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(-)drivers/power/pmic/max77663.c +3
-1@@ -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 );drivers/power/pmic/max8907.c +2
-1@@ -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 );drivers/power/pmic/palmas.c +3
-1@@ -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 );drivers/power/pmic/pmic_tps65910_dm.c +3
-1@@ -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) {drivers/power/pmic/rk8xx.c +3
-1@@ -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 );drivers/power/pmic/tps80031.c +3
-1@@ -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) {
пн, 2 бер. 2026 р. о 16:13 Quentin Schulz <[email protected]> пише:
Quoted 34 lines
Hi Svyatoslav,
Quoted 4 lines · Svyatoslav Ryhel
Add a condition to enable the PMIC sysreset function via the system-power-controller device tree property in addition to the existing
Kconfigdependency, provided the PMIC supports it.Reviewed-by Quentin Schulz <[email protected]> # RK8xxI'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.dtsdts/upstream/src/arm64/rockchip/rk3326-anbernic-rg351m.dtsidts/upstream/src/arm64/rockchip/rk3326-odroid-go.dtsidts/upstream/src/arm64/rockchip/rk3399-evb-ind.dtsdts/upstream/src/arm64/rockchip/rk3566-anbernic-rgxx3.dtsidts/upstream/src/arm64/rockchip/rk3566-powkiddy-rk2023.dtsidts/upstream/src/arm64/rockchip/rk3566-powkiddy-x55.dtsdts/upstream/src/arm64/rockchip/rk3588-coolpi-cm5.dtsidts/upstream/src/arm64/rockchip/rk3588s-coolpi-4b.dtsdts/upstream/src/arm64/rockchip/rk3588s-indiedroid-nova.dtsIf it's an oversight, you may want to add the property in a
-u-boot.dtsiand 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.
Quoted 5 lines
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_boottimefunction (no clue when/where this is called, some EFI thing I guess).
I actually expected such an outcome. If you are fine with it, I will drop the Rockchip PMIC change for now. It would be quite unpleasant if a bunch of devices suddenly lose their reset function, especially since updating upstream trees can be a long process. Once the trees are updated, anyone working with Rockchip can submit a similar patch.
Quoted 103 lines
Thanks!
QuentinQuoted 99 lines
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(-)drivers/power/pmic/max77663.c +3
-1@@ -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 );drivers/power/pmic/max8907.c +2
-1@@ -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 );drivers/power/pmic/palmas.c +3
-1@@ -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 );drivers/power/pmic/pmic_tps65910_dm.c +3
-1@@ -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) {drivers/power/pmic/rk8xx.c +3
-1@@ -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 );drivers/power/pmic/tps80031.c +3
-1@@ -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) {
Hi Svyatoslav,
Quoted 41 lines · Svyatoslav Ryhel
пн, 2 бер. 2026 р. о 16:13 Quentin Schulz <[email protected]> пише:
Quoted 34 lines
Hi Svyatoslav,
Quoted 4 lines · Svyatoslav Ryhel
Add a condition to enable the PMIC sysreset function via the system-power-controller device tree property in addition to the existing
Kconfigdependency, provided the PMIC supports it.Reviewed-by Quentin Schulz <[email protected]> # RK8xxI'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.dtsdts/upstream/src/arm64/rockchip/rk3326-anbernic-rg351m.dtsidts/upstream/src/arm64/rockchip/rk3326-odroid-go.dtsidts/upstream/src/arm64/rockchip/rk3399-evb-ind.dtsdts/upstream/src/arm64/rockchip/rk3566-anbernic-rgxx3.dtsidts/upstream/src/arm64/rockchip/rk3566-powkiddy-rk2023.dtsidts/upstream/src/arm64/rockchip/rk3566-powkiddy-x55.dtsdts/upstream/src/arm64/rockchip/rk3588-coolpi-cm5.dtsidts/upstream/src/arm64/rockchip/rk3588s-coolpi-4b.dtsdts/upstream/src/arm64/rockchip/rk3588s-indiedroid-nova.dtsIf it's an oversight, you may want to add the property in a
-u-boot.dtsiand 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.Quoted 5 lines
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_boottimefunction (no clue when/where this is called, some EFI thing I guess).
Quoted 6 lines
I actually expected such an outcome. If you are fine with it, I will drop the Rockchip PMIC change for now. It would be quite unpleasant if a bunch of devices suddenly lose their reset function, especially since updating upstream trees can be a long process. Once the trees are updated, anyone working with Rockchip can submit a similar patch.
Well, how does one know whether the property is not there because it shouldn't be there (the PMIC shouldn't/isn't capable of controlling the system's power state) or because it's missing?
As far as I'm concerned, we can keep the RK8xx part in this patch. We shouldn't need to account for broken Device Trees so we can only assume the aforementioned DTSes are correct. The U-Boot-specific Device Trees all contain the system-power-controller property so those are fine.
As for the DTSes coming from the kernel, they probably would have noticed by now since the kernel also adds a poweroff (sys_off) handler (and for a few PMICs a restart handler too) when this property is present. Thus, this patch syncs behavior between Linux's and U-Boot's implementation.
I'm fine keeping this, I just notified other users in case they didn't know about the property and want to add it to their device. It shouldn't block this patch though in my opinion.
Note I am only speaking about devices with RK8xx PMICs, I haven't checked for the other PMICs touched by this patch.
Cheers,
Quentin
пн, 2 бер. 2026 р. о 16:38 Quentin Schulz <[email protected]> пише:
Quoted 67 lines
Hi Svyatoslav,
Quoted 41 lines · Svyatoslav Ryhel
пн, 2 бер. 2026 р. о 16:13 Quentin Schulz <[email protected]> пише:
Quoted 34 lines
Hi Svyatoslav,
Quoted 4 lines · Svyatoslav Ryhel
Add a condition to enable the PMIC sysreset function via the system-power-controller device tree property in addition to the existing
Kconfigdependency, provided the PMIC supports it.Reviewed-by Quentin Schulz <[email protected]> # RK8xxI'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.dtsdts/upstream/src/arm64/rockchip/rk3326-anbernic-rg351m.dtsidts/upstream/src/arm64/rockchip/rk3326-odroid-go.dtsidts/upstream/src/arm64/rockchip/rk3399-evb-ind.dtsdts/upstream/src/arm64/rockchip/rk3566-anbernic-rgxx3.dtsidts/upstream/src/arm64/rockchip/rk3566-powkiddy-rk2023.dtsidts/upstream/src/arm64/rockchip/rk3566-powkiddy-x55.dtsdts/upstream/src/arm64/rockchip/rk3588-coolpi-cm5.dtsidts/upstream/src/arm64/rockchip/rk3588s-coolpi-4b.dtsdts/upstream/src/arm64/rockchip/rk3588s-indiedroid-nova.dtsIf it's an oversight, you may want to add the property in a
-u-boot.dtsiand 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.Quoted 5 lines
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_boottimefunction (no clue when/where this is called, some EFI thing I guess).Quoted 6 lines
I actually expected such an outcome. If you are fine with it, I will drop the Rockchip PMIC change for now. It would be quite unpleasant if a bunch of devices suddenly lose their reset function, especially since updating upstream trees can be a long process. Once the trees are updated, anyone working with Rockchip can submit a similar patch.
Well, how does one know whether the property is not there because it shouldn't be there (the PMIC shouldn't/isn't capable of controlling the system's power state) or because it's missing?
As far as I'm concerned, we can keep the RK8xx part in this patch. We shouldn't need to account for broken Device Trees so we can only assume the aforementioned DTSes are correct. The U-Boot-specific Device Trees all contain the system-power-controller property so those are fine.
As for the DTSes coming from the kernel, they probably would have noticed by now since the kernel also adds a poweroff (
sys_off) handler (and for a few PMICs a restart handler too) when this property is present. Thus, this patch syncs behavior between Linux's and U-Boot's implementation.
Quoted 7 lines
I'm fine keeping this, I just notified other users in case they didn't know about the property and want to add it to their device. It shouldn't block this patch though in my opinion.
Note I am only speaking about devices with RK8xx PMICs, I haven't checked for the other PMICs touched by this patch.
Ok, then I will keep the RK8xx part. Regarding the other PMICs, those were added by me, and the devices that use them are also managed by me. Additionally, adding system-power-controller complies with the DT schema for the affected PMICs.
Quoted 2 lines
Cheers,
Quentin