]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: ux500: cpuidle: Instantiate the driver from platform device
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 10 Jul 2013 13:35:26 +0000 (15:35 +0200)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Sat, 27 Jul 2013 05:56:38 +0000 (07:56 +0200)
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).

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
arch/arm/mach-ux500/cpuidle.c
drivers/mfd/db8500-prcmu.c

index a45dd09daed9212c2d799ce1ef9421be8d13bab5..c0cb37c8086cf9566257f8d6a9c2911d1979ac0e 100644 (file)
 #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);
index 3c157faee645805f398cc2047d5f7b035555aacc..0d68eb1a5ec528924695959646a29a31d87ca1a8 100644 (file)
@@ -3093,6 +3093,10 @@ static struct mfd_cell db8500_prcmu_devs[] = {
                .platform_data = &db8500_cpufreq_table,
                .pdata_size = sizeof(db8500_cpufreq_table),
        },
+       {
+               .name = "cpuidle-dbx500",
+               .of_compatible = "stericsson,cpuidle-dbx500",
+       },
        {
                .name = "db8500-thermal",
                .num_resources = ARRAY_SIZE(db8500_thsens_resources),