[PATCH] rockchip: rk356x: Enable poweroff command

With PMIC_RK8XX, SYSRESET and CMD_POWEROFF options enabled it is possible to power down a board using the poweroff command and turn the board back on using a power button.
Enable the poweroff command on RK356x boards that have a button wired to PMIC pwron. Also update to use PMIC poweroff when PMIC_RK8XX is enabled to avoid also having to enable the SYSRESET_CMD_POWEROFF option.
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- configs/quartz64-a-rk3566_defconfig | 1 + configs/quartz64-b-rk3566_defconfig | 1 + configs/rock-3a-rk3568_defconfig | 1 + configs/soquartz-model-a-rk3566_defconfig | 1 + drivers/power/pmic/Kconfig | 1 + 5 files changed, 5 insertions(+)
diff --git a/configs/quartz64-a-rk3566_defconfig b/configs/quartz64-a-rk3566_defconfig index d55b224feacd..6853cd6c44b4 100644 --- a/configs/quartz64-a-rk3566_defconfig +++ b/configs/quartz64-a-rk3566_defconfig @@ -52,6 +52,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_PMIC=y diff --git a/configs/quartz64-b-rk3566_defconfig b/configs/quartz64-b-rk3566_defconfig index b98c81f9dcef..aa29fff14643 100644 --- a/configs/quartz64-b-rk3566_defconfig +++ b/configs/quartz64-b-rk3566_defconfig @@ -50,6 +50,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_PMIC=y diff --git a/configs/rock-3a-rk3568_defconfig b/configs/rock-3a-rk3568_defconfig index 44ff054df665..409aa95acf06 100644 --- a/configs/rock-3a-rk3568_defconfig +++ b/configs/rock-3a-rk3568_defconfig @@ -49,6 +49,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_PMIC=y diff --git a/configs/soquartz-model-a-rk3566_defconfig b/configs/soquartz-model-a-rk3566_defconfig index c3958579db73..a0884a797d58 100644 --- a/configs/soquartz-model-a-rk3566_defconfig +++ b/configs/soquartz-model-a-rk3566_defconfig @@ -43,6 +43,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_PMIC=y diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig index 176fb07c651a..4a6f0ce093ad 100644 --- a/drivers/power/pmic/Kconfig +++ b/drivers/power/pmic/Kconfig @@ -233,6 +233,7 @@ config PMIC_QCOM
config PMIC_RK8XX bool "Enable support for Rockchip PMIC RK8XX" + select SYSRESET_CMD_POWEROFF if SYSRESET && CMD_POWEROFF ---help--- The Rockchip RK808 PMIC provides four buck DC-DC convertors, 8 LDOs, an RTC and two low Rds (resistance (drain to source)) switches. It is

On Thu, 3 Aug 2023 at 13:54, Jonas Karlman jonas@kwiboo.se wrote:
With PMIC_RK8XX, SYSRESET and CMD_POWEROFF options enabled it is possible to power down a board using the poweroff command and turn the board back on using a power button.
Enable the poweroff command on RK356x boards that have a button wired to PMIC pwron. Also update to use PMIC poweroff when PMIC_RK8XX is enabled to avoid also having to enable the SYSRESET_CMD_POWEROFF option.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
configs/quartz64-a-rk3566_defconfig | 1 + configs/quartz64-b-rk3566_defconfig | 1 + configs/rock-3a-rk3568_defconfig | 1 + configs/soquartz-model-a-rk3566_defconfig | 1 + drivers/power/pmic/Kconfig | 1 + 5 files changed, 5 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

Hi Jonas,
On 2023/8/4 03:54, Jonas Karlman wrote:
With PMIC_RK8XX, SYSRESET and CMD_POWEROFF options enabled it is possible to power down a board using the poweroff command and turn the board back on using a power button.
I'm confuse about the use case, when will people need to do this(other than just test)?
Usually people do the power on/off or reboot/reset both by software only or by hardware only,
but very little chance need to do these ops by both software and hardware.
What's more, we usually enable the power off cmd in kernel, not in bootloader.
Thanks, - Kever
Enable the poweroff command on RK356x boards that have a button wired to PMIC pwron. Also update to use PMIC poweroff when PMIC_RK8XX is enabled to avoid also having to enable the SYSRESET_CMD_POWEROFF option.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
configs/quartz64-a-rk3566_defconfig | 1 + configs/quartz64-b-rk3566_defconfig | 1 + configs/rock-3a-rk3568_defconfig | 1 + configs/soquartz-model-a-rk3566_defconfig | 1 + drivers/power/pmic/Kconfig | 1 + 5 files changed, 5 insertions(+)
diff --git a/configs/quartz64-a-rk3566_defconfig b/configs/quartz64-a-rk3566_defconfig index d55b224feacd..6853cd6c44b4 100644 --- a/configs/quartz64-a-rk3566_defconfig +++ b/configs/quartz64-a-rk3566_defconfig @@ -52,6 +52,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_PMIC=y diff --git a/configs/quartz64-b-rk3566_defconfig b/configs/quartz64-b-rk3566_defconfig index b98c81f9dcef..aa29fff14643 100644 --- a/configs/quartz64-b-rk3566_defconfig +++ b/configs/quartz64-b-rk3566_defconfig @@ -50,6 +50,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_PMIC=y diff --git a/configs/rock-3a-rk3568_defconfig b/configs/rock-3a-rk3568_defconfig index 44ff054df665..409aa95acf06 100644 --- a/configs/rock-3a-rk3568_defconfig +++ b/configs/rock-3a-rk3568_defconfig @@ -49,6 +49,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_PMIC=y diff --git a/configs/soquartz-model-a-rk3566_defconfig b/configs/soquartz-model-a-rk3566_defconfig index c3958579db73..a0884a797d58 100644 --- a/configs/soquartz-model-a-rk3566_defconfig +++ b/configs/soquartz-model-a-rk3566_defconfig @@ -43,6 +43,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_PMIC=y diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig index 176fb07c651a..4a6f0ce093ad 100644 --- a/drivers/power/pmic/Kconfig +++ b/drivers/power/pmic/Kconfig @@ -233,6 +233,7 @@ config PMIC_QCOM
config PMIC_RK8XX bool "Enable support for Rockchip PMIC RK8XX"
- select SYSRESET_CMD_POWEROFF if SYSRESET && CMD_POWEROFF ---help--- The Rockchip RK808 PMIC provides four buck DC-DC convertors, 8 LDOs, an RTC and two low Rds (resistance (drain to source)) switches. It is

