Skip to contentSkip to conversation

ARM: ux500: cpuidle: Instantiate the driver from platform device

PATCH New Daniel Lezcano 1 participant 3 messages Jul 15, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ARM: ux500: cpuidle: Instantiate the driver from platform device

From: Linus Walleij <[email protected]>

To break the dependency on the "id.h" file we move the cpuidle driver to a platform device. Now we only call the probe() on this driver if we find a corresponding platform device (which is spawned from the PRCMU MFD driver).

---
 arch/arm/mach-ux500/cpuidle.c |   17 +++++++++++------
 drivers/mfd/db8500-prcmu.c    |    4 ++++
 2 files changed, 15 insertions(+), 6 deletions(-)
arch/arm/mach-ux500/cpuidle.c +11 -6
index a45dd09..c0cb37c 100644
@@ -16,12 +16,12 @@
 #include <linux/smp.h>
 #include <linux/mfd/dbx500-prcmu.h>
 #include <linux/platform_data/arm-ux500-pm.h>
+#include <linux/platform_device.h>
 
 #include <asm/cpuidle.h>
 #include <asm/proc-fns.h>
 
 #include "db8500-regs.h"
-#include "id.h"
 
 static atomic_t master = ATOMIC_INIT(0);
 static DEFINE_SPINLOCK(master_lock);
@@ -113,11 +113,8 @@ static struct cpuidle_driver ux500_idle_driver = {
 	.state_count = 2,
 };
 
-int __init ux500_idle_init(void)
+static int __init dbx500_cpuidle_probe(struct platform_device *pdev)
 {
-	if (!(cpu_is_u8500_family() || cpu_is_ux540_family()))
-		return -ENODEV;
-
 	/* Configure wake up reasons */
 	prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) |
 			     PRCMU_WAKEUP(ABB));
@@ -125,4 +122,12 @@ int __init ux500_idle_init(void)
 	return cpuidle_register(&ux500_idle_driver, NULL);
 }
 
-device_initcall(ux500_idle_init);
+static struct platform_driver dbx500_cpuidle_plat_driver = {
+	.driver = {
+		.name = "cpuidle-dbx500",
+		.owner = THIS_MODULE,
+	},
+	.probe = dbx500_cpuidle_probe,
+};
+
+module_platform_driver(dbx500_cpuidle_plat_driver);
drivers/mfd/db8500-prcmu.c +4 -0
index 3c157fa..0d68eb1 100644
@@ -3094,6 +3094,10 @@ static struct mfd_cell db8500_prcmu_devs[] = {
 		.pdata_size = sizeof(db8500_cpufreq_table),
 	},
 	{
+		.name = "cpuidle-dbx500",
+		.of_compatible = "stericsson,cpuidle-dbx500",
+	},
+	{
 		.name = "db8500-thermal",
 		.num_resources = ARRAY_SIZE(db8500_thsens_resources),
 		.resources = db8500_thsens_resources,
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/3 ARM: ux500: cpuidle: Remove pointless include

From: Linus Walleij <[email protected]>

The db8500-regs.h file does not need to be included by the cpuidle driver.

---
 arch/arm/mach-ux500/cpuidle.c |    2 --
 1 file changed, 2 deletions(-)
arch/arm/mach-ux500/cpuidle.c +0 -2
index c0cb37c..e056465 100644
@@ -21,8 +21,6 @@
 #include <asm/cpuidle.h>
 #include <asm/proc-fns.h>
 
-#include "db8500-regs.h"
-
 static atomic_t master = ATOMIC_INIT(0);
 static DEFINE_SPINLOCK(master_lock);
 
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 3/3 ARM: ux500: cpuidle: Move ux500 cpuidle driver to drivers/cpuidle

In reply to Daniel Lezcano

There is no more dependency with arch/arm headers, so we can safely move the driver to the drivers/cpuidle directory.

---
 arch/arm/mach-ux500/Makefile                       |    1 -
 drivers/cpuidle/Kconfig.arm                        |    8 ++++++++
 drivers/cpuidle/Makefile                           |    1 +
 .../cpuidle.c => drivers/cpuidle/cpuidle-ux500.c   |    0
 4 files changed, 9 insertions(+), 1 deletion(-)
 rename arch/arm/mach-ux500/cpuidle.c => drivers/cpuidle/cpuidle-ux500.c (100%)
arch/arm/mach-ux500/Makefile +0 -1
index bf9b6be..fe1f3e2 100644
@@ -4,7 +4,6 @@
 
 obj-y				:= cpu.o devices.o devices-common.o \
 				   id.o usb.o timer.o pm.o
-obj-$(CONFIG_CPU_IDLE)          += cpuidle.o
 obj-$(CONFIG_CACHE_L2X0)	+= cache-l2x0.o
 obj-$(CONFIG_UX500_SOC_DB8500)	+= cpu-db8500.o devices-db8500.o
 obj-$(CONFIG_MACH_MOP500)	+= board-mop500.o board-mop500-sdi.o \
drivers/cpuidle/Kconfig.arm +8 -0
index 2c8f17d..b330219 100644
@@ -19,3 +19,11 @@ config ARM_ZYNQ_CPUIDLE
 	bool "CPU Idle Driver for Xilinx Zynq processors"
 	depends on ARCH_ZYNQ
 	help
+	  Select this to enable cpuidle on Xilinx Zynq processors.
+
+config ARM_U8500_CPUIDLE
+	bool "Cpu Idle Driver for the ST-E u8500 processors"
+	depends on ARCH_U8500
+	help
+	  Select this to enable cpuidle for ST-E u8500 processors
+
drivers/cpuidle/Makefile +1 -0
index 77cf767..0b9d200 100644
@@ -10,3 +10,4 @@ obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
 obj-$(CONFIG_ARM_HIGHBANK_CPUIDLE)	+= cpuidle-calxeda.o
 obj-$(CONFIG_ARM_KIRKWOOD_CPUIDLE)	+= cpuidle-kirkwood.o
 obj-$(CONFIG_ARM_ZYNQ_CPUIDLE)		+= cpuidle-zynq.o
+obj-$(CONFIG_ARM_U8500_CPUIDLE)         += cpuidle-ux500.o
drivers/cpuidle/cpuidle-ux500.c renamed from arch/arm/mach-ux500/cpuidle.c +0 -0
similarity index 100%
rename from arch/arm/mach-ux500/cpuidle.c
rename to drivers/cpuidle/cpuidle-ux500.c
Signature · 1 line
1.7.9.5