From: Youngtae Lee Date: Fri, 4 May 2018 06:26:16 +0000 (+0900) Subject: samsung: cpupm: Add cpuhp_last_cpu mask to indecating last_cpu X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=93775b64efadae9b491b43c93ab0cd6b193c5c81;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git samsung: cpupm: Add cpuhp_last_cpu mask to indecating last_cpu this mask shows cpus that should perform the cluster power down sequence. Change-Id: If41ecb630191674dc47995808c383688aa0d8d55 Signed-off-by: Youngtae Lee --- diff --git a/drivers/soc/samsung/exynos-cpupm.c b/drivers/soc/samsung/exynos-cpupm.c index 9588f912058a..c76c27d2f12a 100644 --- a/drivers/soc/samsung/exynos-cpupm.c +++ b/drivers/soc/samsung/exynos-cpupm.c @@ -298,13 +298,25 @@ static void cluster_disable(unsigned int cpu_id) /****************************************************************************** * CPU HOTPLUG * ******************************************************************************/ +/* cpumask for indecating last cpu of a cluster */ +struct cpumask cpuhp_last_cpu; + +bool exynos_cpuhp_last_cpu(unsigned int cpu) +{ + return cpumask_test_cpu(cpu, &cpuhp_last_cpu); +} + 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) + if (cpumask_weight(&mask) == 0) { cluster_enable(cpu); + /* clear cpus of this cluster from cpuhp_last_cpu */ + cpumask_andnot(&cpuhp_last_cpu, + &cpuhp_last_cpu, cpu_coregroup_mask(cpu)); + } cpu_enable(cpu); @@ -318,8 +330,11 @@ static int cpuhp_cpupm_offline(unsigned int cpu) cpu_disable(cpu); cpumask_and(&mask, cpu_coregroup_mask(cpu), cpu_online_mask); - if (cpumask_weight(&mask) == 0) + if (cpumask_weight(&mask) == 0) { + /* set cpu cpuhp_last_cpu */ + cpumask_set_cpu(cpu, &cpuhp_last_cpu); cluster_disable(cpu); + } return 0; } diff --git a/include/soc/samsung/exynos-cpupm.h b/include/soc/samsung/exynos-cpupm.h index eb132497d34a..06292fc19ee1 100644 --- a/include/soc/samsung/exynos-cpupm.h +++ b/include/soc/samsung/exynos-cpupm.h @@ -17,6 +17,10 @@ enum { POWERMODE_TYPE_SYSTEM, }; +extern void disable_power_mode(int cpu, int type); +extern void enable_power_mode(int cpu, int type); +extern bool exynos_cpuhp_last_cpu(unsigned int cpu); + #ifdef CONFIG_CPU_IDLE void exynos_update_ip_idle_status(int index, int idle); int exynos_get_idle_ip_index(const char *name);