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 <jo...@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

Reply via email to