diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-20 15:17:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-20 15:17:55 -0400 |
commit | d7f430d450d333cbb404e232fb1c74f31f8c6356 (patch) | |
tree | df13925775aeb0b7f172086446a494fda7eadd26 | |
parent | 52721d9d3334c1cb1f76219a161084094ec634dc (diff) | |
parent | 09adcdf212d777ace8bb31bed8ca5c1dbd56bd0f (diff) |
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
-rw-r--r-- | arch/avr32/kernel/time.c | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c index d0f771be9e96..a124c55733db 100644 --- a/arch/avr32/kernel/time.c +++ b/arch/avr32/kernel/time.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <mach/pm.h> | 19 | #include <mach/pm.h> |
20 | 20 | ||
21 | static bool disable_cpu_idle_poll; | ||
21 | 22 | ||
22 | static cycle_t read_cycle_count(struct clocksource *cs) | 23 | static cycle_t read_cycle_count(struct clocksource *cs) |
23 | { | 24 | { |
@@ -80,45 +81,45 @@ static int comparator_next_event(unsigned long delta, | |||
80 | return 0; | 81 | return 0; |
81 | } | 82 | } |
82 | 83 | ||
83 | static void comparator_mode(enum clock_event_mode mode, | 84 | static int comparator_shutdown(struct clock_event_device *evdev) |
84 | struct clock_event_device *evdev) | ||
85 | { | 85 | { |
86 | switch (mode) { | 86 | pr_debug("%s: %s\n", __func__, evdev->name); |
87 | case CLOCK_EVT_MODE_ONESHOT: | 87 | sysreg_write(COMPARE, 0); |
88 | pr_debug("%s: start\n", evdev->name); | 88 | |
89 | /* FALLTHROUGH */ | 89 | if (disable_cpu_idle_poll) { |
90 | case CLOCK_EVT_MODE_RESUME: | 90 | disable_cpu_idle_poll = false; |
91 | /* | 91 | /* |
92 | * If we're using the COUNT and COMPARE registers we | 92 | * Only disable idle poll if we have forced that |
93 | * need to force idle poll. | 93 | * in a previous call. |
94 | */ | 94 | */ |
95 | cpu_idle_poll_ctrl(true); | 95 | cpu_idle_poll_ctrl(false); |
96 | break; | ||
97 | case CLOCK_EVT_MODE_UNUSED: | ||
98 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
99 | sysreg_write(COMPARE, 0); | ||
100 | pr_debug("%s: stop\n", evdev->name); | ||
101 | if (evdev->mode == CLOCK_EVT_MODE_ONESHOT || | ||
102 | evdev->mode == CLOCK_EVT_MODE_RESUME) { | ||
103 | /* | ||
104 | * Only disable idle poll if we have forced that | ||
105 | * in a previous call. | ||
106 | */ | ||
107 | cpu_idle_poll_ctrl(false); | ||
108 | } | ||
109 | break; | ||
110 | default: | ||
111 | BUG(); | ||
112 | } | 96 | } |
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static int comparator_set_oneshot(struct clock_event_device *evdev) | ||
101 | { | ||
102 | pr_debug("%s: %s\n", __func__, evdev->name); | ||
103 | |||
104 | disable_cpu_idle_poll = true; | ||
105 | /* | ||
106 | * If we're using the COUNT and COMPARE registers we | ||
107 | * need to force idle poll. | ||
108 | */ | ||
109 | cpu_idle_poll_ctrl(true); | ||
110 | |||
111 | return 0; | ||
113 | } | 112 | } |
114 | 113 | ||
115 | static struct clock_event_device comparator = { | 114 | static struct clock_event_device comparator = { |
116 | .name = "avr32_comparator", | 115 | .name = "avr32_comparator", |
117 | .features = CLOCK_EVT_FEAT_ONESHOT, | 116 | .features = CLOCK_EVT_FEAT_ONESHOT, |
118 | .shift = 16, | 117 | .shift = 16, |
119 | .rating = 50, | 118 | .rating = 50, |
120 | .set_next_event = comparator_next_event, | 119 | .set_next_event = comparator_next_event, |
121 | .set_mode = comparator_mode, | 120 | .set_state_shutdown = comparator_shutdown, |
121 | .set_state_oneshot = comparator_set_oneshot, | ||
122 | .tick_resume = comparator_set_oneshot, | ||
122 | }; | 123 | }; |
123 | 124 | ||
124 | void read_persistent_clock(struct timespec *ts) | 125 | void read_persistent_clock(struct timespec *ts) |