From ea6be56779460d66555b17c13a1621b9e668f85e Mon Sep 17 00:00:00 2001 From: Xiao Feng Date: Thu, 30 Apr 2015 11:39:52 +0800 Subject: [PATCH] cpufreq: rockchip_big_little: update current policy cpu before cpufreq_cpu_get Signed-off-by: Xiao Feng --- drivers/cpufreq/rockchip_big_little.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/cpufreq/rockchip_big_little.c b/drivers/cpufreq/rockchip_big_little.c index b333837664f9..ba202028d2c4 100644 --- a/drivers/cpufreq/rockchip_big_little.c +++ b/drivers/cpufreq/rockchip_big_little.c @@ -89,8 +89,8 @@ static DEFINE_MUTEX(cpufreq_mutex); static struct dvfs_node *clk_cpu_dvfs_node[RK_MAX_CLUSTERS]; static struct dvfs_node *clk_gpu_dvfs_node; static struct dvfs_node *clk_ddr_dvfs_node; -static u32 cluster_policy_cpu[RK_MAX_CLUSTERS]; static unsigned int big_little = 1; +static struct cpumask *cluster_policy_mask[RK_MAX_CLUSTERS]; /*******************************************************/ static inline int cpu_to_cluster(int cpu) @@ -192,10 +192,12 @@ static int rockchip_bl_cpufreq_scale_rate_for_dvfs(struct clk *clk, int ret; struct cpufreq_freqs freqs; struct cpufreq_policy *policy; - u32 cur_cluster; + u32 cur_cluster, cpu; cur_cluster = clk_node_get_cluster_id(clk); - policy = cpufreq_cpu_get(cluster_policy_cpu[cur_cluster]); + cpu = cpumask_first_and(cluster_policy_mask[cur_cluster], + cpu_online_mask); + policy = cpufreq_cpu_get(cpu); if (!policy) return 0; @@ -283,7 +285,7 @@ static int rockchip_bl_cpufreq_init(struct cpufreq_policy *policy) if (cpu0_err) return cpu0_err; - cluster_policy_cpu[cur_cluster] = policy->cpu; + cluster_policy_mask[cur_cluster] = policy->cpus; /* set freq min max */ cpufreq_frequency_table_cpuinfo(policy, freq_table[cur_cluster]); @@ -417,11 +419,13 @@ static int rockchip_bl_cpufreq_pm_notifier_event(struct notifier_block *this, { int ret = NOTIFY_DONE; int i; + struct cpufreq_policy *policy; + u32 cpu; for (i = 0; i < RK_MAX_CLUSTERS; i++) { - struct cpufreq_policy *policy = - cpufreq_cpu_get(cluster_policy_cpu[i]); - + cpu = cpumask_first_and(cluster_policy_mask[i], + cpu_online_mask); + policy = cpufreq_cpu_get(cpu); if (!policy) return ret; -- 2.34.1