]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/clocksource/timer-integrator-ap.c
Merge tag 'media/v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[karo-tx-linux.git] / drivers / clocksource / timer-integrator-ap.c
index a68866e0ecd4d66d6fdf6823f9d2296cd6245555..3f59ac2180dc68ac4a519aabe4b25697909e7c52 100644 (file)
@@ -75,33 +75,37 @@ static irqreturn_t integrator_timer_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static void clkevt_set_mode(enum clock_event_mode mode, struct clock_event_device *evt)
+static int clkevt_shutdown(struct clock_event_device *evt)
 {
        u32 ctrl = readl(clkevt_base + TIMER_CTRL) & ~TIMER_CTRL_ENABLE;
 
        /* Disable timer */
        writel(ctrl, clkevt_base + TIMER_CTRL);
+       return 0;
+}
 
-       switch (mode) {
-       case CLOCK_EVT_MODE_PERIODIC:
-               /* Enable the timer and start the periodic tick */
-               writel(timer_reload, clkevt_base + TIMER_LOAD);
-               ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
-               writel(ctrl, clkevt_base + TIMER_CTRL);
-               break;
-       case CLOCK_EVT_MODE_ONESHOT:
-               /* Leave the timer disabled, .set_next_event will enable it */
-               ctrl &= ~TIMER_CTRL_PERIODIC;
-               writel(ctrl, clkevt_base + TIMER_CTRL);
-               break;
-       case CLOCK_EVT_MODE_UNUSED:
-       case CLOCK_EVT_MODE_SHUTDOWN:
-       case CLOCK_EVT_MODE_RESUME:
-       default:
-               /* Just leave in disabled state */
-               break;
-       }
+static int clkevt_set_oneshot(struct clock_event_device *evt)
+{
+       u32 ctrl = readl(clkevt_base + TIMER_CTRL) &
+                  ~(TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC);
+
+       /* Leave the timer disabled, .set_next_event will enable it */
+       writel(ctrl, clkevt_base + TIMER_CTRL);
+       return 0;
+}
 
+static int clkevt_set_periodic(struct clock_event_device *evt)
+{
+       u32 ctrl = readl(clkevt_base + TIMER_CTRL) & ~TIMER_CTRL_ENABLE;
+
+       /* Disable timer */
+       writel(ctrl, clkevt_base + TIMER_CTRL);
+
+       /* Enable the timer and start the periodic tick */
+       writel(timer_reload, clkevt_base + TIMER_LOAD);
+       ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
+       writel(ctrl, clkevt_base + TIMER_CTRL);
+       return 0;
 }
 
 static int clkevt_set_next_event(unsigned long next, struct clock_event_device *evt)
@@ -116,11 +120,15 @@ static int clkevt_set_next_event(unsigned long next, struct clock_event_device *
 }
 
 static struct clock_event_device integrator_clockevent = {
-       .name           = "timer1",
-       .features       = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
-       .set_mode       = clkevt_set_mode,
-       .set_next_event = clkevt_set_next_event,
-       .rating         = 300,
+       .name                   = "timer1",
+       .features               = CLOCK_EVT_FEAT_PERIODIC |
+                                 CLOCK_EVT_FEAT_ONESHOT,
+       .set_state_shutdown     = clkevt_shutdown,
+       .set_state_periodic     = clkevt_set_periodic,
+       .set_state_oneshot      = clkevt_set_oneshot,
+       .tick_resume            = clkevt_shutdown,
+       .set_next_event         = clkevt_set_next_event,
+       .rating                 = 300,
 };
 
 static struct irqaction integrator_timer_irq = {