[COMMON] arm64: psci: Reappear psci_power_state_pack
authorPark Bumgyu <bumgyu.park@samsung.com>
Tue, 3 May 2016 10:01:36 +0000 (19:01 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:26:27 +0000 (17:26 +0900)
psci_power_state_pack which combines PSCI power state information
to integer is removed by commit c8cc427("arm64: psci: kill
psci_power_state").

In case of exynos, it needs to reconstitute PSCI power state to
support extra power mode which cpuidle does not support. To
resonstitute PSCI power state, psci_power_state_pack is added.
It will be used in psci_suspend_customized_finisher.

Change-Id: I506e690965e73cdd1d6acee7664b5cf4cfc049a0
Signed-off-by: Park Bumgyu <bumgyu.park@samsung.com>
drivers/firmware/psci.c

index c80ec1d03274413863fb8e3f917f26daa8f868c2..b7244b7b450775046e25c225d5e8a48c59f7fce9 100644 (file)
@@ -405,6 +405,23 @@ static int psci_suspend_finisher(unsigned long index)
                                    __pa_symbol(cpu_resume));
 }
 
+/**
+ * Pack PSCI power state to integer
+ *
+ * @id : indicates system power mode. 0 means non system power mode.
+ * @type : not used.
+ * @affinity_level : indicates power down scope.
+ */
+static u32 psci_power_state_pack(u32 id, u32 type, u32 affinity_level)
+{
+       return ((id << PSCI_0_2_POWER_STATE_ID_SHIFT)
+                       & PSCI_0_2_POWER_STATE_ID_MASK) |
+               ((type << PSCI_0_2_POWER_STATE_TYPE_SHIFT)
+                & PSCI_0_2_POWER_STATE_TYPE_MASK) |
+               ((affinity_level << PSCI_0_2_POWER_STATE_AFFL_SHIFT)
+                & PSCI_0_2_POWER_STATE_AFFL_MASK);
+}
+
 int psci_cpu_suspend_enter(unsigned long index)
 {
        int ret;