ipq806x: support independent core clocks in cpufreq with kernel 4.9+
[openwrt/openwrt.git] / target / linux / ipq806x / patches-4.9 / 0046-cpufreq-qcom-independent-core-clocks.patch
1 ipq806x: support independent core clocks with kernel 4.9+
2
3 Add back support for the independent_clocks definition that has been
4 removed between kernel 4.4 and 4.9 by upstream commits
5 eb96924acddc709db58221c210ca05cd9effb1df and
6 e86eee6bc2aaa6b3637f6497b26beee09a91bde9
7
8 * extend the new cpufreq_dt_platform_data definition in cpufreq-dt.h
9 * use new cpufreq-dt.h in qcom-cpufreq.c
10
11 Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
12
13 --- a/drivers/cpufreq/cpufreq-dt.h
14 +++ b/drivers/cpufreq/cpufreq-dt.h
15 @@ -14,6 +14,7 @@
16
17 struct cpufreq_dt_platform_data {
18 bool have_governor_per_policy;
19 + bool independent_clocks;
20 };
21
22 #endif /* __CPUFREQ_DT_H__ */
23 --- a/drivers/cpufreq/cpufreq-dt.c
24 +++ b/drivers/cpufreq/cpufreq-dt.c
25 @@ -221,7 +221,10 @@ static int cpufreq_init(struct cpufreq_p
26 }
27
28 if (fallback) {
29 - cpumask_setall(policy->cpus);
30 + struct cpufreq_dt_platform_data *pd = cpufreq_get_driver_data();
31 +
32 + if (!pd || !pd->independent_clocks)
33 + cpumask_setall(policy->cpus);
34
35 /*
36 * OPP tables are initialized only for policy->cpu, do it for
37 @@ -376,6 +379,8 @@ static int dt_cpufreq_probe(struct platf
38 if (data && data->have_governor_per_policy)
39 dt_cpufreq_driver.flags |= CPUFREQ_HAVE_GOVERNOR_PER_POLICY;
40
41 + dt_cpufreq_driver.driver_data = dev_get_platdata(&pdev->dev);
42 +
43 ret = cpufreq_register_driver(&dt_cpufreq_driver);
44 if (ret)
45 dev_err(&pdev->dev, "failed register driver: %d\n", ret);
46 --- a/drivers/cpufreq/qcom-cpufreq.c
47 +++ b/drivers/cpufreq/qcom-cpufreq.c
48 @@ -20,7 +20,7 @@
49 #include <linux/platform_device.h>
50 #include <linux/pm_opp.h>
51 #include <linux/slab.h>
52 -#include <linux/cpufreq-dt.h>
53 +#include "cpufreq-dt.h"
54
55 static void __init get_krait_bin_format_a(int *speed, int *pvs, int *pvs_ver)
56 {
57