Skip to content

Commit f44019c

Browse files
committed
raspberrypi-cpufreq: Only report integer pll divisor frequencies
1 parent 727f6b1 commit f44019c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎drivers/cpufreq/raspberrypi-cpufreq.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/clk.h>
99
#include <linux/cpu.h>
1010
#include <linux/cpufreq.h>
11+
#include <linux/math64.h>
1112
#include <linux/module.h>
1213
#include <linux/platform_device.h>
1314
#include <linux/pm_opp.h>
@@ -22,6 +23,7 @@ static int raspberrypi_cpufreq_probe(struct platform_device *pdev)
2223
unsigned long min, max;
2324
unsigned long rate;
2425
struct clk *clk;
26+
int div;
2527
int ret;
2628

2729
cpu_dev = get_cpu_device(0);
@@ -44,7 +46,10 @@ static int raspberrypi_cpufreq_probe(struct platform_device *pdev)
4446
max = roundup(clk_round_rate(clk, ULONG_MAX), RASPBERRYPI_FREQ_INTERVAL);
4547
clk_put(clk);
4648

47-
for (rate = min; rate <= max; rate += RASPBERRYPI_FREQ_INTERVAL) {
49+
for (div = 2; ; div++) {
50+
rate = div_u64((u64)max * 2, div);
51+
if (rate < min)
52+
break;
4853
ret = dev_pm_opp_add(cpu_dev, rate, 0);
4954
if (ret)
5055
goto remove_opp;

0 commit comments

Comments
 (0)