aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 16:12:46 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 16:12:46 -0400
commitc4ec20717313daafba59225f812db89595952b83 (patch)
tree253337453b1dc965c40668e4949337ed1c46cab7 /include
parentec2626815bf9a9922e49820b03e670e833f3ca3c (diff)
parent00a2b433557f10736e8a02de619b3e9052556c12 (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (41 commits) ACPICA: hw: Don't carry spinlock over suspend ACPICA: hw: remove use_lock flag from acpi_hw_register_{read, write} ACPI: cpuidle: port idle timer suspend/resume workaround to cpuidle ACPI: clean up acpi_enter_sleep_state_prep Hibernation: Make sure that ACPI is enabled in acpi_hibernation_finish ACPI: suppress uninitialized var warning cpuidle: consolidate 2.6.22 cpuidle branch into one patch ACPI: thinkpad-acpi: skip blanks before the data when parsing sysfs ACPI: AC: Add sysfs interface ACPI: SBS: Add sysfs alarm ACPI: SBS: Add ACPI_PROCFS around procfs handling code. ACPI: SBS: Add support for power_supply class (and sysfs) ACPI: SBS: Make SBS reads table-driven. ACPI: SBS: Simplify data structures in SBS ACPI: SBS: Split host controller (ACPI0001) from SBS driver (ACPI0002) ACPI: EC: Add new query handler to list head. ACPI: Add acpi_bus_generate_event4() function ACPI: Battery: add sysfs alarm ACPI: Battery: Add sysfs support ACPI: Battery: Misc clean-ups, no functional changes ... Fix up conflicts in drivers/misc/thinkpad_acpi.[ch] manually
Diffstat (limited to 'include')
-rw-r--r--include/acpi/achware.h4
-rw-r--r--include/acpi/acpi_bus.h2
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/acpi/processor.h5
-rw-r--r--include/linux/acpi.h26
-rw-r--r--include/linux/cpuidle.h180
-rw-r--r--include/linux/tick.h9
7 files changed, 199 insertions, 29 deletions
diff --git a/include/acpi/achware.h b/include/acpi/achware.h
index 9df275cf7bc1..4053df943453 100644
--- a/include/acpi/achware.h
+++ b/include/acpi/achware.h
@@ -71,9 +71,9 @@ u32 acpi_hw_get_mode(void);
71struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id); 71struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
72 72
73acpi_status 73acpi_status
74acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value); 74acpi_hw_register_read(u32 register_id, u32 * return_value);
75 75
76acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value); 76acpi_status acpi_hw_register_write(u32 register_id, u32 value);
77 77
78acpi_status 78acpi_status
79acpi_hw_low_level_read(u32 width, 79acpi_hw_low_level_read(u32 width,
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 86aea44ce6d4..7b74b60a68a4 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -264,7 +264,6 @@ struct acpi_device_wakeup_flags {
264 264
265struct acpi_device_wakeup_state { 265struct acpi_device_wakeup_state {
266 u8 enabled:1; 266 u8 enabled:1;
267 u8 active:1;
268}; 267};
269 268
270struct acpi_device_wakeup { 269struct acpi_device_wakeup {
@@ -333,6 +332,7 @@ int acpi_bus_get_power(acpi_handle handle, int *state);
333int acpi_bus_set_power(acpi_handle handle, int state); 332int acpi_bus_set_power(acpi_handle handle, int state);
334#ifdef CONFIG_ACPI_PROC_EVENT 333#ifdef CONFIG_ACPI_PROC_EVENT
335int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); 334int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);
335int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data);
336int acpi_bus_receive_event(struct acpi_bus_event *event); 336int acpi_bus_receive_event(struct acpi_bus_event *event);
337#else 337#else
338static inline int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data) 338static inline int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 3d7ab9e0c9fe..9512f0456ad1 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -314,6 +314,8 @@ acpi_resource_to_address64(struct acpi_resource *resource,
314 */ 314 */
315acpi_status acpi_get_register(u32 register_id, u32 * return_value); 315acpi_status acpi_get_register(u32 register_id, u32 * return_value);
316 316
317acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value);
318
317acpi_status acpi_set_register(u32 register_id, u32 value); 319acpi_status acpi_set_register(u32 register_id, u32 value);
318 320
319acpi_status 321acpi_status
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 99934a999e66..26d79f6db8a0 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/cpu.h> 5#include <linux/cpu.h>
6#include <linux/cpuidle.h>
6 7
7#include <asm/acpi.h> 8#include <asm/acpi.h>
8 9
@@ -75,7 +76,9 @@ struct acpi_processor_cx {
75}; 76};
76 77
77struct acpi_processor_power { 78struct acpi_processor_power {
79 struct cpuidle_device dev;
78 struct acpi_processor_cx *state; 80 struct acpi_processor_cx *state;
81 struct acpi_processor_cx *bm_state;
79 unsigned long bm_check_timestamp; 82 unsigned long bm_check_timestamp;
80 u32 default_state; 83 u32 default_state;
81 u32 bm_activity; 84 u32 bm_activity;
@@ -199,6 +202,7 @@ struct acpi_processor_flags {
199 u8 bm_check:1; 202 u8 bm_check:1;
200 u8 has_cst:1; 203 u8 has_cst:1;
201 u8 power_setup_done:1; 204 u8 power_setup_done:1;
205 u8 bm_rld_set:1;
202}; 206};
203 207
204struct acpi_processor { 208struct acpi_processor {
@@ -322,6 +326,7 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
322 struct acpi_device *device); 326 struct acpi_device *device);
323int acpi_processor_suspend(struct acpi_device * device, pm_message_t state); 327int acpi_processor_suspend(struct acpi_device * device, pm_message_t state);
324int acpi_processor_resume(struct acpi_device * device); 328int acpi_processor_resume(struct acpi_device * device);
329extern struct cpuidle_driver acpi_idle_driver;
325 330
326/* in processor_thermal.c */ 331/* in processor_thermal.c */
327int acpi_processor_get_limit_info(struct acpi_processor *pr); 332int acpi_processor_get_limit_info(struct acpi_processor *pr);
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index bf5e0009de75..8ccedf7a0a5a 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -189,32 +189,6 @@ extern int ec_transaction(u8 command,
189extern int acpi_blacklisted(void); 189extern int acpi_blacklisted(void);
190extern void acpi_bios_year(char *s); 190extern void acpi_bios_year(char *s);
191 191
192#define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */
193#ifdef CONFIG_ACPI
194
195/*
196 * Set highest legal C-state
197 * 0: C0 okay, but not C1
198 * 1: C1 okay, but not C2
199 * 2: C2 okay, but not C3 etc.
200 */
201
202extern unsigned int max_cstate;
203
204static inline unsigned int acpi_get_cstate_limit(void)
205{
206 return max_cstate;
207}
208static inline void acpi_set_cstate_limit(unsigned int new_limit)
209{
210 max_cstate = new_limit;
211 return;
212}
213#else
214static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
215static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
216#endif
217
218#ifdef CONFIG_ACPI_NUMA 192#ifdef CONFIG_ACPI_NUMA
219int acpi_get_pxm(acpi_handle handle); 193int acpi_get_pxm(acpi_handle handle);
220int acpi_get_node(acpi_handle *handle); 194int acpi_get_node(acpi_handle *handle);
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
new file mode 100644
index 000000000000..16a51546db44
--- /dev/null
+++ b/include/linux/cpuidle.h
@@ -0,0 +1,180 @@
1/*
2 * cpuidle.h - a generic framework for CPU idle power management
3 *
4 * (C) 2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
5 * Shaohua Li <shaohua.li@intel.com>
6 * Adam Belay <abelay@novell.com>
7 *
8 * This code is licenced under the GPL.
9 */
10
11#ifndef _LINUX_CPUIDLE_H
12#define _LINUX_CPUIDLE_H
13
14#include <linux/percpu.h>
15#include <linux/list.h>
16#include <linux/module.h>
17#include <linux/kobject.h>
18#include <linux/completion.h>
19
20#define CPUIDLE_STATE_MAX 8
21#define CPUIDLE_NAME_LEN 16
22
23struct cpuidle_device;
24
25
26/****************************
27 * CPUIDLE DEVICE INTERFACE *
28 ****************************/
29
30struct cpuidle_state {
31 char name[CPUIDLE_NAME_LEN];
32 void *driver_data;
33
34 unsigned int flags;
35 unsigned int exit_latency; /* in US */
36 unsigned int power_usage; /* in mW */
37 unsigned int target_residency; /* in US */
38
39 unsigned int usage;
40 unsigned int time; /* in US */
41
42 int (*enter) (struct cpuidle_device *dev,
43 struct cpuidle_state *state);
44};
45
46/* Idle State Flags */
47#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */
48#define CPUIDLE_FLAG_CHECK_BM (0x02) /* BM activity will exit state */
49#define CPUIDLE_FLAG_SHALLOW (0x10) /* low latency, minimal savings */
50#define CPUIDLE_FLAG_BALANCED (0x20) /* medium latency, moderate savings */
51#define CPUIDLE_FLAG_DEEP (0x40) /* high latency, large savings */
52
53#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
54
55/**
56 * cpuidle_get_statedata - retrieves private driver state data
57 * @state: the state
58 */
59static inline void * cpuidle_get_statedata(struct cpuidle_state *state)
60{
61 return state->driver_data;
62}
63
64/**
65 * cpuidle_set_statedata - stores private driver state data
66 * @state: the state
67 * @data: the private data
68 */
69static inline void
70cpuidle_set_statedata(struct cpuidle_state *state, void *data)
71{
72 state->driver_data = data;
73}
74
75struct cpuidle_state_kobj {
76 struct cpuidle_state *state;
77 struct completion kobj_unregister;
78 struct kobject kobj;
79};
80
81struct cpuidle_device {
82 int enabled:1;
83 unsigned int cpu;
84
85 int last_residency;
86 int state_count;
87 struct cpuidle_state states[CPUIDLE_STATE_MAX];
88 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
89 struct cpuidle_state *last_state;
90
91 struct list_head device_list;
92 struct kobject kobj;
93 struct completion kobj_unregister;
94 void *governor_data;
95};
96
97DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
98
99/**
100 * cpuidle_get_last_residency - retrieves the last state's residency time
101 * @dev: the target CPU
102 *
103 * NOTE: this value is invalid if CPUIDLE_FLAG_TIME_VALID isn't set
104 */
105static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
106{
107 return dev->last_residency;
108}
109
110
111/****************************
112 * CPUIDLE DRIVER INTERFACE *
113 ****************************/
114
115struct cpuidle_driver {
116 char name[CPUIDLE_NAME_LEN];
117 struct module *owner;
118};
119
120#ifdef CONFIG_CPU_IDLE
121
122extern int cpuidle_register_driver(struct cpuidle_driver *drv);
123extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
124extern int cpuidle_register_device(struct cpuidle_device *dev);
125extern void cpuidle_unregister_device(struct cpuidle_device *dev);
126
127extern void cpuidle_pause_and_lock(void);
128extern void cpuidle_resume_and_unlock(void);
129extern int cpuidle_enable_device(struct cpuidle_device *dev);
130extern void cpuidle_disable_device(struct cpuidle_device *dev);
131
132#else
133
134static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
135{return 0;}
136static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { }
137static inline int cpuidle_register_device(struct cpuidle_device *dev)
138{return 0;}
139static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { }
140
141static inline void cpuidle_pause_and_lock(void) { }
142static inline void cpuidle_resume_and_unlock(void) { }
143static inline int cpuidle_enable_device(struct cpuidle_device *dev)
144{return 0;}
145static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
146
147#endif
148
149/******************************
150 * CPUIDLE GOVERNOR INTERFACE *
151 ******************************/
152
153struct cpuidle_governor {
154 char name[CPUIDLE_NAME_LEN];
155 struct list_head governor_list;
156 unsigned int rating;
157
158 int (*enable) (struct cpuidle_device *dev);
159 void (*disable) (struct cpuidle_device *dev);
160
161 int (*select) (struct cpuidle_device *dev);
162 void (*reflect) (struct cpuidle_device *dev);
163
164 struct module *owner;
165};
166
167#ifdef CONFIG_CPU_IDLE
168
169extern int cpuidle_register_governor(struct cpuidle_governor *gov);
170extern void cpuidle_unregister_governor(struct cpuidle_governor *gov);
171
172#else
173
174static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
175{return 0;}
176static inline void cpuidle_unregister_governor(struct cpuidle_governor *gov) { }
177
178#endif
179
180#endif /* _LINUX_CPUIDLE_H */
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 9a7252e089b9..f4a1395e05ff 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -40,6 +40,7 @@ enum tick_nohz_mode {
40 * @idle_sleeps: Number of idle calls, where the sched tick was stopped 40 * @idle_sleeps: Number of idle calls, where the sched tick was stopped
41 * @idle_entrytime: Time when the idle call was entered 41 * @idle_entrytime: Time when the idle call was entered
42 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped 42 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
43 * @sleep_length: Duration of the current idle sleep
43 */ 44 */
44struct tick_sched { 45struct tick_sched {
45 struct hrtimer sched_timer; 46 struct hrtimer sched_timer;
@@ -52,6 +53,7 @@ struct tick_sched {
52 unsigned long idle_sleeps; 53 unsigned long idle_sleeps;
53 ktime_t idle_entrytime; 54 ktime_t idle_entrytime;
54 ktime_t idle_sleeptime; 55 ktime_t idle_sleeptime;
56 ktime_t sleep_length;
55 unsigned long last_jiffies; 57 unsigned long last_jiffies;
56 unsigned long next_jiffies; 58 unsigned long next_jiffies;
57 ktime_t idle_expires; 59 ktime_t idle_expires;
@@ -100,10 +102,17 @@ static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
100extern void tick_nohz_stop_sched_tick(void); 102extern void tick_nohz_stop_sched_tick(void);
101extern void tick_nohz_restart_sched_tick(void); 103extern void tick_nohz_restart_sched_tick(void);
102extern void tick_nohz_update_jiffies(void); 104extern void tick_nohz_update_jiffies(void);
105extern ktime_t tick_nohz_get_sleep_length(void);
103# else 106# else
104static inline void tick_nohz_stop_sched_tick(void) { } 107static inline void tick_nohz_stop_sched_tick(void) { }
105static inline void tick_nohz_restart_sched_tick(void) { } 108static inline void tick_nohz_restart_sched_tick(void) { }
106static inline void tick_nohz_update_jiffies(void) { } 109static inline void tick_nohz_update_jiffies(void) { }
110static inline ktime_t tick_nohz_get_sleep_length(void)
111{
112 ktime_t len = { .tv64 = NSEC_PER_SEC/HZ };
113
114 return len;
115}
107# endif /* !NO_HZ */ 116# endif /* !NO_HZ */
108 117
109#endif 118#endif