author | Jian Hu <jian.hu@amlogic.com> | 2020-03-27 04:47:00 (GMT) |
---|---|---|
committer | Shen Liu <shen.liu@amlogic.com> | 2020-05-21 09:03:43 (GMT) |
commit | 4c73e820b19e3d588e78f011e3b825488585209e (patch) | |
tree | 9a6ca57dc6edb2797441a406b0ad2c2a2c52f91d | |
parent | 393108d0be0a6787c521e284ab74925f54d77249 (diff) | |
download | common-4c73e820b19e3d588e78f011e3b825488585209e.zip common-4c73e820b19e3d588e78f011e3b825488585209e.tar.gz common-4c73e820b19e3d588e78f011e3b825488585209e.tar.bz2 |
dvfs: sm1: critical region of cpu and dsu clock settings [1/1]
PD#SWPL-22008
Problem:
it will hang up sometimes when playing 8k video.
Solution:
critical region of cpu and dsu clock settings
Verify:
ac214
Change-Id: Icbdf3c26b129d4901e42c2e6c58700bd684c871c
Signed-off-by: Jian Hu <jian.hu@amlogic.com>
Signed-off-by: Hong Guo <hong.guo@amlogic.com>
-rw-r--r-- | drivers/amlogic/cpufreq/meson-cpufreq.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/amlogic/cpufreq/meson-cpufreq.c b/drivers/amlogic/cpufreq/meson-cpufreq.c index a7bbd3e..97412bb 100644 --- a/drivers/amlogic/cpufreq/meson-cpufreq.c +++ b/drivers/amlogic/cpufreq/meson-cpufreq.c @@ -72,10 +72,8 @@ struct meson_cpufreq_driver_data { }; -static DEFINE_PER_CPU(unsigned int, physical_cluster); - static struct mutex cluster_lock[MAX_CLUSTERS]; - +static DEFINE_MUTEX(cpufreq_target_lock); static unsigned int meson_cpufreq_get_rate(unsigned int cpu) { @@ -249,6 +247,7 @@ static int meson_cpufreq_set_target(struct cpufreq_policy *policy, return -ENODEV; } + mutex_lock(&cpufreq_target_lock); cpu = policy->cpu; cpufreq_data = policy->driver_data; cpu_dev = cpufreq_data->cpu_dev; @@ -264,6 +263,7 @@ static int meson_cpufreq_set_target(struct cpufreq_policy *policy, opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_new); if (IS_ERR(opp)) { rcu_read_unlock(); + mutex_unlock(&cpufreq_target_lock); pr_err("failed to find OPP for %lu Khz\n", freq_new / 1000); return PTR_ERR(opp); @@ -288,6 +288,7 @@ static int meson_cpufreq_set_target(struct cpufreq_policy *policy, ret = meson_regulator_set_volate(cpu_reg, volt_old, volt_new, volt_tol); if (ret) { + mutex_unlock(&cpufreq_target_lock); pr_err("failed to scale voltage %u %u up: %d\n", volt_new, volt_tol, ret); return ret; @@ -305,6 +306,7 @@ static int meson_cpufreq_set_target(struct cpufreq_policy *policy, meson_regulator_set_volate(cpu_reg, volt_old, volt_old, volt_tol); } + mutex_unlock(&cpufreq_target_lock); return ret; } /*cpufreq down,change voltage after frequency*/ @@ -395,6 +397,13 @@ static int meson_cpufreq_init(struct cpufreq_policy *policy) goto free_clk; } + /*setting low_freq_clk_p to 1G,default 24M*/ + ret = clk_set_rate(low_freq_clk_p, mid_rate * 1000); + if (ret) { + pr_err("%s: error in setting low_freq_clk_p rate!\n", + __func__); + goto free_clk; + } high_freq_clk_p = of_clk_get_by_name(np, HIGH_FREQ_CLK_PARENT); if (IS_ERR(high_freq_clk_p)) { pr_err("%s: Failed to get high parent for cpu: %d,cluster: %d\n", @@ -415,13 +424,7 @@ static int meson_cpufreq_init(struct cpufreq_policy *policy) volt_tol = DEF_VOLT_TOL; pr_info("value of voltage_tolerance %u\n", volt_tol); - if (cur_cluster < MAX_CLUSTERS) { - int cpu; - - cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu)); - for_each_cpu(cpu, policy->cpus) - per_cpu(physical_cluster, cpu) = cur_cluster; - } + cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu)); ret = dev_pm_opp_of_cpumask_add_table(policy->cpus); if (ret) { @@ -496,7 +499,7 @@ free_np: static int meson_cpufreq_exit(struct cpufreq_policy *policy) { struct device *cpu_dev; - struct sprd_cpufreq_driver_data *cpufreq_data; + struct meson_cpufreq_driver_data *cpufreq_data; int cur_cluster = topology_physical_package_id(policy->cpu); cpufreq_data = policy->driver_data; |