Skip to content

Commit 11a647d

Browse files
mkaehlckegregkh
authored andcommitted
cpufreq: qcom: Don't add frequencies without an OPP
[ Upstream commit bc9b9c5 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 52e4b24 commit 11a647d

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
@@ -177,10 +177,15 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
177177
freq = cpu_hw_rate / 1000;
178178

179179
if (freq != prev_freq && core_count != LUT_TURBO_IND) {
180-
table[i].frequency = freq;
181-
qcom_cpufreq_update_opp(cpu_dev, freq, volt);
182-
dev_dbg(cpu_dev, "index=%d freq=%d, core_count %d\n", i,
180+
if (!qcom_cpufreq_update_opp(cpu_dev, freq, volt)) {
181+
table[i].frequency = freq;
182+
dev_dbg(cpu_dev, "index=%d freq=%d, core_count %d\n", i,
183183
freq, core_count);
184+
} else {
185+
dev_warn(cpu_dev, "failed to update OPP for freq=%d\n", freq);
186+
table[i].frequency = CPUFREQ_ENTRY_INVALID;
187+
}
188+
184189
} else if (core_count == LUT_TURBO_IND) {
185190
table[i].frequency = CPUFREQ_ENTRY_INVALID;
186191
}
@@ -197,9 +202,13 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
197202
* as the boost frequency
198203
*/
199204
if (prev->frequency == CPUFREQ_ENTRY_INVALID) {
200-
prev->frequency = prev_freq;
201-
prev->flags = CPUFREQ_BOOST_FREQ;
202-
qcom_cpufreq_update_opp(cpu_dev, prev_freq, volt);
205+
if (!qcom_cpufreq_update_opp(cpu_dev, prev_freq, volt)) {
206+
prev->frequency = prev_freq;
207+
prev->flags = CPUFREQ_BOOST_FREQ;
208+
} else {
209+
dev_warn(cpu_dev, "failed to update OPP for freq=%d\n",
210+
freq);
211+
}
203212
}
204213

205214
break;

0 commit comments

Comments
 (0)