aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cpuidle.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-07 13:13:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-07 13:13:52 -0500
commit3c00303206c3a1ccd86579efdc90bc35f140962e (patch)
tree66170c84b5ddaeb102aea3530517a26657b6ea29 /include/linux/cpuidle.h
parent83dbb15e9cd78a3619e3db36777e2f81d09b2914 (diff)
parentefb90582c575084723cc14302c1300cb26c7e01f (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: cpuidle: Single/Global registration of idle states cpuidle: Split cpuidle_state structure and move per-cpu statistics fields cpuidle: Remove CPUIDLE_FLAG_IGNORE and dev->prepare() cpuidle: Move dev->last_residency update to driver enter routine; remove dev->last_state ACPI: Fix CONFIG_ACPI_DOCK=n compiler warning ACPI: Export FADT pm_profile integer value to userspace thermal: Prevent polling from happening during system suspend ACPI: Drop ACPI_NO_HARDWARE_INIT ACPI atomicio: Convert width in bits to bytes in __acpi_ioremap_fast() PNPACPI: Simplify disabled resource registration ACPI: Fix possible recursive locking in hwregs.c ACPI: use kstrdup() mrst pmu: update comment tools/power turbostat: less verbose debugging
Diffstat (limited to 'include/linux/cpuidle.h')
-rw-r--r--include/linux/cpuidle.h52
1 files changed, 30 insertions, 22 deletions
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 583baf22cad2..7408af843b8a 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -23,57 +23,62 @@
23struct module; 23struct module;
24 24
25struct cpuidle_device; 25struct cpuidle_device;
26struct cpuidle_driver;
26 27
27 28
28/**************************** 29/****************************
29 * CPUIDLE DEVICE INTERFACE * 30 * CPUIDLE DEVICE INTERFACE *
30 ****************************/ 31 ****************************/
31 32
33struct cpuidle_state_usage {
34 void *driver_data;
35
36 unsigned long long usage;
37 unsigned long long time; /* in US */
38};
39
32struct cpuidle_state { 40struct cpuidle_state {
33 char name[CPUIDLE_NAME_LEN]; 41 char name[CPUIDLE_NAME_LEN];
34 char desc[CPUIDLE_DESC_LEN]; 42 char desc[CPUIDLE_DESC_LEN];
35 void *driver_data;
36 43
37 unsigned int flags; 44 unsigned int flags;
38 unsigned int exit_latency; /* in US */ 45 unsigned int exit_latency; /* in US */
39 unsigned int power_usage; /* in mW */ 46 unsigned int power_usage; /* in mW */
40 unsigned int target_residency; /* in US */ 47 unsigned int target_residency; /* in US */
41 48
42 unsigned long long usage;
43 unsigned long long time; /* in US */
44
45 int (*enter) (struct cpuidle_device *dev, 49 int (*enter) (struct cpuidle_device *dev,
46 struct cpuidle_state *state); 50 struct cpuidle_driver *drv,
51 int index);
47}; 52};
48 53
49/* Idle State Flags */ 54/* Idle State Flags */
50#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ 55#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */
51#define CPUIDLE_FLAG_IGNORE (0x100) /* ignore during this idle period */
52 56
53#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 57#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
54 58
55/** 59/**
56 * cpuidle_get_statedata - retrieves private driver state data 60 * cpuidle_get_statedata - retrieves private driver state data
57 * @state: the state 61 * @st_usage: the state usage statistics
58 */ 62 */
59static inline void * cpuidle_get_statedata(struct cpuidle_state *state) 63static inline void *cpuidle_get_statedata(struct cpuidle_state_usage *st_usage)
60{ 64{
61 return state->driver_data; 65 return st_usage->driver_data;
62} 66}
63 67
64/** 68/**
65 * cpuidle_set_statedata - stores private driver state data 69 * cpuidle_set_statedata - stores private driver state data
66 * @state: the state 70 * @st_usage: the state usage statistics
67 * @data: the private data 71 * @data: the private data
68 */ 72 */
69static inline void 73static inline void
70cpuidle_set_statedata(struct cpuidle_state *state, void *data) 74cpuidle_set_statedata(struct cpuidle_state_usage *st_usage, void *data)
71{ 75{
72 state->driver_data = data; 76 st_usage->driver_data = data;
73} 77}
74 78
75struct cpuidle_state_kobj { 79struct cpuidle_state_kobj {
76 struct cpuidle_state *state; 80 struct cpuidle_state *state;
81 struct cpuidle_state_usage *state_usage;
77 struct completion kobj_unregister; 82 struct completion kobj_unregister;
78 struct kobject kobj; 83 struct kobject kobj;
79}; 84};
@@ -81,22 +86,17 @@ struct cpuidle_state_kobj {
81struct cpuidle_device { 86struct cpuidle_device {
82 unsigned int registered:1; 87 unsigned int registered:1;
83 unsigned int enabled:1; 88 unsigned int enabled:1;
84 unsigned int power_specified:1;
85 unsigned int cpu; 89 unsigned int cpu;
86 90
87 int last_residency; 91 int last_residency;
88 int state_count; 92 int state_count;
89 struct cpuidle_state states[CPUIDLE_STATE_MAX]; 93 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
90 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; 94 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
91 struct cpuidle_state *last_state;
92 95
93 struct list_head device_list; 96 struct list_head device_list;
94 struct kobject kobj; 97 struct kobject kobj;
95 struct completion kobj_unregister; 98 struct completion kobj_unregister;
96 void *governor_data; 99 void *governor_data;
97 struct cpuidle_state *safe_state;
98
99 int (*prepare) (struct cpuidle_device *dev);
100}; 100};
101 101
102DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); 102DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
@@ -120,6 +120,11 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
120struct cpuidle_driver { 120struct cpuidle_driver {
121 char name[CPUIDLE_NAME_LEN]; 121 char name[CPUIDLE_NAME_LEN];
122 struct module *owner; 122 struct module *owner;
123
124 unsigned int power_specified:1;
125 struct cpuidle_state states[CPUIDLE_STATE_MAX];
126 int state_count;
127 int safe_state_index;
123}; 128};
124 129
125#ifdef CONFIG_CPU_IDLE 130#ifdef CONFIG_CPU_IDLE
@@ -166,11 +171,14 @@ struct cpuidle_governor {
166 struct list_head governor_list; 171 struct list_head governor_list;
167 unsigned int rating; 172 unsigned int rating;
168 173
169 int (*enable) (struct cpuidle_device *dev); 174 int (*enable) (struct cpuidle_driver *drv,
170 void (*disable) (struct cpuidle_device *dev); 175 struct cpuidle_device *dev);
176 void (*disable) (struct cpuidle_driver *drv,
177 struct cpuidle_device *dev);
171 178
172 int (*select) (struct cpuidle_device *dev); 179 int (*select) (struct cpuidle_driver *drv,
173 void (*reflect) (struct cpuidle_device *dev); 180 struct cpuidle_device *dev);
181 void (*reflect) (struct cpuidle_device *dev, int index);
174 182
175 struct module *owner; 183 struct module *owner;
176}; 184};