ipq806x: support independent core clocks in cpufreq with kernel 4.9+
authorHannu Nyman <hannu.nyman@iki.fi>
Thu, 16 Mar 2017 13:32:16 +0000 (15:32 +0200)
committerJohn Crispin <john@phrozen.org>
Mon, 20 Mar 2017 07:12:49 +0000 (08:12 +0100)
Add back support for the independent_clocks definition that has been
removed between kernel 4.4 and 4.9 by upstream commits
eb96924acddc709db58221c210ca05cd9effb1df and
e86eee6bc2aaa6b3637f6497b26beee09a91bde9

* extend the new cpufreq_dt_platform_data definition in cpufreq-dt.h
* revert the removal of its usage in cpufreq-dt.c
* use new cpufreq-dt.h in qcom-cpufreq.c

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
target/linux/ipq806x/patches-4.9/0046-cpufreq-qcom-Remove-platform-data.patch [deleted file]
target/linux/ipq806x/patches-4.9/0046-cpufreq-qcom-independent-core-clocks.patch [new file with mode: 0644]

diff --git a/target/linux/ipq806x/patches-4.9/0046-cpufreq-qcom-Remove-platform-data.patch b/target/linux/ipq806x/patches-4.9/0046-cpufreq-qcom-Remove-platform-data.patch
deleted file mode 100644 (file)
index aba2d19..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-From f3a327717565cadc8ce5c148860ce0baeb4fbe20 Mon Sep 17 00:00:00 2001
-From: Georgi Djakov <georgi.djakov@linaro.org>
-Date: Thu, 14 Jul 2016 14:48:21 +0300
-Subject: [PATCH 46/69] cpufreq: qcom: Remove platform data
-
-Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
----
- drivers/cpufreq/qcom-cpufreq.c | 12 +++---------
- 1 file changed, 3 insertions(+), 9 deletions(-)
-
---- a/drivers/cpufreq/qcom-cpufreq.c
-+++ b/drivers/cpufreq/qcom-cpufreq.c
-@@ -20,7 +20,6 @@
- #include <linux/platform_device.h>
- #include <linux/pm_opp.h>
- #include <linux/slab.h>
--#include <linux/cpufreq-dt.h>
- static void __init get_krait_bin_format_a(int *speed, int *pvs, int *pvs_ver)
- {
-@@ -168,12 +167,6 @@ static int __init qcom_cpufreq_populate_
- static int __init qcom_cpufreq_driver_init(void)
- {
--      struct cpufreq_dt_platform_data pdata = { .independent_clocks = true };
--      struct platform_device_info devinfo = {
--              .name = "cpufreq-dt",
--              .data = &pdata,
--              .size_data = sizeof(pdata),
--      };
-       struct device *cpu_dev;
-       struct device_node *np;
-       int ret;
-@@ -196,9 +189,10 @@ static int __init qcom_cpufreq_driver_in
-       if (ret)
-               return ret;
--      return PTR_ERR_OR_ZERO(platform_device_register_full(&devinfo));
-+      return PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", -1,
-+                                                             NULL, 0));
- }
--module_init(qcom_cpufreq_driver_init);
-+late_initcall(qcom_cpufreq_driver_init);
- MODULE_DESCRIPTION("Qualcomm CPUfreq driver");
- MODULE_LICENSE("GPL v2");
diff --git a/target/linux/ipq806x/patches-4.9/0046-cpufreq-qcom-independent-core-clocks.patch b/target/linux/ipq806x/patches-4.9/0046-cpufreq-qcom-independent-core-clocks.patch
new file mode 100644 (file)
index 0000000..1ee8ef5
--- /dev/null
@@ -0,0 +1,57 @@
+ipq806x: support independent core clocks with kernel 4.9+
+
+Add back support for the independent_clocks definition that has been
+removed between kernel 4.4 and 4.9 by upstream commits
+eb96924acddc709db58221c210ca05cd9effb1df and
+e86eee6bc2aaa6b3637f6497b26beee09a91bde9
+
+* extend the new cpufreq_dt_platform_data definition in cpufreq-dt.h
+* use new cpufreq-dt.h in qcom-cpufreq.c
+
+Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
+
+--- a/drivers/cpufreq/cpufreq-dt.h
++++ b/drivers/cpufreq/cpufreq-dt.h
+@@ -14,6 +14,7 @@
+ struct cpufreq_dt_platform_data {
+       bool have_governor_per_policy;
++      bool independent_clocks;
+ };
+ #endif /* __CPUFREQ_DT_H__ */
+--- a/drivers/cpufreq/cpufreq-dt.c
++++ b/drivers/cpufreq/cpufreq-dt.c
+@@ -221,7 +221,10 @@ static int cpufreq_init(struct cpufreq_p
+       }
+       if (fallback) {
+-              cpumask_setall(policy->cpus);
++              struct cpufreq_dt_platform_data *pd = cpufreq_get_driver_data();
++
++              if (!pd || !pd->independent_clocks)
++                      cpumask_setall(policy->cpus);
+               /*
+                * OPP tables are initialized only for policy->cpu, do it for
+@@ -376,6 +379,8 @@ static int dt_cpufreq_probe(struct platf
+       if (data && data->have_governor_per_policy)
+               dt_cpufreq_driver.flags |= CPUFREQ_HAVE_GOVERNOR_PER_POLICY;
++      dt_cpufreq_driver.driver_data = dev_get_platdata(&pdev->dev);
++
+       ret = cpufreq_register_driver(&dt_cpufreq_driver);
+       if (ret)
+               dev_err(&pdev->dev, "failed register driver: %d\n", ret);
+--- a/drivers/cpufreq/qcom-cpufreq.c
++++ b/drivers/cpufreq/qcom-cpufreq.c
+@@ -20,7 +20,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/pm_opp.h>
+ #include <linux/slab.h>
+-#include <linux/cpufreq-dt.h>
++#include "cpufreq-dt.h"
+ static void __init get_krait_bin_format_a(int *speed, int *pvs, int *pvs_ver)
+ {
+