From 325baf4ee6275f9bda74fb27956ba3650f62eaf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= Date: Sat, 2 Nov 2019 15:21:04 +0100 Subject: [PATCH 030/469] ARM: sunxi: Use SCPI to send suspend message to SCP on A83T We use undefined value of 3, to mean SUSPEND_SYSTEM. SCP should: - kill CPU0 - kill cluster 0 - shutdown power to both clusters (Linux MCPM doesn't do that) ... - reverse all of the above on interrupt Signed-off-by: Ondrej Jirman --- arch/arm/mach-sunxi/sunxi.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c index 2d6b7b4528e9..d4c25c33455d 100644 --- a/arch/arm/mach-sunxi/sunxi.c +++ b/arch/arm/mach-sunxi/sunxi.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -97,8 +98,18 @@ static int sun8i_a83t_pm_valid(suspend_state_t state) static int sun8i_a83t_suspend_finish(unsigned long val) { - // don't do much - cpu_do_idle(); + struct scpi_ops *scpi; + + scpi = get_scpi_ops(); + if (scpi && scpi->sys_set_power_state) { + //HACK: use invalid state to mean: suspend last CPU and the system + scpi->sys_set_power_state(3); + cpu_do_idle(); + } else { + // don't do much if scpi is not available + cpu_do_idle(); + } + return 0; } -- 2.34.1