Hi Kever,
On 2023-08-04 03:37, Kever Yang wrote:
Hi Jonas,
On 2023/8/4 03:54, Jonas Karlman wrote:
With PMIC_RK8XX, SYSRESET and CMD_POWEROFF options enabled it is possible to power down a board using the poweroff command and turn the board back on using a power button.
I'm confuse about the use case, when will people need to do this(other than just test)?
Yes this is mostly for testing and possible automation/CI purposes. Similar to why we include other commands such as gpio, regulator etc.
Main reason is that I use ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON on my Pine64 PineTab2 RK3566 tablet, and it simplified testing of the "power: pmic: rk8xx: Fix power-on source check in SPL" series.
I could just poweroff from u-boot cmdline instead of pushing power button for 5-10 seconds or boot into linux to issue a power off command to validate the functionality.
Until PineTab2 has a mainline linux device tree that can be imported to U-Boot, I settled for enabling poweroff command on my other RK356x devices that has a power button wired to PMIC pwron.
Regards, Jonas
Usually people do the power on/off or reboot/reset both by software only or by hardware only,
but very little chance need to do these ops by both software and hardware.
What's more, we usually enable the power off cmd in kernel, not in bootloader.
Thanks,
- Kever
Enable the poweroff command on RK356x boards that have a button wired to PMIC pwron. Also update to use PMIC poweroff when PMIC_RK8XX is enabled to avoid also having to enable the SYSRESET_CMD_POWEROFF option.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
[...]

Hi Jonas,
Please split this patch into two patch, one for update defconfig and one for update pmic Kconfig.
Thanks,
- Kever
On 2023/8/4 03:54, Jonas Karlman wrote:
With PMIC_RK8XX, SYSRESET and CMD_POWEROFF options enabled it is possible to power down a board using the poweroff command and turn the board back on using a power button.
Enable the poweroff command on RK356x boards that have a button wired to PMIC pwron. Also update to use PMIC poweroff when PMIC_RK8XX is enabled to avoid also having to enable the SYSRESET_CMD_POWEROFF option.
Signed-off-by: Jonas Karlman jonas@kwiboo.se
configs/quartz64-a-rk3566_defconfig | 1 + configs/quartz64-b-rk3566_defconfig | 1 + configs/rock-3a-rk3568_defconfig | 1 + configs/soquartz-model-a-rk3566_defconfig | 1 + drivers/power/pmic/Kconfig | 1 + 5 files changed, 5 insertions(+)
diff --git a/configs/quartz64-a-rk3566_defconfig b/configs/quartz64-a-rk3566_defconfig index d55b224feacd..6853cd6c44b4 100644 --- a/configs/quartz64-a-rk3566_defconfig +++ b/configs/quartz64-a-rk3566_defconfig @@ -52,6 +52,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_PMIC=y diff --git a/configs/quartz64-b-rk3566_defconfig b/configs/quartz64-b-rk3566_defconfig index b98c81f9dcef..aa29fff14643 100644 --- a/configs/quartz64-b-rk3566_defconfig +++ b/configs/quartz64-b-rk3566_defconfig @@ -50,6 +50,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_PMIC=y diff --git a/configs/rock-3a-rk3568_defconfig b/configs/rock-3a-rk3568_defconfig index 44ff054df665..409aa95acf06 100644 --- a/configs/rock-3a-rk3568_defconfig +++ b/configs/rock-3a-rk3568_defconfig @@ -49,6 +49,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_PMIC=y diff --git a/configs/soquartz-model-a-rk3566_defconfig b/configs/soquartz-model-a-rk3566_defconfig index c3958579db73..a0884a797d58 100644 --- a/configs/soquartz-model-a-rk3566_defconfig +++ b/configs/soquartz-model-a-rk3566_defconfig @@ -43,6 +43,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_PMIC=y diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig index 176fb07c651a..4a6f0ce093ad 100644 --- a/drivers/power/pmic/Kconfig +++ b/drivers/power/pmic/Kconfig @@ -233,6 +233,7 @@ config PMIC_QCOM
config PMIC_RK8XX bool "Enable support for Rockchip PMIC RK8XX"
- select SYSRESET_CMD_POWEROFF if SYSRESET && CMD_POWEROFF ---help--- The Rockchip RK808 PMIC provides four buck DC-DC convertors, 8 LDOs, an RTC and two low Rds (resistance (drain to source)) switches. It is
participants (3)
-
Jonas Karlman
-
Kever Yang
-
Simon Glass