cpufreq: rockchip_big_little: update current policy cpu before cpufreq_cpu_get
authorXiao Feng <xf@rock-chips.com>
Thu, 30 Apr 2015 03:39:52 +0000 (11:39 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 30 Apr 2015 06:30:42 +0000 (14:30 +0800)
Signed-off-by: Xiao Feng <xf@rock-chips.com>
drivers/cpufreq/rockchip_big_little.c

index b333837664f9ca2e32a0ec96c8ee191ec8b34dad..ba202028d2c43400d6a10e184e86511616834eb2 100644 (file)
@@ -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;