192b13b69aded8fa88a2ad009a5d75fb3c9636d1
[openwrt/staging/linusw.git] /
1 From 814af1a008845b61a08111f2f9cf7e66511ab362 Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Fri, 13 Sep 2019 13:45:11 +0100
4 Subject: [PATCH] raspberrypi-cpufreq: Only report integer pll divisor
5 frequencies
6
7 ---
8 drivers/cpufreq/raspberrypi-cpufreq.c | 7 ++++++-
9 1 file changed, 6 insertions(+), 1 deletion(-)
10
11 --- a/drivers/cpufreq/raspberrypi-cpufreq.c
12 +++ b/drivers/cpufreq/raspberrypi-cpufreq.c
13 @@ -8,6 +8,7 @@
14 #include <linux/clk.h>
15 #include <linux/cpu.h>
16 #include <linux/cpufreq.h>
17 +#include <linux/math64.h>
18 #include <linux/module.h>
19 #include <linux/platform_device.h>
20 #include <linux/pm_opp.h>
21 @@ -22,6 +23,7 @@ static int raspberrypi_cpufreq_probe(str
22 unsigned long min, max;
23 unsigned long rate;
24 struct clk *clk;
25 + int div;
26 int ret;
27
28 cpu_dev = get_cpu_device(0);
29 @@ -44,7 +46,10 @@ static int raspberrypi_cpufreq_probe(str
30 max = roundup(clk_round_rate(clk, ULONG_MAX), RASPBERRYPI_FREQ_INTERVAL);
31 clk_put(clk);
32
33 - for (rate = min; rate <= max; rate += RASPBERRYPI_FREQ_INTERVAL) {
34 + for (div = 2; ; div++) {
35 + rate = div_u64((u64)max * 2, div);
36 + if (rate < min)
37 + break;
38 ret = dev_pm_opp_add(cpu_dev, rate, 0);
39 if (ret)
40 goto remove_opp;