Skip to content

Commit

Permalink
ARM: ux500: cpuidle: Instantiate the driver from platform device
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Linus Walleij authored and Daniel Lezcano committed Jul 27, 2013
1 parent 7006b8a commit 8025395
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
17 changes: 11 additions & 6 deletions arch/arm/mach-ux500/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -113,16 +113,21 @@ 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));

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);
4 changes: 4 additions & 0 deletions drivers/mfd/db8500-prcmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 8025395

Please sign in to comment.