diff mbox series

[v2,3/4] power: axp: Avoid do_poweroff conflict with sysreset

Message ID 20211025020011.22052-4-samuel@sholland.org
State Accepted
Commit 830e161eb4e9dbd3e9eb20ad6a3255eb8b4ed3c4
Delegated to: Andre Przywara
Headers show
Series power: axp: Move poweroff to DM_PMIC/SYSRESET driver | expand

Commit Message

Samuel Holland Oct. 25, 2021, 2 a.m. UTC
The sysreset uclass has an option to provide the do_poweroff() function.
When that option is enabled, the AXP power drivers should not provide
their own definition.

For the AXP305, which is paired with 64-bit systems where TF-A provides
PSCI, there is another possible conflict with the PSCI firmware driver.
This driver can be enabled even if CONFIG_PSCI_RESET is disabled, so
make sure to use the right symbol in the condition.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
---

(no changes since v1)

 drivers/power/axp152.c | 2 ++
 drivers/power/axp209.c | 2 ++
 drivers/power/axp221.c | 2 ++
 drivers/power/axp305.c | 2 +-
 drivers/power/axp809.c | 2 ++
 drivers/power/axp818.c | 2 ++
 6 files changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/power/axp152.c b/drivers/power/axp152.c
index d6e36125c1..a93987c153 100644
--- a/drivers/power/axp152.c
+++ b/drivers/power/axp152.c
@@ -79,6 +79,7 @@  int axp_init(void)
 	return 0;
 }
 
+#if !IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF)
 int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	pmic_bus_write(AXP152_SHUTDOWN, AXP152_POWEROFF);
@@ -89,3 +90,4 @@  int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	/* not reached */
 	return 0;
 }
+#endif
diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c
index ade531940b..3447b9f011 100644
--- a/drivers/power/axp209.c
+++ b/drivers/power/axp209.c
@@ -230,6 +230,7 @@  int axp_init(void)
 	return 0;
 }
 
+#if !IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF)
 int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	pmic_bus_write(AXP209_SHUTDOWN, AXP209_POWEROFF);
@@ -240,3 +241,4 @@  int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	/* not reached */
 	return 0;
 }
+#endif
diff --git a/drivers/power/axp221.c b/drivers/power/axp221.c
index 3446fe7365..d251c314b9 100644
--- a/drivers/power/axp221.c
+++ b/drivers/power/axp221.c
@@ -264,6 +264,7 @@  int axp_get_sid(unsigned int *sid)
 	return 0;
 }
 
+#if !IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF)
 int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	pmic_bus_write(AXP221_SHUTDOWN, AXP221_SHUTDOWN_POWEROFF);
@@ -274,3 +275,4 @@  int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	/* not reached */
 	return 0;
 }
+#endif
diff --git a/drivers/power/axp305.c b/drivers/power/axp305.c
index 0191e4d427..049ef07f74 100644
--- a/drivers/power/axp305.c
+++ b/drivers/power/axp305.c
@@ -69,7 +69,7 @@  int axp_init(void)
 	return ret;
 }
 
-#ifndef CONFIG_PSCI_RESET
+#if !CONFIG_IS_ENABLED(ARM_PSCI_FW) && !IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF)
 int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	pmic_bus_write(AXP305_SHUTDOWN, AXP305_POWEROFF);
diff --git a/drivers/power/axp809.c b/drivers/power/axp809.c
index 0396502cdb..d327a584de 100644
--- a/drivers/power/axp809.c
+++ b/drivers/power/axp809.c
@@ -219,6 +219,7 @@  int axp_init(void)
 	return pmic_bus_init();
 }
 
+#if !IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF)
 int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	pmic_bus_write(AXP809_SHUTDOWN, AXP809_SHUTDOWN_POWEROFF);
@@ -229,3 +230,4 @@  int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	/* not reached */
 	return 0;
 }
+#endif
diff --git a/drivers/power/axp818.c b/drivers/power/axp818.c
index 2dc736467b..08286ea3b5 100644
--- a/drivers/power/axp818.c
+++ b/drivers/power/axp818.c
@@ -255,6 +255,7 @@  int axp_init(void)
 	return 0;
 }
 
+#if !IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF)
 int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	pmic_bus_write(AXP818_SHUTDOWN, AXP818_SHUTDOWN_POWEROFF);
@@ -265,3 +266,4 @@  int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	/* not reached */
 	return 0;
 }
+#endif