aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cpuidle.h
diff options
context:
space:
mode:
authorDeepthi Dharwar <deepthi@linux.vnet.ibm.com>2011-10-28 06:50:33 -0400
committerLen Brown <len.brown@intel.com>2011-11-06 21:13:49 -0500
commit4202735e8ab6ecfb0381631a0d0b58fefe0bd4e2 (patch)
tree189e5aab466995128c5a9d5a2a4075a5db530674 /include/linux/cpuidle.h
parentb25edc42bfb9602f0503474b2c94701d5536ce60 (diff)
cpuidle: Split cpuidle_state structure and move per-cpu statistics fields
This is the first step towards global registration of cpuidle states. The statistics used primarily by the governor are per-cpu and have to be split from rest of the fields inside cpuidle_state, which would be made global i.e. single copy. The driver_data field is also per-cpu and moved. Signed-off-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com> Signed-off-by: Trinabh Gupta <g.trinabh@gmail.com> Tested-by: Jean Pihet <j-pihet@ti.com> Reviewed-by: Kevin Hilman <khilman@ti.com> Acked-by: Arjan van de Ven <arjan@linux.intel.com> Acked-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'include/linux/cpuidle.h')
-rw-r--r--include/linux/cpuidle.h25
1 files changed, 15 insertions, 10 deletions
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index c6d85cf90eb2..0156540b3f79 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -28,19 +28,22 @@ struct cpuidle_device;
28 * CPUIDLE DEVICE INTERFACE * 28 * CPUIDLE DEVICE INTERFACE *
29 ****************************/ 29 ****************************/
30 30
31struct cpuidle_state_usage {
32 void *driver_data;
33
34 unsigned long long usage;
35 unsigned long long time; /* in US */
36};
37
31struct cpuidle_state { 38struct cpuidle_state {
32 char name[CPUIDLE_NAME_LEN]; 39 char name[CPUIDLE_NAME_LEN];
33 char desc[CPUIDLE_DESC_LEN]; 40 char desc[CPUIDLE_DESC_LEN];
34 void *driver_data;
35 41
36 unsigned int flags; 42 unsigned int flags;
37 unsigned int exit_latency; /* in US */ 43 unsigned int exit_latency; /* in US */
38 unsigned int power_usage; /* in mW */ 44 unsigned int power_usage; /* in mW */
39 unsigned int target_residency; /* in US */ 45 unsigned int target_residency; /* in US */
40 46
41 unsigned long long usage;
42 unsigned long long time; /* in US */
43
44 int (*enter) (struct cpuidle_device *dev, 47 int (*enter) (struct cpuidle_device *dev,
45 int index); 48 int index);
46}; 49};
@@ -52,26 +55,27 @@ struct cpuidle_state {
52 55
53/** 56/**
54 * cpuidle_get_statedata - retrieves private driver state data 57 * cpuidle_get_statedata - retrieves private driver state data
55 * @state: the state 58 * @st_usage: the state usage statistics
56 */ 59 */
57static inline void * cpuidle_get_statedata(struct cpuidle_state *state) 60static inline void *cpuidle_get_statedata(struct cpuidle_state_usage *st_usage)
58{ 61{
59 return state->driver_data; 62 return st_usage->driver_data;
60} 63}
61 64
62/** 65/**
63 * cpuidle_set_statedata - stores private driver state data 66 * cpuidle_set_statedata - stores private driver state data
64 * @state: the state 67 * @st_usage: the state usage statistics
65 * @data: the private data 68 * @data: the private data
66 */ 69 */
67static inline void 70static inline void
68cpuidle_set_statedata(struct cpuidle_state *state, void *data) 71cpuidle_set_statedata(struct cpuidle_state_usage *st_usage, void *data)
69{ 72{
70 state->driver_data = data; 73 st_usage->driver_data = data;
71} 74}
72 75
73struct cpuidle_state_kobj { 76struct cpuidle_state_kobj {
74 struct cpuidle_state *state; 77 struct cpuidle_state *state;
78 struct cpuidle_state_usage *state_usage;
75 struct completion kobj_unregister; 79 struct completion kobj_unregister;
76 struct kobject kobj; 80 struct kobject kobj;
77}; 81};
@@ -85,6 +89,7 @@ struct cpuidle_device {
85 int last_residency; 89 int last_residency;
86 int state_count; 90 int state_count;
87 struct cpuidle_state states[CPUIDLE_STATE_MAX]; 91 struct cpuidle_state states[CPUIDLE_STATE_MAX];
92 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
88 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; 93 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
89 94
90 struct list_head device_list; 95 struct list_head device_list;