ipq806x: switch to linux 4.14
[openwrt/openwrt.git] / target / linux / ipq806x / patches-4.9 / 0046-cpufreq-qcom-independent-core-clocks.patch
1 From patchwork Fri Dec 8 09:42:30 2017
2 Content-Type: text/plain; charset="utf-8"
3 MIME-Version: 1.0
4 Content-Transfer-Encoding: 7bit
5 Subject: [v4,12/12] cpufreq: dt: Reintroduce independent_clocks platform data
6 From: Sricharan R <sricharan@codeaurora.org>
7 X-Patchwork-Id: 10102073
8 Message-Id: <1512726150-7204-13-git-send-email-sricharan@codeaurora.org>
9 To: mturquette@baylibre.com, sboyd@codeaurora.org,
10 devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
11 linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
12 viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org
13 Cc: sricharan@codeaurora.org
14 Date: Fri, 8 Dec 2017 15:12:30 +0530
15
16 The Platform data was removed earlier by,
17 'commit eb96924acddc ("cpufreq: dt: Kill platform-data")'
18 since there were no users at that time.
19 Now this is required when the each of the cpu clocks
20 can be scaled independently, which is the case
21 for krait cores. So reintroduce it.
22
23 Signed-off-by: Sricharan R <sricharan@codeaurora.org>
24 ---
25 drivers/cpufreq/cpufreq-dt.c | 7 ++++++-
26 drivers/cpufreq/cpufreq-dt.h | 6 ++++++
27 2 files changed, 12 insertions(+), 1 deletion(-)
28
29 --- a/drivers/cpufreq/cpufreq-dt.c
30 +++ b/drivers/cpufreq/cpufreq-dt.c
31 @@ -221,7 +221,10 @@ static int cpufreq_init(struct cpufreq_p
32 }
33
34 if (fallback) {
35 - cpumask_setall(policy->cpus);
36 + struct cpufreq_dt_platform_data *pd = cpufreq_get_driver_data();
37 +
38 + if (!pd || !pd->independent_clocks)
39 + cpumask_setall(policy->cpus);
40
41 /*
42 * OPP tables are initialized only for policy->cpu, do it for
43 @@ -376,6 +379,8 @@ static int dt_cpufreq_probe(struct platf
44 if (data && data->have_governor_per_policy)
45 dt_cpufreq_driver.flags |= CPUFREQ_HAVE_GOVERNOR_PER_POLICY;
46
47 + dt_cpufreq_driver.driver_data = data;
48 +
49 ret = cpufreq_register_driver(&dt_cpufreq_driver);
50 if (ret)
51 dev_err(&pdev->dev, "failed register driver: %d\n", ret);
52 --- a/drivers/cpufreq/cpufreq-dt.h
53 +++ b/drivers/cpufreq/cpufreq-dt.h
54 @@ -13,6 +13,12 @@
55 #include <linux/types.h>
56
57 struct cpufreq_dt_platform_data {
58 + /*
59 + * True when each CPU has its own clock to control its
60 + * frequency, false when all CPUs are controlled by a single
61 + * clock.
62 + */
63 + bool independent_clocks;
64 bool have_governor_per_policy;
65 };
66