Commit 2ea83398 authored by Russell King's avatar Russell King Committed by Russell King

[PATCH] ARM: Add VST idle loop call

This call allows the dynamic tick support to reprogram the timer
immediately before the CPU idles.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 99bcc059
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <asm/leds.h> #include <asm/leds.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/mach/time.h>
extern const char *processor_modes[]; extern const char *processor_modes[];
extern void setup_mm_for_reboot(char mode); extern void setup_mm_for_reboot(char mode);
...@@ -85,8 +86,10 @@ EXPORT_SYMBOL(pm_power_off); ...@@ -85,8 +86,10 @@ EXPORT_SYMBOL(pm_power_off);
void default_idle(void) void default_idle(void)
{ {
local_irq_disable(); local_irq_disable();
if (!need_resched() && !hlt_counter) if (!need_resched() && !hlt_counter) {
timer_dyn_reprogram();
arch_idle(); arch_idle();
}
local_irq_enable(); local_irq_enable();
} }
......
...@@ -424,15 +424,19 @@ static int timer_dyn_tick_disable(void) ...@@ -424,15 +424,19 @@ static int timer_dyn_tick_disable(void)
return ret; return ret;
} }
/*
* Reprogram the system timer for at least the calculated time interval.
* This function should be called from the idle thread with IRQs disabled,
* immediately before sleeping.
*/
void timer_dyn_reprogram(void) void timer_dyn_reprogram(void)
{ {
struct dyn_tick_timer *dyn_tick = system_timer->dyn_tick; struct dyn_tick_timer *dyn_tick = system_timer->dyn_tick;
unsigned long flags;
write_seqlock_irqsave(&xtime_lock, flags); write_seqlock(&xtime_lock);
if (dyn_tick->state & DYN_TICK_ENABLED) if (dyn_tick->state & DYN_TICK_ENABLED)
dyn_tick->reprogram(next_timer_interrupt() - jiffies); dyn_tick->reprogram(next_timer_interrupt() - jiffies);
write_sequnlock_irqrestore(&xtime_lock, flags); write_sequnlock(&xtime_lock);
} }
static ssize_t timer_show_dyn_tick(struct sys_device *dev, char *buf) static ssize_t timer_show_dyn_tick(struct sys_device *dev, char *buf)
......
...@@ -60,6 +60,8 @@ struct dyn_tick_timer { ...@@ -60,6 +60,8 @@ struct dyn_tick_timer {
}; };
void timer_dyn_reprogram(void); void timer_dyn_reprogram(void);
#else
#define timer_dyn_reprogram() do { } while (0)
#endif #endif
extern struct sys_timer *system_timer; extern struct sys_timer *system_timer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment