]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/plat-omap/timer32k.c
Merge omap-drivers
[linux-2.6-omap-h63xx.git] / arch / arm / plat-omap / timer32k.c
index a98de903e68d31d00e91686c01fe10cbe6d4d010..884a280f8a1b39cf947dd6e88d7413617589c0c7 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/spinlock.h>
 #include <linux/err.h>
 #include <linux/clk.h>
+#include <linux/clocksource.h>
 
 #include <asm/system.h>
 #include <asm/hardware.h>
@@ -170,15 +171,6 @@ omap_32k_ticks_to_nsecs(unsigned long ticks_32k)
 
 static unsigned long omap_32k_last_tick = 0;
 
-/*
- * Returns elapsed usecs since last 32k timer interrupt
- */
-static unsigned long omap_32k_timer_gettimeoffset(void)
-{
-       unsigned long now = omap_32k_sync_timer_read();
-       return omap_32k_ticks_to_usecs(now - omap_32k_last_tick);
-}
-
 /*
  * Returns current time from boot in nsecs. It's OK for this to wrap
  * around for now, as it's just a relative time stamp.
@@ -280,6 +272,22 @@ static int omap_32k_timer_disable_dyn_tick(void)
        return 0;
 }
 
+static irqreturn_t omap_32k_timer_handler(int irq, void *dev_id)
+{
+       unsigned long now;
+
+       now = omap_32k_sync_timer_read();
+
+       /* Don't bother reprogramming timer if last tick was before next
+        * jiffie. We will get another interrupt when previously programmed
+        * timer expires. This cuts down interrupt load quite a bit.
+        */
+       if (now - omap_32k_last_tick < OMAP_32K_TICKS_PER_HZ)
+               return IRQ_HANDLED;
+
+       return _omap_32k_timer_interrupt(irq, dev_id);
+}
+
 static struct dyn_tick_timer omap_dyn_tick_timer = {
        .enable         = omap_32k_timer_enable_dyn_tick,
        .disable        = omap_32k_timer_disable_dyn_tick,
@@ -302,7 +310,6 @@ static __init void omap_init_32k_timer(void)
 
        if (cpu_class_is_omap1())
                setup_irq(INT_OS_TIMER, &omap_32k_timer_irq);
-       omap_timer.offset  = omap_32k_timer_gettimeoffset;
        omap_32k_last_tick = omap_32k_sync_timer_read();
 
 #ifdef CONFIG_ARCH_OMAP2
@@ -337,5 +344,4 @@ static void __init omap_timer_init(void)
 
 struct sys_timer omap_timer = {
        .init           = omap_timer_init,
-       .offset         = NULL,         /* Initialized later */
 };