MIPS: cevt-ds1287: Migrate to new 'set-state' interface
Migrate cevt-ds1287 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. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: linux-mips@linux-mips.org Cc: linaro-kernel@lists.linaro.org Cc: Thomas Gleixner <tglx@linutronix.de> Patchwork: https://patchwork.linux-mips.org/patch/10603/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
1edf907a09
commit
9f95618f9f
@ -59,27 +59,32 @@ static int ds1287_set_next_event(unsigned long delta,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ds1287_set_mode(enum clock_event_mode mode,
|
static int ds1287_shutdown(struct clock_event_device *evt)
|
||||||
struct clock_event_device *evt)
|
|
||||||
{
|
{
|
||||||
u8 val;
|
u8 val;
|
||||||
|
|
||||||
spin_lock(&rtc_lock);
|
spin_lock(&rtc_lock);
|
||||||
|
|
||||||
val = CMOS_READ(RTC_REG_B);
|
val = CMOS_READ(RTC_REG_B);
|
||||||
|
val &= ~RTC_PIE;
|
||||||
switch (mode) {
|
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
|
||||||
val |= RTC_PIE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
val &= ~RTC_PIE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
CMOS_WRITE(val, RTC_REG_B);
|
CMOS_WRITE(val, RTC_REG_B);
|
||||||
|
|
||||||
spin_unlock(&rtc_lock);
|
spin_unlock(&rtc_lock);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ds1287_set_periodic(struct clock_event_device *evt)
|
||||||
|
{
|
||||||
|
u8 val;
|
||||||
|
|
||||||
|
spin_lock(&rtc_lock);
|
||||||
|
|
||||||
|
val = CMOS_READ(RTC_REG_B);
|
||||||
|
val |= RTC_PIE;
|
||||||
|
CMOS_WRITE(val, RTC_REG_B);
|
||||||
|
|
||||||
|
spin_unlock(&rtc_lock);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ds1287_event_handler(struct clock_event_device *dev)
|
static void ds1287_event_handler(struct clock_event_device *dev)
|
||||||
@ -87,11 +92,13 @@ static void ds1287_event_handler(struct clock_event_device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct clock_event_device ds1287_clockevent = {
|
static struct clock_event_device ds1287_clockevent = {
|
||||||
.name = "ds1287",
|
.name = "ds1287",
|
||||||
.features = CLOCK_EVT_FEAT_PERIODIC,
|
.features = CLOCK_EVT_FEAT_PERIODIC,
|
||||||
.set_next_event = ds1287_set_next_event,
|
.set_next_event = ds1287_set_next_event,
|
||||||
.set_mode = ds1287_set_mode,
|
.set_state_shutdown = ds1287_shutdown,
|
||||||
.event_handler = ds1287_event_handler,
|
.set_state_periodic = ds1287_set_periodic,
|
||||||
|
.tick_resume = ds1287_shutdown,
|
||||||
|
.event_handler = ds1287_event_handler,
|
||||||
};
|
};
|
||||||
|
|
||||||
static irqreturn_t ds1287_interrupt(int irq, void *dev_id)
|
static irqreturn_t ds1287_interrupt(int irq, void *dev_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user