Commit d7f430d4 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32

Pull AVR32 update from Hans-Christian Egtvedt.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32:
  AVR32/time: Migrate to new 'set-state' interface
parents 52721d9d 09adcdf2
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <mach/pm.h> #include <mach/pm.h>
static bool disable_cpu_idle_poll;
static cycle_t read_cycle_count(struct clocksource *cs) static cycle_t read_cycle_count(struct clocksource *cs)
{ {
...@@ -80,45 +81,45 @@ static int comparator_next_event(unsigned long delta, ...@@ -80,45 +81,45 @@ static int comparator_next_event(unsigned long delta,
return 0; return 0;
} }
static void comparator_mode(enum clock_event_mode mode, static int comparator_shutdown(struct clock_event_device *evdev)
struct clock_event_device *evdev)
{ {
switch (mode) { pr_debug("%s: %s\n", __func__, evdev->name);
case CLOCK_EVT_MODE_ONESHOT: sysreg_write(COMPARE, 0);
pr_debug("%s: start\n", evdev->name);
/* FALLTHROUGH */ if (disable_cpu_idle_poll) {
case CLOCK_EVT_MODE_RESUME: disable_cpu_idle_poll = false;
/* /*
* If we're using the COUNT and COMPARE registers we * Only disable idle poll if we have forced that
* need to force idle poll. * in a previous call.
*/ */
cpu_idle_poll_ctrl(true); cpu_idle_poll_ctrl(false);
break;
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
sysreg_write(COMPARE, 0);
pr_debug("%s: stop\n", evdev->name);
if (evdev->mode == CLOCK_EVT_MODE_ONESHOT ||
evdev->mode == CLOCK_EVT_MODE_RESUME) {
/*
* Only disable idle poll if we have forced that
* in a previous call.
*/
cpu_idle_poll_ctrl(false);
}
break;
default:
BUG();
} }
return 0;
}
static int comparator_set_oneshot(struct clock_event_device *evdev)
{
pr_debug("%s: %s\n", __func__, evdev->name);
disable_cpu_idle_poll = true;
/*
* If we're using the COUNT and COMPARE registers we
* need to force idle poll.
*/
cpu_idle_poll_ctrl(true);
return 0;
} }
static struct clock_event_device comparator = { static struct clock_event_device comparator = {
.name = "avr32_comparator", .name = "avr32_comparator",
.features = CLOCK_EVT_FEAT_ONESHOT, .features = CLOCK_EVT_FEAT_ONESHOT,
.shift = 16, .shift = 16,
.rating = 50, .rating = 50,
.set_next_event = comparator_next_event, .set_next_event = comparator_next_event,
.set_mode = comparator_mode, .set_state_shutdown = comparator_shutdown,
.set_state_oneshot = comparator_set_oneshot,
.tick_resume = comparator_set_oneshot,
}; };
void read_persistent_clock(struct timespec *ts) void read_persistent_clock(struct timespec *ts)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment