]> 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 f28e12883e927eec01f98d7644e94772e01067c0..2653106011618b2a2279eb894298b8390ff2c1ed 100644 (file)
@@ -42,7 +42,6 @@
 #include <linux/spinlock.h>
 #include <linux/err.h>
 #include <linux/clk.h>
-#include <linux/clocksource.h>
 
 #include <asm/system.h>
 #include <asm/hardware.h>
@@ -171,6 +170,15 @@ 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.
@@ -209,6 +217,11 @@ static inline irqreturn_t _omap_32k_timer_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
+static irqreturn_t omap_32k_timer_handler(int irq, void *dev_id)
+{
+       return _omap_32k_timer_interrupt(irq, dev_id);
+}
+
 static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id)
 {
        unsigned long flags;
@@ -221,22 +234,6 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id)
 }
 
 #ifdef CONFIG_NO_IDLE_HZ
-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);
-}
-
 /*
  * Programs the next timer interrupt needed. Called when dynamic tick is
  * enabled, and to reprogram the ticks to skip from pm_idle. Note that
@@ -294,6 +291,7 @@ 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
@@ -328,4 +326,5 @@ static void __init omap_timer_init(void)
 
 struct sys_timer omap_timer = {
        .init           = omap_timer_init,
+       .offset         = NULL,         /* Initialized later */
 };