Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd2e0c73 authored by Mahesh Sivasubramanian's avatar Mahesh Sivasubramanian Committed by Saravana Kannan
Browse files

ANDROID: GKI: arm64: psci: Support for OS initiated scheme



Existing PSCI implementation supports platform coordinated means of low
power modes where cluster low power modes are aggregated at the platform
level.  Adding support for OS initiated scheme, where the OS is
responsible for selecting cluster low power modes based on last man
determination. With OS initiated scheme, the OS can make better cluster
decisions based on wakeup times of CPUs within a cluster.

To this effect, in OS initiated schemes, the composite state ID is computed
by the idle driver before calling into the cpu_suspend API. The PSCI driver
is modified to use the composite ID to distinguish between retention and
non-retention states.

Change-Id: Iee5533676a28a8f6beb7942dcb908f2fa3518d78
Signed-off-by: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: default avatarMurali Nalajala <mnalajal@codeaurora.org>
(cherry picked from commit ea2c39ae)
Signed-off-by: default avatarMark Salyzyn <salyzyn@google.com>
Bug: 154642337
parent 2e44b39d
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -397,29 +397,26 @@ int psci_cpu_init_idle(unsigned int cpu)
	return ret;
}

static int psci_suspend_finisher(unsigned long index)
static int psci_suspend_finisher(unsigned long state_id)
{
	u32 *state = __this_cpu_read(psci_power_state);

	return psci_ops.cpu_suspend(state[index - 1],
	return psci_ops.cpu_suspend(state_id,
				    __pa_symbol(cpu_resume));
}

int psci_cpu_suspend_enter(unsigned long index)
int psci_cpu_suspend_enter(unsigned long state_id)
{
	int ret;
	u32 *state = __this_cpu_read(psci_power_state);

	/*
	 * idle state index 0 corresponds to wfi, should never be called
	 * from the cpu_suspend operations
	 */
	if (WARN_ON_ONCE(!index))
	if (WARN_ON_ONCE(!state_id))
		return -EINVAL;

	if (!psci_power_state_loses_context(state[index - 1]))
		ret = psci_ops.cpu_suspend(state[index - 1], 0);
	if (!psci_power_state_loses_context(state_id))
		ret = psci_ops.cpu_suspend(state_id, 0);
	else
		ret = cpu_suspend(index, psci_suspend_finisher);
		ret = cpu_suspend(state_id, psci_suspend_finisher);

	return ret;
}