Commit 214bc755 authored by Viresh Kumar's avatar Viresh Kumar Committed by Daniel Lezcano
Browse files

clockevents/drivers/vt8500: Migrate to new 'set-state' interface



Migrate vt8500 driver to the new 'set-state' interface provided by
clockevents core, the earlier 'set-mode' interface is marked obsolete
now.

This also enables us to implement callbacks for new states of clockevent
devices, for example: ONESHOT_STOPPED.

Cc: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent 9552a6af
Loading
Loading
Loading
Loading
+10 −19
Original line number Diff line number Diff line
@@ -88,21 +88,11 @@ static int vt8500_timer_set_next_event(unsigned long cycles,
	return 0;
}

static void vt8500_timer_set_mode(enum clock_event_mode mode,
			      struct clock_event_device *evt)
static int vt8500_shutdown(struct clock_event_device *evt)
{
	switch (mode) {
	case CLOCK_EVT_MODE_RESUME:
	case CLOCK_EVT_MODE_PERIODIC:
		break;
	case CLOCK_EVT_MODE_ONESHOT:
	case CLOCK_EVT_MODE_UNUSED:
	case CLOCK_EVT_MODE_SHUTDOWN:
		writel(readl(regbase + TIMER_CTRL_VAL) | 1,
			regbase + TIMER_CTRL_VAL);
	writel(readl(regbase + TIMER_CTRL_VAL) | 1, regbase + TIMER_CTRL_VAL);
	writel(0, regbase + TIMER_IER_VAL);
		break;
	}
	return 0;
}

static struct clock_event_device clockevent = {
@@ -110,7 +100,8 @@ static struct clock_event_device clockevent = {
	.features		= CLOCK_EVT_FEAT_ONESHOT,
	.rating			= 200,
	.set_next_event		= vt8500_timer_set_next_event,
	.set_mode       = vt8500_timer_set_mode,
	.set_state_shutdown	= vt8500_shutdown,
	.set_state_oneshot	= vt8500_shutdown,
};

static irqreturn_t vt8500_timer_interrupt(int irq, void *dev_id)