Skip to contentSkip to conversation

cpufreq: tegra: Re-model Tegra20 cpufreq driver

PATCH Superseded Bill Huang 1 participant 1 message Dec 12, 2013

Subsystems (4)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Bill Huang

author
#0 lore raw

PATCH v4 1/1 cpufreq: tegra: Re-model Tegra20 cpufreq driver

Re-model Tegra20 cpufreq driver as below.

* Rename tegra-cpufreq.c to tegra20-cpufreq.c since this file supports only Tegra20.
* Add probe function so defer probe can be used when we're going to support DVFS.
* Create a fake cpufreq platform device with its name being "${root_compatible}-cpufreq" so SoC cpufreq driver can bind to it accordingly.

---

This patch remodel Tegra cpufreq driver to make it more easy to add new SoC support, in addition to that, adding probe function in the driver to let probe defer can be used to control init sequence when we are going to support DVFS.

Changes since v3:

- Create separate driver for each SoCs instead of a central driver indirect call to different SoC functions.

Changes since v2:

- Fix Kconfig.
- Rebase on top of branch 'cpufreq-next' on git://git.linaro.org/people/vireshk/linux.git.

Changes since v1:

- Split up patches.
- Split configuration-time data out of structure "tegra_cpufreq_data".
- Bug fixes.

---
 arch/arm/mach-tegra/tegra.c       |    2 +
 drivers/cpufreq/Kconfig.arm       |   12 +++
 drivers/cpufreq/Makefile          |    1 +
 drivers/cpufreq/tegra-cpufreq.c   |  214 ++++++-------------------------------
 drivers/cpufreq/tegra20-cpufreq.c |  192 +++++++++++++++++++++++++++++++++
 include/linux/tegra-cpufreq.h     |   24 +++++
 6 files changed, 265 insertions(+), 180 deletions(-)
 create mode 100644 drivers/cpufreq/tegra20-cpufreq.c
 create mode 100644 include/linux/tegra-cpufreq.h
arch/arm/mach-tegra/tegra.c +2 -0
index 7336817..a9b23e9 100644
@@ -34,6 +34,7 @@
 #include <linux/usb/tegra_usb_phy.h>
 #include <linux/clk/tegra.h>
 #include <linux/irqchip.h>
+#include <linux/tegra-cpufreq.h>
 
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/mach-types.h>
@@ -160,6 +161,7 @@ static void __init tegra_dt_init_late(void)
 {
 	int i;
 
+	tegra_cpufreq_init();
 	tegra_init_suspend();
 	tegra_cpuidle_init();
 	tegra_powergate_debugfs_init();
drivers/cpufreq/Kconfig.arm +12 -0
index ce52ed9..1cc9213 100644
@@ -225,6 +225,18 @@ config ARM_TEGRA_CPUFREQ
 	help
 	  This adds the CPUFreq driver support for TEGRA SOCs.
 
+config ARM_TEGRA20_CPUFREQ
+	bool "NVIDIA TEGRA20"
+	depends on ARM_TEGRA_CPUFREQ && ARCH_TEGRA_2x_SOC
+	default y
+	help
+	  This enables Tegra20 cpufreq functionality, it adds
+	  Tegra20 CPU frequency ladder and the call back functions
+	  to set CPU rate. All the non-SoC dependant codes are
+	  controlled by the config ARM_TEGRA20_CPUFREQ.
+
+	  If in doubt, say N.
+
 config ARM_VEXPRESS_SPC_CPUFREQ
         tristate "Versatile Express SPC based CPUfreq driver"
         select ARM_BIG_LITTLE_CPUFREQ
drivers/cpufreq/Makefile +1 -0
index 7494565..331964b 100644
@@ -74,6 +74,7 @@ obj-$(CONFIG_ARM_SA1100_CPUFREQ)	+= sa1100-cpufreq.o
 obj-$(CONFIG_ARM_SA1110_CPUFREQ)	+= sa1110-cpufreq.o
 obj-$(CONFIG_ARM_SPEAR_CPUFREQ)		+= spear-cpufreq.o
 obj-$(CONFIG_ARM_TEGRA_CPUFREQ)		+= tegra-cpufreq.o
+obj-$(CONFIG_ARM_TEGRA20_CPUFREQ)	+= tegra20-cpufreq.o
 obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ)	+= vexpress-spc-cpufreq.o
 
 ##################################################################################
drivers/cpufreq/tegra-cpufreq.c +34 -180

227 lines not on this page · raw message

drivers/cpufreq/tegra20-cpufreq.c new file +192 -0

192 lines not on this page · raw message

include/linux/tegra-cpufreq.h new file +24 -0
new file mode 100644
index 0000000..d7643e0
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2013, NVIDIA Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.
+ */
+
+#ifndef __LINUX_TEGRA_CPUFREQ_H
+#define __LINUX_TEGRA_CPUFREQ_H
+
+#ifdef CONFIG_ARM_TEGRA_CPUFREQ
+int tegra_cpufreq_init(void);
+#else
+static inline int tegra_cpufreq_init(void)
+{ return; }
+#endif
+
+#endif /* __LINUX_TEGRA_CPUFREQ_H_ */
Signature · 1 line
1.7.9.5