Merge "drivers: firmware: psci: Set ARM32 cpuidle ops"

This commit is contained in:
Linux Build Service Account 2017-06-01 01:53:08 -07:00 committed by Gerrit - the friendly Code Review server
commit e5e25bbebf
3 changed files with 39 additions and 1 deletions

View file

@ -190,6 +190,7 @@ nodes to be present and contain the properties described below.
"allwinner,sun6i-a31" "allwinner,sun6i-a31"
"allwinner,sun8i-a23" "allwinner,sun8i-a23"
"arm,psci" "arm,psci"
"psci"
"brcm,brahma-b15" "brcm,brahma-b15"
"marvell,armada-375-smp" "marvell,armada-375-smp"
"marvell,armada-380-smp" "marvell,armada-380-smp"

View file

@ -363,6 +363,24 @@ static int lpm_cpu_callback(struct notifier_block *cpu_nb,
return NOTIFY_OK; return NOTIFY_OK;
} }
#ifdef CONFIG_ARM_PSCI
static int __init set_cpuidle_ops(void)
{
int ret = 0, cpu;
for_each_possible_cpu(cpu) {
ret = arm_cpuidle_init(cpu);
if (ret)
goto exit;
}
exit:
return ret;
}
#endif
static enum hrtimer_restart lpm_hrtimer_cb(struct hrtimer *h) static enum hrtimer_restart lpm_hrtimer_cb(struct hrtimer *h)
{ {
return HRTIMER_NORESTART; return HRTIMER_NORESTART;
@ -1954,6 +1972,14 @@ static int __init lpm_levels_module_init(void)
goto fail; goto fail;
} }
#ifdef CONFIG_ARM_PSCI
rc = set_cpuidle_ops();
if (rc) {
pr_err("%s(): Failed to set cpuidle ops\n", __func__);
goto fail;
}
#endif
fail: fail:
return rc; return rc;
} }

View file

@ -230,6 +230,13 @@ static int __init psci_features(u32 psci_func_id)
#ifdef CONFIG_CPU_IDLE #ifdef CONFIG_CPU_IDLE
static DEFINE_PER_CPU_READ_MOSTLY(u32 *, psci_power_state); static DEFINE_PER_CPU_READ_MOSTLY(u32 *, psci_power_state);
#ifdef CONFIG_ARM_PSCI
static int psci_cpu_init(struct device_node *cpu_node, int cpu)
{
return 0;
}
#endif
static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu)
{ {
int i, ret, count = 0; int i, ret, count = 0;
@ -333,10 +340,14 @@ int psci_cpu_suspend_enter(unsigned long state_id)
#ifdef CONFIG_ARM #ifdef CONFIG_ARM
static struct cpuidle_ops psci_cpuidle_ops __initdata = { static struct cpuidle_ops psci_cpuidle_ops __initdata = {
.suspend = psci_cpu_suspend_enter, .suspend = psci_cpu_suspend_enter,
#ifdef CONFIG_ARM_PSCI
.init = psci_cpu_init,
#else
.init = psci_dt_cpu_init_idle, .init = psci_dt_cpu_init_idle,
#endif
}; };
CPUIDLE_METHOD_OF_DECLARE(psci, "arm,psci", &psci_cpuidle_ops); CPUIDLE_METHOD_OF_DECLARE(psci, "psci", &psci_cpuidle_ops);
#endif #endif
#endif #endif