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

56 lines
1.4 KiB
Diff
Raw Normal View History

From 98373326e4476191ac2911178829248691253fba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sat, 2 Nov 2019 15:21:04 +0100
Subject: [PATCH 031/464] 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 <megi@xff.cz>
---
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 <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>
@@ -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