From: Park Bumgyu Date: Tue, 13 Feb 2018 12:05:16 +0000 (+0900) Subject: soc: cpupm: handle cpu hotplug X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c99846c8bce2fcc8d01dd800290583ae213f6545;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git soc: cpupm: handle cpu hotplug Change-Id: I0a2eb08b97bb8d4d07cec790cae13523ed0fadc8 Signed-off-by: Park Bumgyu --- diff --git a/drivers/soc/samsung/exynos-cpupm.c b/drivers/soc/samsung/exynos-cpupm.c index 3ba345acaa5f..821316c6c9a3 100644 --- a/drivers/soc/samsung/exynos-cpupm.c +++ b/drivers/soc/samsung/exynos-cpupm.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -355,6 +356,35 @@ void exynos_cpu_pm_exit(int cpu, int cancel) spin_unlock(&cpupm_lock); } +/****************************************************************************** + * CPU HOTPLUG * + ******************************************************************************/ +static int cpuhp_cpupm_online(unsigned int cpu) +{ + struct cpumask mask; + + cpumask_and(&mask, cpu_coregroup_mask(cpu), cpu_online_mask); + if (cpumask_weight(&mask) == 0) + cluster_enable(cpu); + + cpu_enable(cpu); + + return 0; +} + +static int cpuhp_cpupm_offline(unsigned int cpu) +{ + struct cpumask mask; + + cpu_disable(cpu); + + cpumask_and(&mask, cpu_coregroup_mask(cpu), cpu_online_mask); + if (cpumask_weight(&mask) == 0) + cluster_disable(cpu); + + return 0; +} + /****************************************************************************** * Initialization * ******************************************************************************/ @@ -424,3 +454,16 @@ static int __init exynos_cpupm_init(void) return 0; } arch_initcall(exynos_cpupm_init); + +static int __init exynos_cpupm_early_init(void) +{ + cpuhp_setup_state(CPUHP_AP_EXYNOS_CPU_UP_POWER_CONTROL, + "AP_EXYNOS_CPU_UP_POWER_CONTROL", + cpuhp_cpupm_online, NULL); + cpuhp_setup_state(CPUHP_AP_EXYNOS_CPU_DOWN_POWER_CONTROL, + "AP_EXYNOS_CPU_DOWN_POWER_CONTROL", + NULL, cpuhp_cpupm_offline); + + return 0; +} +early_initcall(exynos_cpupm_early_init);