build/patch/kernel/archive/sunxi-5.10/megous/ARM-sunxi-Use-SCPI-to-send-suspend-message-to-SCP-on.patch

56 lines
1.4 KiB
Diff
Raw Normal View History

From ab83ef10f0b3f4878e9655b166f778487bb6c795 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
Date: Sat, 2 Nov 2019 15:21:04 +0100
Subject: [PATCH 040/351] 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 <megous@megous.com>
---
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 fd6432faa103..244341ffe8f3 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -16,6 +16,7 @@
#include <linux/platform_device.h>
#include <linux/of_platform.h>
#include <linux/reset/sunxi.h>
+#include <linux/scpi_protocol.h>
#include <linux/suspend.h>
#include <asm/mach/arch.h>
@@ -99,8 +100,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.0