cpufreq: add different freqs variable for big&little core [1/1]
authorHong Guo <hong.guo@amlogic.com>
Tue, 15 Oct 2019 09:02:02 +0000 (17:02 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Wed, 16 Oct 2019 11:11:36 +0000 (04:11 -0700)
PD#SWPL-15315

Problem:
add different freqs variable for big&little core

Solution:
add different freqs variable for big&little core

Verify:
test pass on g12b_w400

Change-Id: I2a5e00b5bbd4a1d084b925733a051497c6e92b0b
Signed-off-by: Hong Guo <hong.guo@amlogic.com>
drivers/amlogic/cpufreq/meson-cpufreq.c
drivers/amlogic/cpufreq/meson-cpufreq.h

index 039272e..166fdf8 100644 (file)
@@ -208,6 +208,7 @@ static int meson_cpufreq_set_target(struct cpufreq_policy *policy,
        struct meson_cpufreq_driver_data *cpufreq_data;
        struct device *cpu_dev;
        struct regulator *cpu_reg;
+       struct cpufreq_freqs freqs[MAX_CLUSTERS];
        int ret = 0;
 
        if (!policy) {
@@ -260,9 +261,9 @@ static int meson_cpufreq_set_target(struct cpufreq_policy *policy,
                }
        }
 
-       freqs.old = freq_old / 1000;
-       freqs.new = freq_new / 1000;
-       cpufreq_freq_transition_begin(policy, &freqs);
+       freqs[cur_cluster].old = freq_old / 1000;
+       freqs[cur_cluster].new = freq_new / 1000;
+       cpufreq_freq_transition_begin(policy, &freqs[cur_cluster]);
        /*scale clock frequency*/
        ret = meson_cpufreq_set_rate(policy, cur_cluster,
                                        freq_new / 1000);
@@ -277,7 +278,7 @@ static int meson_cpufreq_set_target(struct cpufreq_policy *policy,
                return ret;
        }
 
-       cpufreq_freq_transition_end(policy, &freqs, ret);
+       cpufreq_freq_transition_end(policy, &freqs[cur_cluster], ret);
        /*cpufreq down,change voltage after frequency*/
        if (freq_new < freq_old) {
                ret = meson_regulator_set_volate(cpu_reg, volt_old,
@@ -285,14 +286,15 @@ static int meson_cpufreq_set_target(struct cpufreq_policy *policy,
                if (ret) {
                        pr_err("failed to scale volt %u %u down: %d\n",
                                volt_new, volt_tol, ret);
-                       freqs.old = freq_new / 1000;
-                       freqs.new = freq_old / 1000;
-                       cpufreq_freq_transition_begin(policy, &freqs);
+                       freqs[cur_cluster].old = freq_new / 1000;
+                       freqs[cur_cluster].new = freq_old / 1000;
+                       cpufreq_freq_transition_begin(policy,
+                                                     &freqs[cur_cluster]);
 
                        ret = meson_cpufreq_set_rate(policy, cur_cluster,
                                freq_old / 1000);
                        cpufreq_freq_transition_end(policy,
-                                       &freqs, ret);
+                                                   &freqs[cur_cluster], ret);
                }
        }
 
index d7b16a0..836074e 100644 (file)
@@ -42,7 +42,6 @@ static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS];
 /*mid rate for set parent,Khz*/
 static unsigned int mid_rate = (1000 * 1000);
 static unsigned int gap_rate = (10 * 1000 * 1000);
-static struct cpufreq_freqs freqs;
 
 /*
  * DSU_LOW_RATE:cpu clk less than DSU_LOW_RATE(1.2G)