From d2b578e5fc189d6948eb48bdaf2156f74aecf69c Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Thu, 21 Mar 2013 12:21:34 +0000 Subject: cpuidle / ux500 : use CPUIDLE_FLAG_TIMER_STOP flag Use the CPUIDLE_FLAG_TIMER_STOP and let the cpuidle framework to handle the CLOCK_EVT_NOTIFY_BROADCAST_ENTER/EXIT when entering this state. Signed-off-by: Daniel Lezcano Signed-off-by: Rafael J. Wysocki --- arch/arm/mach-ux500/cpuidle.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'arch/arm/mach-ux500') diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c index ce91493..6d0c4b6 100644 --- a/arch/arm/mach-ux500/cpuidle.c +++ b/arch/arm/mach-ux500/cpuidle.c @@ -30,8 +30,6 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, int this_cpu = smp_processor_id(); bool recouple = false; - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &this_cpu); - if (atomic_inc_return(&master) == num_online_cpus()) { /* With this lock, we prevent the other cpu to exit and enter @@ -91,8 +89,6 @@ out: spin_unlock(&master_lock); } - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &this_cpu); - return index; } @@ -106,7 +102,8 @@ static struct cpuidle_driver ux500_idle_driver = { .enter = ux500_enter_idle, .exit_latency = 70, .target_residency = 260, - .flags = CPUIDLE_FLAG_TIME_VALID, + .flags = CPUIDLE_FLAG_TIME_VALID | + CPUIDLE_FLAG_TIMER_STOP, .name = "ApIdle", .desc = "ARM Retention", }, -- cgit v1.1 From a454afa5c371d862385db2bf3154d9ed9038246b Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Wed, 27 Mar 2013 10:22:11 +0000 Subject: cpuidle: ux500: remove timer broadcast initialization The initialization is done from the cpuidle framework. Signed-off-by: Daniel Lezcano Signed-off-by: Rafael J. Wysocki --- arch/arm/mach-ux500/cpuidle.c | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'arch/arm/mach-ux500') diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c index 6d0c4b6..1b16d9e 100644 --- a/arch/arm/mach-ux500/cpuidle.c +++ b/arch/arm/mach-ux500/cpuidle.c @@ -11,7 +11,6 @@ #include #include -#include #include #include #include @@ -112,16 +111,6 @@ static struct cpuidle_driver ux500_idle_driver = { .state_count = 2, }; -/* - * For each cpu, setup the broadcast timer because we will - * need to migrate the timers for the states >= ApIdle. - */ -static void ux500_setup_broadcast_timer(void *arg) -{ - int cpu = smp_processor_id(); - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu); -} - int __init ux500_idle_init(void) { int ret, cpu; @@ -131,13 +120,6 @@ int __init ux500_idle_init(void) prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) | PRCMU_WAKEUP(ABB)); - /* - * Configure the timer broadcast for each cpu, that must - * be done from the cpu context, so we use a smp cross - * call with 'on_each_cpu'. - */ - on_each_cpu(ux500_setup_broadcast_timer, NULL, 1); - ret = cpuidle_register_driver(&ux500_idle_driver); if (ret) { printk(KERN_ERR "failed to register ux500 idle driver\n"); -- cgit v1.1 From 554c06ba3ee29cf453fca17e9e61120b75aa476d Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Tue, 23 Apr 2013 08:54:31 +0000 Subject: cpuidle: remove en_core_tk_irqen flag The en_core_tk_irqen flag is set in all the cpuidle driver which means it is not necessary to specify this flag. Remove the flag and the code related to it. Signed-off-by: Daniel Lezcano Acked-by: Kevin Hilman # for mach-omap2/* Signed-off-by: Rafael J. Wysocki --- arch/arm/mach-ux500/cpuidle.c | 1 - 1 file changed, 1 deletion(-) (limited to 'arch/arm/mach-ux500') diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c index 1b16d9e..c29c1bf 100644 --- a/arch/arm/mach-ux500/cpuidle.c +++ b/arch/arm/mach-ux500/cpuidle.c @@ -94,7 +94,6 @@ out: static struct cpuidle_driver ux500_idle_driver = { .name = "ux500_idle", .owner = THIS_MODULE, - .en_core_tk_irqen = 1, .states = { ARM_CPUIDLE_WFI_STATE, { -- cgit v1.1 From 80b1c1999edbba3a411335f1650f0d92da391516 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Tue, 23 Apr 2013 08:54:32 +0000 Subject: ARM: ux500: cpuidle: replace for_each_online_cpu by for_each_possible_cpu All the drivers are using, in their initialization function, the for_each_possible_cpu macro. Using for_each_online_cpu means the driver must handle the initialization of the cpuidle device when a cpu is up which is not the case here. Change the macro to for_each_possible_cpu as that fix the hotplug initialization and make the initialization routine consistent with the rest of the code in the different drivers. Signed-off-by: Daniel Lezcano Acked-by: Linus Walleij Signed-off-by: Rafael J. Wysocki --- arch/arm/mach-ux500/cpuidle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/arm/mach-ux500') diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c index c29c1bf..5657d4a 100644 --- a/arch/arm/mach-ux500/cpuidle.c +++ b/arch/arm/mach-ux500/cpuidle.c @@ -125,7 +125,7 @@ int __init ux500_idle_init(void) return ret; } - for_each_online_cpu(cpu) { + for_each_possible(cpu) { device = &per_cpu(ux500_cpuidle_device, cpu); device->cpu = cpu; ret = cpuidle_register_device(device); @@ -139,7 +139,7 @@ out: return ret; out_unregister: - for_each_online_cpu(cpu) { + for_each_possible_cpu(cpu) { device = &per_cpu(ux500_cpuidle_device, cpu); cpuidle_unregister_device(device); } -- cgit v1.1 From e8928e2e1ec2e3325a90bcc19746ea67cc4bb083 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Tue, 23 Apr 2013 08:54:34 +0000 Subject: ARM: ux500: cpuidle: use init/exit common routine Remove the duplicate code and use the cpuidle common code for initialization. Signed-off-by: Daniel Lezcano Acked-by: Linus Walleij Signed-off-by: Rafael J. Wysocki --- arch/arm/mach-ux500/cpuidle.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) (limited to 'arch/arm/mach-ux500') diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c index 5657d4a..488e074 100644 --- a/arch/arm/mach-ux500/cpuidle.c +++ b/arch/arm/mach-ux500/cpuidle.c @@ -21,7 +21,6 @@ static atomic_t master = ATOMIC_INIT(0); static DEFINE_SPINLOCK(master_lock); -static DEFINE_PER_CPU(struct cpuidle_device, ux500_cpuidle_device); static inline int ux500_enter_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) @@ -112,40 +111,11 @@ static struct cpuidle_driver ux500_idle_driver = { int __init ux500_idle_init(void) { - int ret, cpu; - struct cpuidle_device *device; - /* Configure wake up reasons */ prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) | PRCMU_WAKEUP(ABB)); - ret = cpuidle_register_driver(&ux500_idle_driver); - if (ret) { - printk(KERN_ERR "failed to register ux500 idle driver\n"); - return ret; - } - - for_each_possible(cpu) { - device = &per_cpu(ux500_cpuidle_device, cpu); - device->cpu = cpu; - ret = cpuidle_register_device(device); - if (ret) { - printk(KERN_ERR "Failed to register cpuidle " - "device for cpu%d\n", cpu); - goto out_unregister; - } - } -out: - return ret; - -out_unregister: - for_each_possible_cpu(cpu) { - device = &per_cpu(ux500_cpuidle_device, cpu); - cpuidle_unregister_device(device); - } - - cpuidle_unregister_driver(&ux500_idle_driver); - goto out; + return cpuidle_register(&ux500_idle_driver, NULL); } device_initcall(ux500_idle_init); -- cgit v1.1