43 lines
1.4 KiB
Diff
43 lines
1.4 KiB
Diff
diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
|
|
index 432368707ea6..2a82c36aec21 100644
|
|
--- a/drivers/cpufreq/mediatek-cpufreq.c
|
|
+++ b/drivers/cpufreq/mediatek-cpufreq.c
|
|
@@ -42,6 +42,7 @@ struct mtk_cpu_dvfs_info {
|
|
struct list_head list_head;
|
|
int intermediate_voltage;
|
|
bool need_voltage_tracking;
|
|
+ int old_vproc;
|
|
};
|
|
|
|
static LIST_HEAD(dvfs_info_list);
|
|
@@ -192,11 +193,16 @@ static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info *info,
|
|
|
|
static int mtk_cpufreq_set_voltage(struct mtk_cpu_dvfs_info *info, int vproc)
|
|
{
|
|
+ int ret;
|
|
+
|
|
if (info->need_voltage_tracking)
|
|
- return mtk_cpufreq_voltage_tracking(info, vproc);
|
|
+ ret = mtk_cpufreq_voltage_tracking(info, vproc);
|
|
else
|
|
- return regulator_set_voltage(info->proc_reg, vproc,
|
|
- vproc + VOLT_TOL);
|
|
+ ret = regulator_set_voltage(info->proc_reg, vproc,
|
|
+ MAX_VOLT_LIMIT);
|
|
+ if (!ret)
|
|
+ info->old_vproc = vproc;
|
|
+ return ret;
|
|
}
|
|
|
|
static int mtk_cpufreq_set_target(struct cpufreq_policy *policy,
|
|
@@ -214,7 +220,9 @@ static int mtk_cpufreq_set_target(struct cpufreq_policy *policy,
|
|
inter_vproc = info->intermediate_voltage;
|
|
|
|
old_freq_hz = clk_get_rate(cpu_clk);
|
|
- old_vproc = regulator_get_voltage(info->proc_reg);
|
|
+ old_vproc = info->old_vproc;
|
|
+ if (old_vproc == 0)
|
|
+ old_vproc = regulator_get_voltage(info->proc_reg);
|
|
if (old_vproc < 0) {
|
|
pr_err("%s: invalid Vproc value: %d\n", __func__, old_vproc);
|
|
return old_vproc;
|