diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-04-08 12:32:07 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-04-08 12:32:07 +0200 |
commit | f69e44b2059f2238ac558b4a115ebcdefe20b9be (patch) | |
tree | be2a95654d7c9cb38bbcbb7a83b862db359c79e1 /drivers/cpuidle/driver.c | |
parent | 0f0c8aa0d0562954cdfa135efb827067de7ba855 (diff) | |
parent | b6269efb146eb8770d753e3dc1c561f1cffb631a (diff) |
Merge branch 'pm-cpuidle-next' into linux-next
* pm-cpuidle-next:
cpuidle: imx6: remove timer broadcast initialization
cpuidle: OMAP4: remove timer broadcast initialization
cpuidle: ux500: remove timer broadcast initialization
cpuidle: initialize the broadcast timer framework
timer: move enum definition out of ifdef section
cpuidle: kirkwood: fix coccicheck warnings
cpuidle / kirkwood: remove redundant Kconfig option
cpuidle / ux500 : use CPUIDLE_FLAG_TIMER_STOP flag
cpuidle / imx6 : use CPUIDLE_FLAG_TIMER_STOP flag
cpuidle / omap4 : use CPUIDLE_FLAG_TIMER_STOP flag
cpuidle : handle clockevent notify from the cpuidle framework
Diffstat (limited to 'drivers/cpuidle/driver.c')
-rw-r--r-- | drivers/cpuidle/driver.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c index 422c7b69ba7..8dfaaae9444 100644 --- a/drivers/cpuidle/driver.c +++ b/drivers/cpuidle/driver.c @@ -11,6 +11,8 @@ #include <linux/mutex.h> #include <linux/module.h> #include <linux/cpuidle.h> +#include <linux/cpumask.h> +#include <linux/clockchips.h> #include "cpuidle.h" @@ -19,9 +21,28 @@ DEFINE_SPINLOCK(cpuidle_driver_lock); static void __cpuidle_set_cpu_driver(struct cpuidle_driver *drv, int cpu); static struct cpuidle_driver * __cpuidle_get_cpu_driver(int cpu); -static void __cpuidle_driver_init(struct cpuidle_driver *drv) +static void cpuidle_setup_broadcast_timer(void *arg) { + int cpu = smp_processor_id(); + clockevents_notify((long)(arg), &cpu); +} + +static void __cpuidle_driver_init(struct cpuidle_driver *drv, int cpu) +{ + int i; + drv->refcnt = 0; + + for (i = drv->state_count - 1; i >= 0 ; i--) { + + if (!(drv->states[i].flags & CPUIDLE_FLAG_TIMER_STOP)) + continue; + + drv->bctimer = 1; + on_each_cpu_mask(get_cpu_mask(cpu), cpuidle_setup_broadcast_timer, + (void *)CLOCK_EVT_NOTIFY_BROADCAST_ON, 1); + break; + } } static int __cpuidle_register_driver(struct cpuidle_driver *drv, int cpu) @@ -35,7 +56,7 @@ static int __cpuidle_register_driver(struct cpuidle_driver *drv, int cpu) if (__cpuidle_get_cpu_driver(cpu)) return -EBUSY; - __cpuidle_driver_init(drv); + __cpuidle_driver_init(drv, cpu); __cpuidle_set_cpu_driver(drv, cpu); @@ -49,6 +70,12 @@ static void __cpuidle_unregister_driver(struct cpuidle_driver *drv, int cpu) if (!WARN_ON(drv->refcnt > 0)) __cpuidle_set_cpu_driver(NULL, cpu); + + if (drv->bctimer) { + drv->bctimer = 0; + on_each_cpu_mask(get_cpu_mask(cpu), cpuidle_setup_broadcast_timer, + (void *)CLOCK_EVT_NOTIFY_BROADCAST_OFF, 1); + } } #ifdef CONFIG_CPU_IDLE_MULTIPLE_DRIVERS |