aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorRobert Lee <rob.lee@linaro.org>2012-03-20 16:22:46 -0400
committerLen Brown <len.brown@intel.com>2012-03-21 02:00:52 -0400
commit6da45dce3ce4a1f1f2548c9ad9954d57ab0625b3 (patch)
treeafb8147c55753efefad46753744a7de99db73966 /arch/arm
parent19976c2a88d125aec16b9255c7197c297bbdd637 (diff)
ARM: omap: Consolidate OMAP3 time keeping and irq enable
Use core cpuidle timekeeping and irqen wrapper and remove that handling from this code. Signed-off-by: Robert Lee <rob.lee@linaro.org> Reviewed-by: Kevin Hilman <khilman@ti.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Tested-by: Jean Pihet <j-pihet@ti.com> Acked-by: Jean Pihet <j-pihet@ti.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c42
1 files changed, 17 insertions, 25 deletions
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 464cffde58fe..535866489ce3 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -87,29 +87,14 @@ static int _cpuidle_deny_idle(struct powerdomain *pwrdm,
87 return 0; 87 return 0;
88} 88}
89 89
90/** 90static int __omap3_enter_idle(struct cpuidle_device *dev,
91 * omap3_enter_idle - Programs OMAP3 to enter the specified state
92 * @dev: cpuidle device
93 * @drv: cpuidle driver
94 * @index: the index of state to be entered
95 *
96 * Called from the CPUidle framework to program the device to the
97 * specified target state selected by the governor.
98 */
99static int omap3_enter_idle(struct cpuidle_device *dev,
100 struct cpuidle_driver *drv, 91 struct cpuidle_driver *drv,
101 int index) 92 int index)
102{ 93{
103 struct omap3_idle_statedata *cx = 94 struct omap3_idle_statedata *cx =
104 cpuidle_get_statedata(&dev->states_usage[index]); 95 cpuidle_get_statedata(&dev->states_usage[index]);
105 struct timespec ts_preidle, ts_postidle, ts_idle;
106 u32 mpu_state = cx->mpu_state, core_state = cx->core_state; 96 u32 mpu_state = cx->mpu_state, core_state = cx->core_state;
107 int idle_time;
108
109 /* Used to keep track of the total time in idle */
110 getnstimeofday(&ts_preidle);
111 97
112 local_irq_disable();
113 local_fiq_disable(); 98 local_fiq_disable();
114 99
115 pwrdm_set_next_pwrst(mpu_pd, mpu_state); 100 pwrdm_set_next_pwrst(mpu_pd, mpu_state);
@@ -148,22 +133,29 @@ static int omap3_enter_idle(struct cpuidle_device *dev,
148 } 133 }
149 134
150return_sleep_time: 135return_sleep_time:
151 getnstimeofday(&ts_postidle);
152 ts_idle = timespec_sub(ts_postidle, ts_preidle);
153 136
154 local_irq_enable();
155 local_fiq_enable(); 137 local_fiq_enable();
156 138
157 idle_time = ts_idle.tv_nsec / NSEC_PER_USEC + ts_idle.tv_sec * \
158 USEC_PER_SEC;
159
160 /* Update cpuidle counters */
161 dev->last_residency = idle_time;
162
163 return index; 139 return index;
164} 140}
165 141
166/** 142/**
143 * omap3_enter_idle - Programs OMAP3 to enter the specified state
144 * @dev: cpuidle device
145 * @drv: cpuidle driver
146 * @index: the index of state to be entered
147 *
148 * Called from the CPUidle framework to program the device to the
149 * specified target state selected by the governor.
150 */
151static inline int omap3_enter_idle(struct cpuidle_device *dev,
152 struct cpuidle_driver *drv,
153 int index)
154{
155 return cpuidle_wrap_enter(dev, drv, index, __omap3_enter_idle);
156}
157
158/**
167 * next_valid_state - Find next valid C-state 159 * next_valid_state - Find next valid C-state
168 * @dev: cpuidle device 160 * @dev: cpuidle device
169 * @drv: cpuidle driver 161 * @drv: cpuidle driver