diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/acpi/acglobal.h | 4 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 5 | ||||
-rw-r--r-- | include/acpi/acpi_drivers.h | 1 | ||||
-rw-r--r-- | include/acpi/acpiosxf.h | 7 | ||||
-rw-r--r-- | include/acpi/processor.h | 13 | ||||
-rw-r--r-- | include/linux/acpi.h | 48 | ||||
-rw-r--r-- | include/linux/cpuidle.h | 26 | ||||
-rw-r--r-- | include/linux/dmi.h | 2 | ||||
-rw-r--r-- | include/linux/power_supply.h | 1 | ||||
-rw-r--r-- | include/linux/sonypi.h | 2 | ||||
-rw-r--r-- | include/linux/thermal.h | 94 |
11 files changed, 186 insertions, 17 deletions
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 347a911d8237..47a1fd8f2d8a 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h | |||
@@ -117,10 +117,6 @@ extern u32 acpi_dbg_layer; | |||
117 | 117 | ||
118 | extern u32 acpi_gbl_nesting_level; | 118 | extern u32 acpi_gbl_nesting_level; |
119 | 119 | ||
120 | /* Event counters */ | ||
121 | |||
122 | ACPI_EXTERN u32 acpi_gpe_count; | ||
123 | |||
124 | /* Support for dynamic control method tracing mechanism */ | 120 | /* Support for dynamic control method tracing mechanism */ |
125 | 121 | ||
126 | ACPI_EXTERN u32 acpi_gbl_original_dbg_level; | 122 | ACPI_EXTERN u32 acpi_gbl_original_dbg_level; |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index fb7171b1bd22..2f1c68c7a727 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -321,6 +321,11 @@ struct acpi_bus_event { | |||
321 | 321 | ||
322 | extern struct kobject *acpi_kobj; | 322 | extern struct kobject *acpi_kobj; |
323 | extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); | 323 | extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); |
324 | void acpi_bus_private_data_handler(acpi_handle, u32, void *); | ||
325 | int acpi_bus_get_private_data(acpi_handle, void **); | ||
326 | extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); | ||
327 | extern int register_acpi_notifier(struct notifier_block *); | ||
328 | extern int unregister_acpi_notifier(struct notifier_block *); | ||
324 | /* | 329 | /* |
325 | * External Functions | 330 | * External Functions |
326 | */ | 331 | */ |
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index a77196bcb993..9757a040a505 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
@@ -48,6 +48,7 @@ | |||
48 | #define ACPI_BUTTON_HID_SLEEPF "LNXSLPBN" | 48 | #define ACPI_BUTTON_HID_SLEEPF "LNXSLPBN" |
49 | #define ACPI_VIDEO_HID "LNXVIDEO" | 49 | #define ACPI_VIDEO_HID "LNXVIDEO" |
50 | #define ACPI_BAY_HID "LNXIOBAY" | 50 | #define ACPI_BAY_HID "LNXIOBAY" |
51 | #define ACPI_DOCK_HID "LNXDOCK" | ||
51 | 52 | ||
52 | /* -------------------------------------------------------------------------- | 53 | /* -------------------------------------------------------------------------- |
53 | PCI | 54 | PCI |
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index ca882b8e7d10..022a5fd80c8e 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
@@ -181,6 +181,9 @@ acpi_os_install_interrupt_handler(u32 gsi, | |||
181 | acpi_status | 181 | acpi_status |
182 | acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine); | 182 | acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine); |
183 | 183 | ||
184 | void acpi_os_gpe_count(u32 gpe_number); | ||
185 | void acpi_os_fixed_event_count(u32 fixed_event_number); | ||
186 | |||
184 | /* | 187 | /* |
185 | * Threads and Scheduling | 188 | * Threads and Scheduling |
186 | */ | 189 | */ |
@@ -239,8 +242,8 @@ acpi_status acpi_os_validate_interface(char *interface); | |||
239 | acpi_status acpi_osi_invalidate(char* interface); | 242 | acpi_status acpi_osi_invalidate(char* interface); |
240 | 243 | ||
241 | acpi_status | 244 | acpi_status |
242 | acpi_os_validate_address(u8 space_id, | 245 | acpi_os_validate_address(u8 space_id, acpi_physical_address address, |
243 | acpi_physical_address address, acpi_size length); | 246 | acpi_size length, char *name); |
244 | 247 | ||
245 | u64 acpi_os_get_timer(void); | 248 | u64 acpi_os_get_timer(void); |
246 | 249 | ||
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 6e253b5b0f3b..cdc8004cfd12 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
@@ -4,7 +4,7 @@ | |||
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 | #include <linux/cpuidle.h> |
7 | 7 | #include <linux/thermal.h> | |
8 | #include <asm/acpi.h> | 8 | #include <asm/acpi.h> |
9 | 9 | ||
10 | #define ACPI_PROCESSOR_BUSY_METRIC 10 | 10 | #define ACPI_PROCESSOR_BUSY_METRIC 10 |
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #define ACPI_CSTATE_SYSTEMIO (0) | 35 | #define ACPI_CSTATE_SYSTEMIO (0) |
36 | #define ACPI_CSTATE_FFH (1) | 36 | #define ACPI_CSTATE_FFH (1) |
37 | #define ACPI_CSTATE_HALT (2) | ||
37 | 38 | ||
38 | /* Power Management */ | 39 | /* Power Management */ |
39 | 40 | ||
@@ -64,7 +65,7 @@ struct acpi_processor_cx { | |||
64 | u8 valid; | 65 | u8 valid; |
65 | u8 type; | 66 | u8 type; |
66 | u32 address; | 67 | u32 address; |
67 | u8 space_id; | 68 | u8 entry_method; |
68 | u8 index; | 69 | u8 index; |
69 | u32 latency; | 70 | u32 latency; |
70 | u32 latency_ticks; | 71 | u32 latency_ticks; |
@@ -176,6 +177,8 @@ struct acpi_processor_throttling { | |||
176 | u32 address; | 177 | u32 address; |
177 | u8 duty_offset; | 178 | u8 duty_offset; |
178 | u8 duty_width; | 179 | u8 duty_width; |
180 | u8 tsd_valid_flag; | ||
181 | unsigned int shared_type; | ||
179 | struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING]; | 182 | struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING]; |
180 | }; | 183 | }; |
181 | 184 | ||
@@ -218,7 +221,7 @@ struct acpi_processor { | |||
218 | struct acpi_processor_performance *performance; | 221 | struct acpi_processor_performance *performance; |
219 | struct acpi_processor_throttling throttling; | 222 | struct acpi_processor_throttling throttling; |
220 | struct acpi_processor_limit limit; | 223 | struct acpi_processor_limit limit; |
221 | 224 | struct thermal_cooling_device *cdev; | |
222 | /* the _PDC objects for this processor, if any */ | 225 | /* the _PDC objects for this processor, if any */ |
223 | struct acpi_object_list *pdc; | 226 | struct acpi_object_list *pdc; |
224 | }; | 227 | }; |
@@ -316,7 +319,7 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) | |||
316 | int acpi_processor_get_throttling_info(struct acpi_processor *pr); | 319 | int acpi_processor_get_throttling_info(struct acpi_processor *pr); |
317 | extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state); | 320 | extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state); |
318 | extern struct file_operations acpi_processor_throttling_fops; | 321 | extern struct file_operations acpi_processor_throttling_fops; |
319 | 322 | extern void acpi_processor_throttling_init(void); | |
320 | /* in processor_idle.c */ | 323 | /* in processor_idle.c */ |
321 | int acpi_processor_power_init(struct acpi_processor *pr, | 324 | int acpi_processor_power_init(struct acpi_processor *pr, |
322 | struct acpi_device *device); | 325 | struct acpi_device *device); |
@@ -330,7 +333,7 @@ extern struct cpuidle_driver acpi_idle_driver; | |||
330 | /* in processor_thermal.c */ | 333 | /* in processor_thermal.c */ |
331 | int acpi_processor_get_limit_info(struct acpi_processor *pr); | 334 | int acpi_processor_get_limit_info(struct acpi_processor *pr); |
332 | extern struct file_operations acpi_processor_limit_fops; | 335 | extern struct file_operations acpi_processor_limit_fops; |
333 | 336 | extern struct thermal_cooling_device_ops processor_cooling_ops; | |
334 | #ifdef CONFIG_CPU_FREQ | 337 | #ifdef CONFIG_CPU_FREQ |
335 | void acpi_thermal_cpufreq_init(void); | 338 | void acpi_thermal_cpufreq_init(void); |
336 | void acpi_thermal_cpufreq_exit(void); | 339 | void acpi_thermal_cpufreq_exit(void); |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index ff68f13a9377..ddbe7efe590e 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #ifndef _LINUX_ACPI_H | 25 | #ifndef _LINUX_ACPI_H |
26 | #define _LINUX_ACPI_H | 26 | #define _LINUX_ACPI_H |
27 | 27 | ||
28 | #include <linux/ioport.h> /* for struct resource */ | ||
28 | 29 | ||
29 | #ifdef CONFIG_ACPI | 30 | #ifdef CONFIG_ACPI |
30 | 31 | ||
@@ -78,7 +79,6 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table); | |||
78 | typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); | 79 | typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); |
79 | 80 | ||
80 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); | 81 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); |
81 | unsigned long acpi_find_rsdp (void); | ||
82 | int acpi_boot_init (void); | 82 | int acpi_boot_init (void); |
83 | int acpi_boot_table_init (void); | 83 | int acpi_boot_table_init (void); |
84 | int acpi_numa_init (void); | 84 | int acpi_numa_init (void); |
@@ -113,6 +113,8 @@ int acpi_unmap_lsapic(int cpu); | |||
113 | 113 | ||
114 | int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base); | 114 | int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base); |
115 | int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); | 115 | int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); |
116 | void acpi_irq_stats_init(void); | ||
117 | extern u32 acpi_irq_handled; | ||
116 | 118 | ||
117 | extern struct acpi_mcfg_allocation *pci_mmcfg_config; | 119 | extern struct acpi_mcfg_allocation *pci_mmcfg_config; |
118 | extern int pci_mmcfg_config_num; | 120 | extern int pci_mmcfg_config_num; |
@@ -178,6 +180,26 @@ extern int ec_transaction(u8 command, | |||
178 | 180 | ||
179 | #endif /*CONFIG_ACPI_EC*/ | 181 | #endif /*CONFIG_ACPI_EC*/ |
180 | 182 | ||
183 | #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) | ||
184 | |||
185 | typedef void (*wmi_notify_handler) (u32 value, void *context); | ||
186 | |||
187 | extern acpi_status wmi_evaluate_method(const char *guid, u8 instance, | ||
188 | u32 method_id, | ||
189 | const struct acpi_buffer *in, | ||
190 | struct acpi_buffer *out); | ||
191 | extern acpi_status wmi_query_block(const char *guid, u8 instance, | ||
192 | struct acpi_buffer *out); | ||
193 | extern acpi_status wmi_set_block(const char *guid, u8 instance, | ||
194 | const struct acpi_buffer *in); | ||
195 | extern acpi_status wmi_install_notify_handler(const char *guid, | ||
196 | wmi_notify_handler handler, void *data); | ||
197 | extern acpi_status wmi_remove_notify_handler(const char *guid); | ||
198 | extern acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out); | ||
199 | extern bool wmi_has_guid(const char *guid); | ||
200 | |||
201 | #endif /* CONFIG_ACPI_WMI */ | ||
202 | |||
181 | extern int acpi_blacklisted(void); | 203 | extern int acpi_blacklisted(void); |
182 | #ifdef CONFIG_DMI | 204 | #ifdef CONFIG_DMI |
183 | extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); | 205 | extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); |
@@ -203,6 +225,13 @@ extern int pnpacpi_disabled; | |||
203 | #define PXM_INVAL (-1) | 225 | #define PXM_INVAL (-1) |
204 | #define NID_INVAL (-1) | 226 | #define NID_INVAL (-1) |
205 | 227 | ||
228 | int acpi_check_resource_conflict(struct resource *res); | ||
229 | |||
230 | int acpi_check_region(resource_size_t start, resource_size_t n, | ||
231 | const char *name); | ||
232 | int acpi_check_mem_region(resource_size_t start, resource_size_t n, | ||
233 | const char *name); | ||
234 | |||
206 | #else /* CONFIG_ACPI */ | 235 | #else /* CONFIG_ACPI */ |
207 | 236 | ||
208 | static inline int acpi_boot_init(void) | 237 | static inline int acpi_boot_init(void) |
@@ -215,5 +244,22 @@ static inline int acpi_boot_table_init(void) | |||
215 | return 0; | 244 | return 0; |
216 | } | 245 | } |
217 | 246 | ||
247 | static inline int acpi_check_resource_conflict(struct resource *res) | ||
248 | { | ||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static inline int acpi_check_region(resource_size_t start, resource_size_t n, | ||
253 | const char *name) | ||
254 | { | ||
255 | return 0; | ||
256 | } | ||
257 | |||
258 | static inline int acpi_check_mem_region(resource_size_t start, | ||
259 | resource_size_t n, const char *name) | ||
260 | { | ||
261 | return 0; | ||
262 | } | ||
263 | |||
218 | #endif /* !CONFIG_ACPI */ | 264 | #endif /* !CONFIG_ACPI */ |
219 | #endif /*_LINUX_ACPI_H*/ | 265 | #endif /*_LINUX_ACPI_H*/ |
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index b0fd85ab9efb..c8eb8c71809e 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h | |||
@@ -46,9 +46,10 @@ struct cpuidle_state { | |||
46 | /* Idle State Flags */ | 46 | /* Idle State Flags */ |
47 | #define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ | 47 | #define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ |
48 | #define CPUIDLE_FLAG_CHECK_BM (0x02) /* BM activity will exit state */ | 48 | #define CPUIDLE_FLAG_CHECK_BM (0x02) /* BM activity will exit state */ |
49 | #define CPUIDLE_FLAG_SHALLOW (0x10) /* low latency, minimal savings */ | 49 | #define CPUIDLE_FLAG_POLL (0x10) /* no latency, no savings */ |
50 | #define CPUIDLE_FLAG_BALANCED (0x20) /* medium latency, moderate savings */ | 50 | #define CPUIDLE_FLAG_SHALLOW (0x20) /* low latency, minimal savings */ |
51 | #define CPUIDLE_FLAG_DEEP (0x40) /* high latency, large savings */ | 51 | #define CPUIDLE_FLAG_BALANCED (0x40) /* medium latency, moderate savings */ |
52 | #define CPUIDLE_FLAG_DEEP (0x80) /* high latency, large savings */ | ||
52 | 53 | ||
53 | #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) | 54 | #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) |
54 | 55 | ||
@@ -72,6 +73,19 @@ cpuidle_set_statedata(struct cpuidle_state *state, void *data) | |||
72 | state->driver_data = data; | 73 | state->driver_data = data; |
73 | } | 74 | } |
74 | 75 | ||
76 | #ifdef CONFIG_SMP | ||
77 | #ifdef CONFIG_ARCH_HAS_CPU_IDLE_WAIT | ||
78 | static inline void cpuidle_kick_cpus(void) | ||
79 | { | ||
80 | cpu_idle_wait(); | ||
81 | } | ||
82 | #else /* !CONFIG_ARCH_HAS_CPU_IDLE_WAIT */ | ||
83 | #error "Arch needs cpu_idle_wait() equivalent here" | ||
84 | #endif /* !CONFIG_ARCH_HAS_CPU_IDLE_WAIT */ | ||
85 | #else /* !CONFIG_SMP */ | ||
86 | static inline void cpuidle_kick_cpus(void) {} | ||
87 | #endif /* !CONFIG_SMP */ | ||
88 | |||
75 | struct cpuidle_state_kobj { | 89 | struct cpuidle_state_kobj { |
76 | struct cpuidle_state *state; | 90 | struct cpuidle_state *state; |
77 | struct completion kobj_unregister; | 91 | struct completion kobj_unregister; |
@@ -178,4 +192,10 @@ static inline void cpuidle_unregister_governor(struct cpuidle_governor *gov) { } | |||
178 | 192 | ||
179 | #endif | 193 | #endif |
180 | 194 | ||
195 | #ifdef CONFIG_ARCH_HAS_CPU_RELAX | ||
196 | #define CPUIDLE_DRIVER_STATE_START 1 | ||
197 | #else | ||
198 | #define CPUIDLE_DRIVER_STATE_START 0 | ||
199 | #endif | ||
200 | |||
181 | #endif /* _LINUX_CPUIDLE_H */ | 201 | #endif /* _LINUX_CPUIDLE_H */ |
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index 5b42a659a308..b1251b2af568 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
@@ -79,7 +79,6 @@ extern void dmi_scan_machine(void); | |||
79 | extern int dmi_get_year(int field); | 79 | extern int dmi_get_year(int field); |
80 | extern int dmi_name_in_vendors(const char *str); | 80 | extern int dmi_name_in_vendors(const char *str); |
81 | extern int dmi_available; | 81 | extern int dmi_available; |
82 | extern char *dmi_get_slot(int slot); | ||
83 | 82 | ||
84 | #else | 83 | #else |
85 | 84 | ||
@@ -90,7 +89,6 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na | |||
90 | static inline int dmi_get_year(int year) { return 0; } | 89 | static inline int dmi_get_year(int year) { return 0; } |
91 | static inline int dmi_name_in_vendors(const char *s) { return 0; } | 90 | static inline int dmi_name_in_vendors(const char *s) { return 0; } |
92 | #define dmi_available 0 | 91 | #define dmi_available 0 |
93 | static inline char *dmi_get_slot(int slot) { return NULL; } | ||
94 | 92 | ||
95 | #endif | 93 | #endif |
96 | 94 | ||
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 5cbf3e371012..68ed19ccf1f7 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
@@ -94,6 +94,7 @@ enum power_supply_property { | |||
94 | /* Properties of type `const char *' */ | 94 | /* Properties of type `const char *' */ |
95 | POWER_SUPPLY_PROP_MODEL_NAME, | 95 | POWER_SUPPLY_PROP_MODEL_NAME, |
96 | POWER_SUPPLY_PROP_MANUFACTURER, | 96 | POWER_SUPPLY_PROP_MANUFACTURER, |
97 | POWER_SUPPLY_PROP_SERIAL_NUMBER, | ||
97 | }; | 98 | }; |
98 | 99 | ||
99 | enum power_supply_type { | 100 | enum power_supply_type { |
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h index 40c7b5d993b9..f41ffd7c2dd9 100644 --- a/include/linux/sonypi.h +++ b/include/linux/sonypi.h | |||
@@ -101,6 +101,8 @@ | |||
101 | #define SONYPI_EVENT_FNKEY_RELEASED 59 | 101 | #define SONYPI_EVENT_FNKEY_RELEASED 59 |
102 | #define SONYPI_EVENT_WIRELESS_ON 60 | 102 | #define SONYPI_EVENT_WIRELESS_ON 60 |
103 | #define SONYPI_EVENT_WIRELESS_OFF 61 | 103 | #define SONYPI_EVENT_WIRELESS_OFF 61 |
104 | #define SONYPI_EVENT_ZOOM_IN_PRESSED 62 | ||
105 | #define SONYPI_EVENT_ZOOM_OUT_PRESSED 63 | ||
104 | 106 | ||
105 | /* get/set brightness */ | 107 | /* get/set brightness */ |
106 | #define SONYPI_IOCGBRT _IOR('v', 0, __u8) | 108 | #define SONYPI_IOCGBRT _IOR('v', 0, __u8) |
diff --git a/include/linux/thermal.h b/include/linux/thermal.h new file mode 100644 index 000000000000..bba7712cadc7 --- /dev/null +++ b/include/linux/thermal.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * thermal.h ($Revision: 0 $) | ||
3 | * | ||
4 | * Copyright (C) 2008 Intel Corp | ||
5 | * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com> | ||
6 | * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com> | ||
7 | * | ||
8 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; version 2 of the License. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
21 | * | ||
22 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
23 | */ | ||
24 | |||
25 | #ifndef __THERMAL_H__ | ||
26 | #define __THERMAL_H__ | ||
27 | |||
28 | #include <linux/idr.h> | ||
29 | #include <linux/device.h> | ||
30 | |||
31 | struct thermal_zone_device; | ||
32 | struct thermal_cooling_device; | ||
33 | |||
34 | struct thermal_zone_device_ops { | ||
35 | int (*bind) (struct thermal_zone_device *, | ||
36 | struct thermal_cooling_device *); | ||
37 | int (*unbind) (struct thermal_zone_device *, | ||
38 | struct thermal_cooling_device *); | ||
39 | int (*get_temp) (struct thermal_zone_device *, char *); | ||
40 | int (*get_mode) (struct thermal_zone_device *, char *); | ||
41 | int (*set_mode) (struct thermal_zone_device *, const char *); | ||
42 | int (*get_trip_type) (struct thermal_zone_device *, int, char *); | ||
43 | int (*get_trip_temp) (struct thermal_zone_device *, int, char *); | ||
44 | }; | ||
45 | |||
46 | struct thermal_cooling_device_ops { | ||
47 | int (*get_max_state) (struct thermal_cooling_device *, char *); | ||
48 | int (*get_cur_state) (struct thermal_cooling_device *, char *); | ||
49 | int (*set_cur_state) (struct thermal_cooling_device *, unsigned int); | ||
50 | }; | ||
51 | |||
52 | #define THERMAL_TRIPS_NONE -1 | ||
53 | #define THERMAL_MAX_TRIPS 10 | ||
54 | #define THERMAL_NAME_LENGTH 20 | ||
55 | struct thermal_cooling_device { | ||
56 | int id; | ||
57 | char type[THERMAL_NAME_LENGTH]; | ||
58 | struct device device; | ||
59 | void *devdata; | ||
60 | struct thermal_cooling_device_ops *ops; | ||
61 | struct list_head node; | ||
62 | }; | ||
63 | |||
64 | #define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ | ||
65 | ((long)t-2732+5)/10 : ((long)t-2732-5)/10) | ||
66 | #define CELSIUS_TO_KELVIN(t) ((t)*10+2732) | ||
67 | |||
68 | struct thermal_zone_device { | ||
69 | int id; | ||
70 | char type[THERMAL_NAME_LENGTH]; | ||
71 | struct device device; | ||
72 | void *devdata; | ||
73 | int trips; | ||
74 | struct thermal_zone_device_ops *ops; | ||
75 | struct list_head cooling_devices; | ||
76 | struct idr idr; | ||
77 | struct mutex lock; /* protect cooling devices list */ | ||
78 | struct list_head node; | ||
79 | }; | ||
80 | |||
81 | struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, | ||
82 | struct thermal_zone_device_ops *); | ||
83 | void thermal_zone_device_unregister(struct thermal_zone_device *); | ||
84 | |||
85 | int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, | ||
86 | struct thermal_cooling_device *); | ||
87 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, | ||
88 | struct thermal_cooling_device *); | ||
89 | |||
90 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, | ||
91 | struct thermal_cooling_device_ops *); | ||
92 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); | ||
93 | |||
94 | #endif /* __THERMAL_H__ */ | ||