Skip to content

Commit bc9b9c5

Browse files
Matthias Kaehlckevireshk
authored andcommitted
cpufreq: qcom: Don't add frequencies without an OPP
The driver currently adds all frequencies from the hardware LUT to the cpufreq table, regardless of whether the corresponding OPP exists. This prevents devices from disabling certain OPPs through the device tree and can result in CPU frequencies for which the interconnect bandwidth can't be adjusted. Only add frequencies with an OPP entry. Fixes: 55538fb ("cpufreq: qcom: Read voltage LUT and populate OPP") Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent 49b59f4 commit bc9b9c5

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,15 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
187187
freq = cpu_hw_rate / 1000;
188188

189189
if (freq != prev_freq && core_count != LUT_TURBO_IND) {
190-
table[i].frequency = freq;
191-
qcom_cpufreq_update_opp(cpu_dev, freq, volt);
192-
dev_dbg(cpu_dev, "index=%d freq=%d, core_count %d\n", i,
190+
if (!qcom_cpufreq_update_opp(cpu_dev, freq, volt)) {
191+
table[i].frequency = freq;
192+
dev_dbg(cpu_dev, "index=%d freq=%d, core_count %d\n", i,
193193
freq, core_count);
194+
} else {
195+
dev_warn(cpu_dev, "failed to update OPP for freq=%d\n", freq);
196+
table[i].frequency = CPUFREQ_ENTRY_INVALID;
197+
}
198+
194199
} else if (core_count == LUT_TURBO_IND) {
195200
table[i].frequency = CPUFREQ_ENTRY_INVALID;
196201
}
@@ -207,9 +212,13 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
207212
* as the boost frequency
208213
*/
209214
if (prev->frequency == CPUFREQ_ENTRY_INVALID) {
210-
prev->frequency = prev_freq;
211-
prev->flags = CPUFREQ_BOOST_FREQ;
212-
qcom_cpufreq_update_opp(cpu_dev, prev_freq, volt);
215+
if (!qcom_cpufreq_update_opp(cpu_dev, prev_freq, volt)) {
216+
prev->frequency = prev_freq;
217+
prev->flags = CPUFREQ_BOOST_FREQ;
218+
} else {
219+
dev_warn(cpu_dev, "failed to update OPP for freq=%d\n",
220+
freq);
221+
}
213222
}
214223

215224
break;

0 commit comments

Comments
 (0)