Skip to content

Commit 918c576

Browse files
committed
Merge tag 'cpufreq-arm-fixes-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm
Pull an ARM cpufreq fix for 6.2-rc8 from Viresh Kumar: - Fix the incorrect value returned by cpufreq driver's ->get() callback for Qualcomm platforms (Douglas Anderson). * tag 'cpufreq-arm-fixes-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm: cpufreq: qcom-hw: Fix cpufreq_driver->get() for non-LMH systems
2 parents 4ec5183 + 51be2ff commit 918c576

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,40 +143,42 @@ static unsigned long qcom_lmh_get_throttle_freq(struct qcom_cpufreq_data *data)
143143
return lval * xo_rate;
144144
}
145145

146-
/* Get the current frequency of the CPU (after throttling) */
147-
static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
146+
/* Get the frequency requested by the cpufreq core for the CPU */
147+
static unsigned int qcom_cpufreq_get_freq(unsigned int cpu)
148148
{
149149
struct qcom_cpufreq_data *data;
150+
const struct qcom_cpufreq_soc_data *soc_data;
150151
struct cpufreq_policy *policy;
152+
unsigned int index;
151153

152154
policy = cpufreq_cpu_get_raw(cpu);
153155
if (!policy)
154156
return 0;
155157

156158
data = policy->driver_data;
159+
soc_data = qcom_cpufreq.soc_data;
157160

158-
return qcom_lmh_get_throttle_freq(data) / HZ_PER_KHZ;
161+
index = readl_relaxed(data->base + soc_data->reg_perf_state);
162+
index = min(index, LUT_MAX_ENTRIES - 1);
163+
164+
return policy->freq_table[index].frequency;
159165
}
160166

161-
/* Get the frequency requested by the cpufreq core for the CPU */
162-
static unsigned int qcom_cpufreq_get_freq(unsigned int cpu)
167+
static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
163168
{
164169
struct qcom_cpufreq_data *data;
165-
const struct qcom_cpufreq_soc_data *soc_data;
166170
struct cpufreq_policy *policy;
167-
unsigned int index;
168171

169172
policy = cpufreq_cpu_get_raw(cpu);
170173
if (!policy)
171174
return 0;
172175

173176
data = policy->driver_data;
174-
soc_data = qcom_cpufreq.soc_data;
175177

176-
index = readl_relaxed(data->base + soc_data->reg_perf_state);
177-
index = min(index, LUT_MAX_ENTRIES - 1);
178+
if (data->throttle_irq >= 0)
179+
return qcom_lmh_get_throttle_freq(data) / HZ_PER_KHZ;
178180

179-
return policy->freq_table[index].frequency;
181+
return qcom_cpufreq_get_freq(cpu);
180182
}
181183

182184
static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,

0 commit comments

Comments
 (0)