linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC/PATCH 11/12] cpufreq: Add module to register cpufreq-krait device
Date: Tue, 24 Jun 2014 17:06:22 -0700	[thread overview]
Message-ID: <1403654783-7176-12-git-send-email-sboyd@codeaurora.org> (raw)
In-Reply-To: <1403654783-7176-1-git-send-email-sboyd@codeaurora.org>

Register a cpufreq-krait device whenever we detect that a
"qcom,krait" compatible CPU is present in DT.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/cpufreq/Kconfig.arm    |  8 +++++++
 drivers/cpufreq/Makefile       |  1 +
 drivers/cpufreq/qcom-cpufreq.c | 48 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 57 insertions(+)
 create mode 100644 drivers/cpufreq/qcom-cpufreq.c

diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index ebac67115009..cbc5643b3ecf 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -128,6 +128,14 @@ config ARM_OMAP2PLUS_CPUFREQ
 	depends on ARCH_OMAP2PLUS
 	default ARCH_OMAP2PLUS
 
+config ARM_QCOM_CPUFREQ
+	tristate "Qualcomm based"
+	depends on ARCH_QCOM
+	help
+	  This adds the CPUFreq driver for Qualcomm SoC based boards.
+
+	  If in doubt, say N.
+
 config ARM_S3C_CPUFREQ
 	bool
 	help
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index f5c9f68dcc0f..6b8917ba4b6e 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_ARM_IMX6Q_CPUFREQ)		+= imx6q-cpufreq.o
 obj-$(CONFIG_ARM_INTEGRATOR)		+= integrator-cpufreq.o
 obj-$(CONFIG_ARM_KIRKWOOD_CPUFREQ)	+= kirkwood-cpufreq.o
 obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)	+= omap-cpufreq.o
+obj-$(CONFIG_ARM_QCOM_CPUFREQ)		+= qcom-cpufreq.o
 obj-$(CONFIG_PXA25x)			+= pxa2xx-cpufreq.o
 obj-$(CONFIG_PXA27x)			+= pxa2xx-cpufreq.o
 obj-$(CONFIG_PXA3xx)			+= pxa3xx-cpufreq.o
diff --git a/drivers/cpufreq/qcom-cpufreq.c b/drivers/cpufreq/qcom-cpufreq.c
new file mode 100644
index 000000000000..71f4387734d0
--- /dev/null
+++ b/drivers/cpufreq/qcom-cpufreq.c
@@ -0,0 +1,48 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/cpu.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/err.h>
+
+static int qcom_cpufreq_driver_init(void)
+{
+	struct platform_device_info devinfo = { .name = "cpufreq-krait", };
+	struct device *cpu_dev;
+	struct device_node *np;
+	struct platform_device *pdev;
+
+	cpu_dev = get_cpu_device(0);
+	if (!cpu_dev)
+		return -ENODEV;
+
+	np = of_node_get(cpu_dev->of_node);
+	if (!np)
+		return -ENOENT;
+
+	if (!of_device_is_compatible(np, "qcom,krait")) {
+		of_node_put(np);
+		return -ENODEV;
+	}
+	of_node_put(np);
+
+	pdev = platform_device_register_full(&devinfo);
+
+	return PTR_ERR_OR_ZERO(pdev);
+}
+module_init(qcom_cpufreq_driver_init);
+
+MODULE_DESCRIPTION("Qualcomm CPUfreq driver");
+MODULE_LICENSE("GPL v2");
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

  parent reply	other threads:[~2014-06-25  0:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25  0:06 [RFC/PATCH 00/12] Krait clocks + Krait CPUfreq Stephen Boyd
2014-06-25  0:06 ` [RFC/PATCH 01/12] ARM: Add Krait L2 register accessor functions Stephen Boyd
2014-06-25  0:06 ` [RFC/PATCH 02/12] clk: Add safe switch hook Stephen Boyd
2014-07-29  6:05   ` Mike Turquette
2014-07-29  8:59     ` Thomas Abraham
2014-09-10  1:44       ` dbasehore .
2014-06-25  0:06 ` [RFC/PATCH 03/12] clk: qcom: Add support for muxes, dividers, and mux dividers Stephen Boyd
2014-07-14 10:06   ` pramod gurav
2014-06-25  0:06 ` [RFC/PATCH 04/12] clk: qcom: Add support for High-Frequency PLLs (HFPLLs) Stephen Boyd
2014-06-25  0:06 ` [RFC/PATCH 05/12] clk: qcom: Add HFPLL driver Stephen Boyd
2014-06-25  0:06 ` [RFC/PATCH 06/12] clk: qcom: Add MSM8960's HFPLLs Stephen Boyd
2014-07-14 10:19   ` pramod gurav
2014-06-25  0:06 ` [RFC/PATCH 07/12] clk: qcom: Add support for Krait clocks Stephen Boyd
2014-06-25  0:06 ` [RFC/PATCH 08/12] clk: qcom: Add KPSS ACC/GCC driver Stephen Boyd
2014-06-25  0:06 ` [RFC/PATCH 09/12] clk: qcom: Add Krait clock controller driver Stephen Boyd
2014-07-14 10:25   ` pramod gurav
2014-06-25  0:06 ` [RFC/PATCH 10/12] cpufreq: Add a cpufreq-krait based on cpufreq-cpu0 Stephen Boyd
2014-06-25  0:52   ` Stephen Boyd
2014-06-25  8:47   ` Viresh Kumar
2014-06-25  0:06 ` Stephen Boyd [this message]
2014-06-25  0:06 ` [RFC/PATCH 12/12] ARM: dts: qcom: Add necessary DT data for Krait cpufreq Stephen Boyd
2014-07-15 10:33 ` [RFC/PATCH 00/12] Krait clocks + Krait CPUfreq pramod gurav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403654783-7176-12-git-send-email-sboyd@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).