diff options
Diffstat (limited to 'drivers/cpuidle')
-rw-r--r-- | drivers/cpuidle/cpuidle-calxeda.c | 1 | ||||
-rw-r--r-- | drivers/cpuidle/cpuidle-kirkwood.c | 1 | ||||
-rw-r--r-- | drivers/cpuidle/cpuidle.c | 72 |
3 files changed, 18 insertions, 56 deletions
diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c index e1aab38c5a8d..a3b56f5d33bd 100644 --- a/drivers/cpuidle/cpuidle-calxeda.c +++ b/drivers/cpuidle/cpuidle-calxeda.c | |||
@@ -100,7 +100,6 @@ static void calxeda_idle_cpuidle_devices_uninit(void) | |||
100 | 100 | ||
101 | static struct cpuidle_driver calxeda_idle_driver = { | 101 | static struct cpuidle_driver calxeda_idle_driver = { |
102 | .name = "calxeda_idle", | 102 | .name = "calxeda_idle", |
103 | .en_core_tk_irqen = 1, | ||
104 | .states = { | 103 | .states = { |
105 | ARM_CPUIDLE_WFI_STATE, | 104 | ARM_CPUIDLE_WFI_STATE, |
106 | { | 105 | { |
diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c index 53aad7324965..6f3152436983 100644 --- a/drivers/cpuidle/cpuidle-kirkwood.c +++ b/drivers/cpuidle/cpuidle-kirkwood.c | |||
@@ -41,7 +41,6 @@ static int kirkwood_enter_idle(struct cpuidle_device *dev, | |||
41 | static struct cpuidle_driver kirkwood_idle_driver = { | 41 | static struct cpuidle_driver kirkwood_idle_driver = { |
42 | .name = "kirkwood_idle", | 42 | .name = "kirkwood_idle", |
43 | .owner = THIS_MODULE, | 43 | .owner = THIS_MODULE, |
44 | .en_core_tk_irqen = 1, | ||
45 | .states[0] = ARM_CPUIDLE_WFI_STATE, | 44 | .states[0] = ARM_CPUIDLE_WFI_STATE, |
46 | .states[1] = { | 45 | .states[1] = { |
47 | .enter = kirkwood_enter_idle, | 46 | .enter = kirkwood_enter_idle, |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index c50037029184..0da795b9dbbf 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -43,24 +43,6 @@ void disable_cpuidle(void) | |||
43 | 43 | ||
44 | static int __cpuidle_register_device(struct cpuidle_device *dev); | 44 | static int __cpuidle_register_device(struct cpuidle_device *dev); |
45 | 45 | ||
46 | static inline int cpuidle_enter(struct cpuidle_device *dev, | ||
47 | struct cpuidle_driver *drv, int index) | ||
48 | { | ||
49 | struct cpuidle_state *target_state = &drv->states[index]; | ||
50 | return target_state->enter(dev, drv, index); | ||
51 | } | ||
52 | |||
53 | static inline int cpuidle_enter_tk(struct cpuidle_device *dev, | ||
54 | struct cpuidle_driver *drv, int index) | ||
55 | { | ||
56 | return cpuidle_wrap_enter(dev, drv, index, cpuidle_enter); | ||
57 | } | ||
58 | |||
59 | typedef int (*cpuidle_enter_t)(struct cpuidle_device *dev, | ||
60 | struct cpuidle_driver *drv, int index); | ||
61 | |||
62 | static cpuidle_enter_t cpuidle_enter_ops; | ||
63 | |||
64 | /** | 46 | /** |
65 | * cpuidle_play_dead - cpu off-lining | 47 | * cpuidle_play_dead - cpu off-lining |
66 | * | 48 | * |
@@ -90,11 +72,27 @@ int cpuidle_play_dead(void) | |||
90 | * @next_state: index into drv->states of the state to enter | 72 | * @next_state: index into drv->states of the state to enter |
91 | */ | 73 | */ |
92 | int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, | 74 | int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, |
93 | int next_state) | 75 | int index) |
94 | { | 76 | { |
95 | int entered_state; | 77 | int entered_state; |
96 | 78 | ||
97 | entered_state = cpuidle_enter_ops(dev, drv, next_state); | 79 | struct cpuidle_state *target_state = &drv->states[index]; |
80 | ktime_t time_start, time_end; | ||
81 | s64 diff; | ||
82 | |||
83 | time_start = ktime_get(); | ||
84 | |||
85 | entered_state = target_state->enter(dev, drv, index); | ||
86 | |||
87 | time_end = ktime_get(); | ||
88 | |||
89 | local_irq_enable(); | ||
90 | |||
91 | diff = ktime_to_us(ktime_sub(time_end, time_start)); | ||
92 | if (diff > INT_MAX) | ||
93 | diff = INT_MAX; | ||
94 | |||
95 | dev->last_residency = (int) diff; | ||
98 | 96 | ||
99 | if (entered_state >= 0) { | 97 | if (entered_state >= 0) { |
100 | /* Update cpuidle counters */ | 98 | /* Update cpuidle counters */ |
@@ -231,37 +229,6 @@ void cpuidle_resume(void) | |||
231 | mutex_unlock(&cpuidle_lock); | 229 | mutex_unlock(&cpuidle_lock); |
232 | } | 230 | } |
233 | 231 | ||
234 | /** | ||
235 | * cpuidle_wrap_enter - performs timekeeping and irqen around enter function | ||
236 | * @dev: pointer to a valid cpuidle_device object | ||
237 | * @drv: pointer to a valid cpuidle_driver object | ||
238 | * @index: index of the target cpuidle state. | ||
239 | */ | ||
240 | int cpuidle_wrap_enter(struct cpuidle_device *dev, | ||
241 | struct cpuidle_driver *drv, int index, | ||
242 | int (*enter)(struct cpuidle_device *dev, | ||
243 | struct cpuidle_driver *drv, int index)) | ||
244 | { | ||
245 | ktime_t time_start, time_end; | ||
246 | s64 diff; | ||
247 | |||
248 | time_start = ktime_get(); | ||
249 | |||
250 | index = enter(dev, drv, index); | ||
251 | |||
252 | time_end = ktime_get(); | ||
253 | |||
254 | local_irq_enable(); | ||
255 | |||
256 | diff = ktime_to_us(ktime_sub(time_end, time_start)); | ||
257 | if (diff > INT_MAX) | ||
258 | diff = INT_MAX; | ||
259 | |||
260 | dev->last_residency = (int) diff; | ||
261 | |||
262 | return index; | ||
263 | } | ||
264 | |||
265 | #ifdef CONFIG_ARCH_HAS_CPU_RELAX | 232 | #ifdef CONFIG_ARCH_HAS_CPU_RELAX |
266 | static int poll_idle(struct cpuidle_device *dev, | 233 | static int poll_idle(struct cpuidle_device *dev, |
267 | struct cpuidle_driver *drv, int index) | 234 | struct cpuidle_driver *drv, int index) |
@@ -333,9 +300,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev) | |||
333 | return ret; | 300 | return ret; |
334 | } | 301 | } |
335 | 302 | ||
336 | cpuidle_enter_ops = drv->en_core_tk_irqen ? | ||
337 | cpuidle_enter_tk : cpuidle_enter; | ||
338 | |||
339 | poll_idle_init(drv); | 303 | poll_idle_init(drv); |
340 | 304 | ||
341 | ret = cpuidle_add_device_sysfs(dev); | 305 | ret = cpuidle_add_device_sysfs(dev); |