kernel: update 3.14 to 3.14.18
[openwrt.git] / target / linux / ipq806x / patches / 0173-cpufreq-Add-module-to-register-cpufreq-krait-device.patch
1 From f1db56284b01b1212a211023dcaa7846fd07d0ec Mon Sep 17 00:00:00 2001
2 From: Stephen Boyd <sboyd@codeaurora.org>
3 Date: Fri, 30 May 2014 17:16:53 -0700
4 Subject: [PATCH 173/182] cpufreq: Add module to register cpufreq-krait device
5
6 Register a cpufreq-krait device whenever we detect that a
7 "qcom,krait" compatible CPU is present in DT.
8
9 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
10 ---
11  drivers/cpufreq/Kconfig.arm    |    8 +++++++
12  drivers/cpufreq/Makefile       |    1 +
13  drivers/cpufreq/qcom-cpufreq.c |   48 ++++++++++++++++++++++++++++++++++++++++
14  3 files changed, 57 insertions(+)
15  create mode 100644 drivers/cpufreq/qcom-cpufreq.c
16
17 --- a/drivers/cpufreq/Kconfig.arm
18 +++ b/drivers/cpufreq/Kconfig.arm
19 @@ -123,6 +123,14 @@ config ARM_OMAP2PLUS_CPUFREQ
20         depends on ARCH_OMAP2PLUS
21         default ARCH_OMAP2PLUS
22  
23 +config ARM_QCOM_CPUFREQ
24 +       tristate "Qualcomm based"
25 +       depends on ARCH_QCOM
26 +       help
27 +         This adds the CPUFreq driver for Qualcomm SoC based boards.
28 +
29 +         If in doubt, say N.
30 +
31  config ARM_S3C_CPUFREQ
32         bool
33         help
34 --- a/drivers/cpufreq/Makefile
35 +++ b/drivers/cpufreq/Makefile
36 @@ -60,6 +60,7 @@ obj-$(CONFIG_ARM_IMX6Q_CPUFREQ)               += imx6
37  obj-$(CONFIG_ARM_INTEGRATOR)           += integrator-cpufreq.o
38  obj-$(CONFIG_ARM_KIRKWOOD_CPUFREQ)     += kirkwood-cpufreq.o
39  obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)    += omap-cpufreq.o
40 +obj-$(CONFIG_ARM_QCOM_CPUFREQ)         += qcom-cpufreq.o
41  obj-$(CONFIG_PXA25x)                   += pxa2xx-cpufreq.o
42  obj-$(CONFIG_PXA27x)                   += pxa2xx-cpufreq.o
43  obj-$(CONFIG_PXA3xx)                   += pxa3xx-cpufreq.o
44 --- /dev/null
45 +++ b/drivers/cpufreq/qcom-cpufreq.c
46 @@ -0,0 +1,48 @@
47 +/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
48 + *
49 + * This program is free software; you can redistribute it and/or modify
50 + * it under the terms of the GNU General Public License version 2 and
51 + * only version 2 as published by the Free Software Foundation.
52 + *
53 + * This program is distributed in the hope that it will be useful,
54 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
55 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
56 + * GNU General Public License for more details.
57 + */
58 +
59 +#include <linux/kernel.h>
60 +#include <linux/module.h>
61 +#include <linux/cpu.h>
62 +#include <linux/of.h>
63 +#include <linux/platform_device.h>
64 +#include <linux/err.h>
65 +
66 +static int qcom_cpufreq_driver_init(void)
67 +{
68 +       struct platform_device_info devinfo = { .name = "cpufreq-krait", };
69 +       struct device *cpu_dev;
70 +       struct device_node *np;
71 +       struct platform_device *pdev;
72 +
73 +       cpu_dev = get_cpu_device(0);
74 +       if (!cpu_dev)
75 +               return -ENODEV;
76 +
77 +       np = of_node_get(cpu_dev->of_node);
78 +       if (!np)
79 +               return -ENOENT;
80 +
81 +       if (!of_device_is_compatible(np, "qcom,krait")) {
82 +               of_node_put(np);
83 +               return -ENODEV;
84 +       }
85 +       of_node_put(np);
86 +
87 +       pdev = platform_device_register_full(&devinfo);
88 +
89 +       return PTR_ERR_OR_ZERO(pdev);
90 +}
91 +module_init(qcom_cpufreq_driver_init);
92 +
93 +MODULE_DESCRIPTION("Qualcomm CPUfreq driver");
94 +MODULE_LICENSE("GPL v2");