diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/acpi/acconfig.h | 1 | ||||
-rw-r--r-- | include/acpi/acexcep.h | 2 | ||||
-rw-r--r-- | include/acpi/acnames.h | 1 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 78 | ||||
-rw-r--r-- | include/acpi/acpiosxf.h | 3 | ||||
-rw-r--r-- | include/acpi/acpixf.h | 18 | ||||
-rw-r--r-- | include/acpi/actbl3.h | 22 | ||||
-rw-r--r-- | include/acpi/actypes.h | 42 | ||||
-rw-r--r-- | include/linux/acpi.h | 135 | ||||
-rw-r--r-- | include/linux/acpi_gpio.h | 19 | ||||
-rw-r--r-- | include/linux/cpufreq.h | 5 | ||||
-rw-r--r-- | include/linux/cpuidle.h | 15 | ||||
-rw-r--r-- | include/linux/devfreq.h | 136 | ||||
-rw-r--r-- | include/linux/device.h | 18 | ||||
-rw-r--r-- | include/linux/freezer.h | 1 | ||||
-rw-r--r-- | include/linux/i2c.h | 9 | ||||
-rw-r--r-- | include/linux/platform_device.h | 1 | ||||
-rw-r--r-- | include/linux/pm.h | 3 | ||||
-rw-r--r-- | include/linux/pm_qos.h | 77 | ||||
-rw-r--r-- | include/linux/tick.h | 6 |
20 files changed, 461 insertions, 131 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 03f14856bd09..0943457e0fa5 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h | |||
@@ -241,6 +241,7 @@ | |||
241 | *****************************************************************************/ | 241 | *****************************************************************************/ |
242 | 242 | ||
243 | #define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ | 243 | #define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ |
244 | #define ACPI_DB_LINE_BUFFER_SIZE 512 | ||
244 | 245 | ||
245 | #define ACPI_DEBUGGER_COMMAND_PROMPT '-' | 246 | #define ACPI_DEBUGGER_COMMAND_PROMPT '-' |
246 | #define ACPI_DEBUGGER_EXECUTE_PROMPT '%' | 247 | #define ACPI_DEBUGGER_EXECUTE_PROMPT '%' |
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 19503449814f..6c3890e02140 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h | |||
@@ -122,7 +122,7 @@ | |||
122 | #define AE_CODE_TBL_MAX 0x0005 | 122 | #define AE_CODE_TBL_MAX 0x0005 |
123 | 123 | ||
124 | /* | 124 | /* |
125 | * AML exceptions. These are caused by problems with | 125 | * AML exceptions. These are caused by problems with |
126 | * the actual AML byte stream | 126 | * the actual AML byte stream |
127 | */ | 127 | */ |
128 | #define AE_AML_BAD_OPCODE (acpi_status) (0x0001 | AE_CODE_AML) | 128 | #define AE_AML_BAD_OPCODE (acpi_status) (0x0001 | AE_CODE_AML) |
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index 745dd24e3cb5..7665df663284 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h | |||
@@ -50,6 +50,7 @@ | |||
50 | #define METHOD_NAME__HID "_HID" | 50 | #define METHOD_NAME__HID "_HID" |
51 | #define METHOD_NAME__CID "_CID" | 51 | #define METHOD_NAME__CID "_CID" |
52 | #define METHOD_NAME__UID "_UID" | 52 | #define METHOD_NAME__UID "_UID" |
53 | #define METHOD_NAME__SUB "_SUB" | ||
53 | #define METHOD_NAME__ADR "_ADR" | 54 | #define METHOD_NAME__ADR "_ADR" |
54 | #define METHOD_NAME__INI "_INI" | 55 | #define METHOD_NAME__INI "_INI" |
55 | #define METHOD_NAME__STA "_STA" | 56 | #define METHOD_NAME__STA "_STA" |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 0daa0fbd8654..7ced5dc20dd3 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -144,12 +144,11 @@ struct acpi_device_flags { | |||
144 | u32 bus_address:1; | 144 | u32 bus_address:1; |
145 | u32 removable:1; | 145 | u32 removable:1; |
146 | u32 ejectable:1; | 146 | u32 ejectable:1; |
147 | u32 lockable:1; | ||
148 | u32 suprise_removal_ok:1; | 147 | u32 suprise_removal_ok:1; |
149 | u32 power_manageable:1; | 148 | u32 power_manageable:1; |
150 | u32 performance_manageable:1; | 149 | u32 performance_manageable:1; |
151 | u32 eject_pending:1; | 150 | u32 eject_pending:1; |
152 | u32 reserved:23; | 151 | u32 reserved:24; |
153 | }; | 152 | }; |
154 | 153 | ||
155 | /* File System */ | 154 | /* File System */ |
@@ -180,6 +179,7 @@ struct acpi_device_pnp { | |||
180 | acpi_device_name device_name; /* Driver-determined */ | 179 | acpi_device_name device_name; /* Driver-determined */ |
181 | acpi_device_class device_class; /* " */ | 180 | acpi_device_class device_class; /* " */ |
182 | union acpi_object *str_obj; /* unicode string for _STR method */ | 181 | union acpi_object *str_obj; /* unicode string for _STR method */ |
182 | unsigned long sun; /* _SUN */ | ||
183 | }; | 183 | }; |
184 | 184 | ||
185 | #define acpi_device_bid(d) ((d)->pnp.bus_id) | 185 | #define acpi_device_bid(d) ((d)->pnp.bus_id) |
@@ -201,6 +201,7 @@ struct acpi_device_power_flags { | |||
201 | struct acpi_device_power_state { | 201 | struct acpi_device_power_state { |
202 | struct { | 202 | struct { |
203 | u8 valid:1; | 203 | u8 valid:1; |
204 | u8 os_accessible:1; | ||
204 | u8 explicit_set:1; /* _PSx present? */ | 205 | u8 explicit_set:1; /* _PSx present? */ |
205 | u8 reserved:6; | 206 | u8 reserved:6; |
206 | } flags; | 207 | } flags; |
@@ -339,6 +340,7 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle, | |||
339 | unsigned long long *sta); | 340 | unsigned long long *sta); |
340 | int acpi_bus_get_status(struct acpi_device *device); | 341 | int acpi_bus_get_status(struct acpi_device *device); |
341 | int acpi_bus_set_power(acpi_handle handle, int state); | 342 | int acpi_bus_set_power(acpi_handle handle, int state); |
343 | int acpi_device_set_power(struct acpi_device *device, int state); | ||
342 | int acpi_bus_update_power(acpi_handle handle, int *state_p); | 344 | int acpi_bus_update_power(acpi_handle handle, int *state_p); |
343 | bool acpi_bus_power_manageable(acpi_handle handle); | 345 | bool acpi_bus_power_manageable(acpi_handle handle); |
344 | bool acpi_bus_can_wakeup(acpi_handle handle); | 346 | bool acpi_bus_can_wakeup(acpi_handle handle); |
@@ -410,36 +412,100 @@ acpi_handle acpi_get_child(acpi_handle, u64); | |||
410 | int acpi_is_root_bridge(acpi_handle); | 412 | int acpi_is_root_bridge(acpi_handle); |
411 | acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); | 413 | acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); |
412 | struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); | 414 | struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); |
413 | #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle)) | 415 | #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev)) |
414 | 416 | ||
415 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); | 417 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); |
416 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); | 418 | int acpi_disable_wakeup_device_power(struct acpi_device *dev); |
417 | 419 | ||
418 | #ifdef CONFIG_PM | 420 | #ifdef CONFIG_PM |
421 | acpi_status acpi_add_pm_notifier(struct acpi_device *adev, | ||
422 | acpi_notify_handler handler, void *context); | ||
423 | acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, | ||
424 | acpi_notify_handler handler); | ||
425 | int acpi_device_power_state(struct device *dev, struct acpi_device *adev, | ||
426 | u32 target_state, int d_max_in, int *d_min_p); | ||
419 | int acpi_pm_device_sleep_state(struct device *, int *, int); | 427 | int acpi_pm_device_sleep_state(struct device *, int *, int); |
420 | #else | 428 | #else |
421 | static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m) | 429 | static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev, |
430 | acpi_notify_handler handler, | ||
431 | void *context) | ||
432 | { | ||
433 | return AE_SUPPORT; | ||
434 | } | ||
435 | static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, | ||
436 | acpi_notify_handler handler) | ||
437 | { | ||
438 | return AE_SUPPORT; | ||
439 | } | ||
440 | static inline int __acpi_device_power_state(int m, int *p) | ||
422 | { | 441 | { |
423 | if (p) | 442 | if (p) |
424 | *p = ACPI_STATE_D0; | 443 | *p = ACPI_STATE_D0; |
425 | return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0; | 444 | return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0; |
426 | } | 445 | } |
446 | static inline int acpi_device_power_state(struct device *dev, | ||
447 | struct acpi_device *adev, | ||
448 | u32 target_state, int d_max_in, | ||
449 | int *d_min_p) | ||
450 | { | ||
451 | return __acpi_device_power_state(d_max_in, d_min_p); | ||
452 | } | ||
453 | static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m) | ||
454 | { | ||
455 | return __acpi_device_power_state(m, p); | ||
456 | } | ||
427 | #endif | 457 | #endif |
428 | 458 | ||
429 | #ifdef CONFIG_PM_SLEEP | 459 | #ifdef CONFIG_PM_RUNTIME |
460 | int __acpi_device_run_wake(struct acpi_device *, bool); | ||
430 | int acpi_pm_device_run_wake(struct device *, bool); | 461 | int acpi_pm_device_run_wake(struct device *, bool); |
431 | int acpi_pm_device_sleep_wake(struct device *, bool); | ||
432 | #else | 462 | #else |
463 | static inline int __acpi_device_run_wake(struct acpi_device *adev, bool en) | ||
464 | { | ||
465 | return -ENODEV; | ||
466 | } | ||
433 | static inline int acpi_pm_device_run_wake(struct device *dev, bool enable) | 467 | static inline int acpi_pm_device_run_wake(struct device *dev, bool enable) |
434 | { | 468 | { |
435 | return -ENODEV; | 469 | return -ENODEV; |
436 | } | 470 | } |
471 | #endif | ||
472 | |||
473 | #ifdef CONFIG_PM_SLEEP | ||
474 | int __acpi_device_sleep_wake(struct acpi_device *, u32, bool); | ||
475 | int acpi_pm_device_sleep_wake(struct device *, bool); | ||
476 | #else | ||
477 | static inline int __acpi_device_sleep_wake(struct acpi_device *adev, | ||
478 | u32 target_state, bool enable) | ||
479 | { | ||
480 | return -ENODEV; | ||
481 | } | ||
437 | static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | 482 | static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) |
438 | { | 483 | { |
439 | return -ENODEV; | 484 | return -ENODEV; |
440 | } | 485 | } |
441 | #endif | 486 | #endif |
442 | 487 | ||
488 | #ifdef CONFIG_ACPI_SLEEP | ||
489 | u32 acpi_target_system_state(void); | ||
490 | #else | ||
491 | static inline u32 acpi_target_system_state(void) { return ACPI_STATE_S0; } | ||
492 | #endif | ||
493 | |||
494 | static inline bool acpi_device_power_manageable(struct acpi_device *adev) | ||
495 | { | ||
496 | return adev->flags.power_manageable; | ||
497 | } | ||
498 | |||
499 | static inline bool acpi_device_can_wakeup(struct acpi_device *adev) | ||
500 | { | ||
501 | return adev->wakeup.flags.valid; | ||
502 | } | ||
503 | |||
504 | static inline bool acpi_device_can_poweroff(struct acpi_device *adev) | ||
505 | { | ||
506 | return adev->power.states[ACPI_STATE_D3_COLD].flags.os_accessible; | ||
507 | } | ||
508 | |||
443 | #else /* CONFIG_ACPI */ | 509 | #else /* CONFIG_ACPI */ |
444 | 510 | ||
445 | static inline int register_acpi_bus_type(void *bus) { return 0; } | 511 | static inline int register_acpi_bus_type(void *bus) { return 0; } |
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 1222ba93d80a..43152742b46f 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
@@ -1,7 +1,6 @@ | |||
1 | |||
2 | /****************************************************************************** | 1 | /****************************************************************************** |
3 | * | 2 | * |
4 | * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These | 3 | * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These |
5 | * interfaces must be implemented by OSL to interface the | 4 | * interfaces must be implemented by OSL to interface the |
6 | * ACPI components to the host operating system. | 5 | * ACPI components to the host operating system. |
7 | * | 6 | * |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 8b891dbead66..3d88395d4d6f 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /****************************************************************************** | 1 | /****************************************************************************** |
3 | * | 2 | * |
4 | * Name: acpixf.h - External interfaces to the ACPI subsystem | 3 | * Name: acpixf.h - External interfaces to the ACPI subsystem |
@@ -47,7 +46,7 @@ | |||
47 | 46 | ||
48 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 47 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
49 | 48 | ||
50 | #define ACPI_CA_VERSION 0x20120913 | 49 | #define ACPI_CA_VERSION 0x20121018 |
51 | 50 | ||
52 | #include <acpi/acconfig.h> | 51 | #include <acpi/acconfig.h> |
53 | #include <acpi/actypes.h> | 52 | #include <acpi/actypes.h> |
@@ -178,8 +177,7 @@ acpi_status acpi_unload_table_id(acpi_owner_id id); | |||
178 | 177 | ||
179 | acpi_status | 178 | acpi_status |
180 | acpi_get_table_header(acpi_string signature, | 179 | acpi_get_table_header(acpi_string signature, |
181 | u32 instance, | 180 | u32 instance, struct acpi_table_header *out_table_header); |
182 | struct acpi_table_header *out_table_header); | ||
183 | 181 | ||
184 | acpi_status | 182 | acpi_status |
185 | acpi_get_table_with_size(acpi_string signature, | 183 | acpi_get_table_with_size(acpi_string signature, |
@@ -190,8 +188,7 @@ acpi_get_table(acpi_string signature, | |||
190 | u32 instance, struct acpi_table_header **out_table); | 188 | u32 instance, struct acpi_table_header **out_table); |
191 | 189 | ||
192 | acpi_status | 190 | acpi_status |
193 | acpi_get_table_by_index(u32 table_index, | 191 | acpi_get_table_by_index(u32 table_index, struct acpi_table_header **out_table); |
194 | struct acpi_table_header **out_table); | ||
195 | 192 | ||
196 | acpi_status | 193 | acpi_status |
197 | acpi_install_table_handler(acpi_tbl_handler handler, void *context); | 194 | acpi_install_table_handler(acpi_tbl_handler handler, void *context); |
@@ -274,7 +271,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function); | |||
274 | 271 | ||
275 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | 272 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
276 | acpi_install_global_event_handler | 273 | acpi_install_global_event_handler |
277 | (ACPI_GBL_EVENT_HANDLER handler, void *context)) | 274 | (acpi_gbl_event_handler handler, void *context)) |
278 | 275 | ||
279 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | 276 | ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
280 | acpi_install_fixed_event_handler(u32 | 277 | acpi_install_fixed_event_handler(u32 |
@@ -300,10 +297,9 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status | |||
300 | u32 gpe_number, | 297 | u32 gpe_number, |
301 | acpi_gpe_handler | 298 | acpi_gpe_handler |
302 | address)) | 299 | address)) |
303 | acpi_status | 300 | acpi_status acpi_install_notify_handler(acpi_handle device, u32 handler_type, |
304 | acpi_install_notify_handler(acpi_handle device, | 301 | acpi_notify_handler handler, |
305 | u32 handler_type, | 302 | void *context); |
306 | acpi_notify_handler handler, void *context); | ||
307 | 303 | ||
308 | acpi_status | 304 | acpi_status |
309 | acpi_remove_notify_handler(acpi_handle device, | 305 | acpi_remove_notify_handler(acpi_handle device, |
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h index 8c61b5fe42a4..6585141e4b97 100644 --- a/include/acpi/actbl3.h +++ b/include/acpi/actbl3.h | |||
@@ -277,10 +277,10 @@ struct acpi_table_gtdt { | |||
277 | ******************************************************************************/ | 277 | ******************************************************************************/ |
278 | 278 | ||
279 | #define ACPI_MPST_CHANNEL_INFO \ | 279 | #define ACPI_MPST_CHANNEL_INFO \ |
280 | u16 reserved1; \ | ||
281 | u8 channel_id; \ | 280 | u8 channel_id; \ |
282 | u8 reserved2; \ | 281 | u8 reserved1[3]; \ |
283 | u16 power_node_count; | 282 | u16 power_node_count; \ |
283 | u16 reserved2; | ||
284 | 284 | ||
285 | /* Main table */ | 285 | /* Main table */ |
286 | 286 | ||
@@ -304,9 +304,8 @@ struct acpi_mpst_power_node { | |||
304 | u32 length; | 304 | u32 length; |
305 | u64 range_address; | 305 | u64 range_address; |
306 | u64 range_length; | 306 | u64 range_length; |
307 | u8 num_power_states; | 307 | u32 num_power_states; |
308 | u8 num_physical_components; | 308 | u32 num_physical_components; |
309 | u16 reserved2; | ||
310 | }; | 309 | }; |
311 | 310 | ||
312 | /* Values for Flags field above */ | 311 | /* Values for Flags field above */ |
@@ -332,10 +331,11 @@ struct acpi_mpst_component { | |||
332 | 331 | ||
333 | struct acpi_mpst_data_hdr { | 332 | struct acpi_mpst_data_hdr { |
334 | u16 characteristics_count; | 333 | u16 characteristics_count; |
334 | u16 reserved; | ||
335 | }; | 335 | }; |
336 | 336 | ||
337 | struct acpi_mpst_power_data { | 337 | struct acpi_mpst_power_data { |
338 | u8 revision; | 338 | u8 structure_id; |
339 | u8 flags; | 339 | u8 flags; |
340 | u16 reserved1; | 340 | u16 reserved1; |
341 | u32 average_power; | 341 | u32 average_power; |
@@ -356,10 +356,10 @@ struct acpi_mpst_shared { | |||
356 | u32 signature; | 356 | u32 signature; |
357 | u16 pcc_command; | 357 | u16 pcc_command; |
358 | u16 pcc_status; | 358 | u16 pcc_status; |
359 | u16 command_register; | 359 | u32 command_register; |
360 | u16 status_register; | 360 | u32 status_register; |
361 | u16 power_state_id; | 361 | u32 power_state_id; |
362 | u16 power_node_id; | 362 | u32 power_node_id; |
363 | u64 energy_consumed; | 363 | u64 energy_consumed; |
364 | u64 average_power; | 364 | u64 average_power; |
365 | }; | 365 | }; |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index a85bae968262..4f43f1fba132 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -453,10 +453,14 @@ typedef u64 acpi_integer; | |||
453 | #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) | 453 | #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) |
454 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) | 454 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) |
455 | 455 | ||
456 | /* Optimizations for 4-character (32-bit) acpi_name manipulation */ | ||
457 | |||
456 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED | 458 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED |
457 | #define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b))) | 459 | #define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b))) |
460 | #define ACPI_MOVE_NAME(dest,src) (*ACPI_CAST_PTR (u32, (dest)) = *ACPI_CAST_PTR (u32, (src))) | ||
458 | #else | 461 | #else |
459 | #define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) | 462 | #define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) |
463 | #define ACPI_MOVE_NAME(dest,src) (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE)) | ||
460 | #endif | 464 | #endif |
461 | 465 | ||
462 | /******************************************************************************* | 466 | /******************************************************************************* |
@@ -796,11 +800,11 @@ typedef u8 acpi_adr_space_type; | |||
796 | 800 | ||
797 | /* Sleep function dispatch */ | 801 | /* Sleep function dispatch */ |
798 | 802 | ||
799 | typedef acpi_status(*ACPI_SLEEP_FUNCTION) (u8 sleep_state); | 803 | typedef acpi_status(*acpi_sleep_function) (u8 sleep_state); |
800 | 804 | ||
801 | struct acpi_sleep_functions { | 805 | struct acpi_sleep_functions { |
802 | ACPI_SLEEP_FUNCTION legacy_function; | 806 | acpi_sleep_function legacy_function; |
803 | ACPI_SLEEP_FUNCTION extended_function; | 807 | acpi_sleep_function extended_function; |
804 | }; | 808 | }; |
805 | 809 | ||
806 | /* | 810 | /* |
@@ -922,7 +926,8 @@ struct acpi_system_info { | |||
922 | /* | 926 | /* |
923 | * Types specific to the OS service interfaces | 927 | * Types specific to the OS service interfaces |
924 | */ | 928 | */ |
925 | typedef u32(ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context); | 929 | typedef u32 |
930 | (ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context); | ||
926 | 931 | ||
927 | typedef void | 932 | typedef void |
928 | (ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context); | 933 | (ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context); |
@@ -931,14 +936,15 @@ typedef void | |||
931 | * Various handlers and callback procedures | 936 | * Various handlers and callback procedures |
932 | */ | 937 | */ |
933 | typedef | 938 | typedef |
934 | void (*ACPI_GBL_EVENT_HANDLER) (u32 event_type, | 939 | void (*acpi_gbl_event_handler) (u32 event_type, |
935 | acpi_handle device, | 940 | acpi_handle device, |
936 | u32 event_number, void *context); | 941 | u32 event_number, void *context); |
937 | 942 | ||
938 | #define ACPI_EVENT_TYPE_GPE 0 | 943 | #define ACPI_EVENT_TYPE_GPE 0 |
939 | #define ACPI_EVENT_TYPE_FIXED 1 | 944 | #define ACPI_EVENT_TYPE_FIXED 1 |
940 | 945 | ||
941 | typedef u32(*acpi_event_handler) (void *context); | 946 | typedef |
947 | u32(*acpi_event_handler) (void *context); | ||
942 | 948 | ||
943 | typedef | 949 | typedef |
944 | u32 (*acpi_gpe_handler) (acpi_handle gpe_device, u32 gpe_number, void *context); | 950 | u32 (*acpi_gpe_handler) (acpi_handle gpe_device, u32 gpe_number, void *context); |
@@ -1018,17 +1024,17 @@ u32 (*acpi_interface_handler) (acpi_string interface_name, u32 supported); | |||
1018 | 1024 | ||
1019 | #define ACPI_UUID_LENGTH 16 | 1025 | #define ACPI_UUID_LENGTH 16 |
1020 | 1026 | ||
1021 | /* Structures used for device/processor HID, UID, CID */ | 1027 | /* Structures used for device/processor HID, UID, CID, and SUB */ |
1022 | 1028 | ||
1023 | struct acpica_device_id { | 1029 | struct acpi_pnp_device_id { |
1024 | u32 length; /* Length of string + null */ | 1030 | u32 length; /* Length of string + null */ |
1025 | char *string; | 1031 | char *string; |
1026 | }; | 1032 | }; |
1027 | 1033 | ||
1028 | struct acpica_device_id_list { | 1034 | struct acpi_pnp_device_id_list { |
1029 | u32 count; /* Number of IDs in Ids array */ | 1035 | u32 count; /* Number of IDs in Ids array */ |
1030 | u32 list_size; /* Size of list, including ID strings */ | 1036 | u32 list_size; /* Size of list, including ID strings */ |
1031 | struct acpica_device_id ids[1]; /* ID array */ | 1037 | struct acpi_pnp_device_id ids[1]; /* ID array */ |
1032 | }; | 1038 | }; |
1033 | 1039 | ||
1034 | /* | 1040 | /* |
@@ -1046,9 +1052,10 @@ struct acpi_device_info { | |||
1046 | u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ | 1052 | u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ |
1047 | u32 current_status; /* _STA value */ | 1053 | u32 current_status; /* _STA value */ |
1048 | u64 address; /* _ADR value */ | 1054 | u64 address; /* _ADR value */ |
1049 | struct acpica_device_id hardware_id; /* _HID value */ | 1055 | struct acpi_pnp_device_id hardware_id; /* _HID value */ |
1050 | struct acpica_device_id unique_id; /* _UID value */ | 1056 | struct acpi_pnp_device_id unique_id; /* _UID value */ |
1051 | struct acpica_device_id_list compatible_id_list; /* _CID list <must be last> */ | 1057 | struct acpi_pnp_device_id subsystem_id; /* _SUB value */ |
1058 | struct acpi_pnp_device_id_list compatible_id_list; /* _CID list <must be last> */ | ||
1052 | }; | 1059 | }; |
1053 | 1060 | ||
1054 | /* Values for Flags field above (acpi_get_object_info) */ | 1061 | /* Values for Flags field above (acpi_get_object_info) */ |
@@ -1061,11 +1068,12 @@ struct acpi_device_info { | |||
1061 | #define ACPI_VALID_ADR 0x02 | 1068 | #define ACPI_VALID_ADR 0x02 |
1062 | #define ACPI_VALID_HID 0x04 | 1069 | #define ACPI_VALID_HID 0x04 |
1063 | #define ACPI_VALID_UID 0x08 | 1070 | #define ACPI_VALID_UID 0x08 |
1064 | #define ACPI_VALID_CID 0x10 | 1071 | #define ACPI_VALID_SUB 0x10 |
1065 | #define ACPI_VALID_SXDS 0x20 | 1072 | #define ACPI_VALID_CID 0x20 |
1066 | #define ACPI_VALID_SXWS 0x40 | 1073 | #define ACPI_VALID_SXDS 0x40 |
1074 | #define ACPI_VALID_SXWS 0x80 | ||
1067 | 1075 | ||
1068 | /* Flags for _STA method */ | 1076 | /* Flags for _STA return value (current_status above) */ |
1069 | 1077 | ||
1070 | #define ACPI_STA_DEVICE_PRESENT 0x01 | 1078 | #define ACPI_STA_DEVICE_PRESENT 0x01 |
1071 | #define ACPI_STA_DEVICE_ENABLED 0x02 | 1079 | #define ACPI_STA_DEVICE_ENABLED 0x02 |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 90be98981102..c33fa3ce9b7c 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -25,7 +25,9 @@ | |||
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/errno.h> | ||
28 | #include <linux/ioport.h> /* for struct resource */ | 29 | #include <linux/ioport.h> /* for struct resource */ |
30 | #include <linux/device.h> | ||
29 | 31 | ||
30 | #ifdef CONFIG_ACPI | 32 | #ifdef CONFIG_ACPI |
31 | 33 | ||
@@ -250,6 +252,26 @@ extern int pnpacpi_disabled; | |||
250 | 252 | ||
251 | #define PXM_INVAL (-1) | 253 | #define PXM_INVAL (-1) |
252 | 254 | ||
255 | bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res); | ||
256 | bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res); | ||
257 | bool acpi_dev_resource_address_space(struct acpi_resource *ares, | ||
258 | struct resource *res); | ||
259 | bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares, | ||
260 | struct resource *res); | ||
261 | unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable); | ||
262 | bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, | ||
263 | struct resource *res); | ||
264 | |||
265 | struct resource_list_entry { | ||
266 | struct list_head node; | ||
267 | struct resource res; | ||
268 | }; | ||
269 | |||
270 | void acpi_dev_free_resource_list(struct list_head *list); | ||
271 | int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list, | ||
272 | int (*preproc)(struct acpi_resource *, void *), | ||
273 | void *preproc_data); | ||
274 | |||
253 | int acpi_check_resource_conflict(const struct resource *res); | 275 | int acpi_check_resource_conflict(const struct resource *res); |
254 | 276 | ||
255 | int acpi_check_region(resource_size_t start, resource_size_t n, | 277 | int acpi_check_region(resource_size_t start, resource_size_t n, |
@@ -257,10 +279,14 @@ int acpi_check_region(resource_size_t start, resource_size_t n, | |||
257 | 279 | ||
258 | int acpi_resources_are_enforced(void); | 280 | int acpi_resources_are_enforced(void); |
259 | 281 | ||
260 | #ifdef CONFIG_PM_SLEEP | 282 | #ifdef CONFIG_HIBERNATION |
261 | void __init acpi_no_s4_hw_signature(void); | 283 | void __init acpi_no_s4_hw_signature(void); |
284 | #endif | ||
285 | |||
286 | #ifdef CONFIG_PM_SLEEP | ||
262 | void __init acpi_old_suspend_ordering(void); | 287 | void __init acpi_old_suspend_ordering(void); |
263 | void __init acpi_nvs_nosave(void); | 288 | void __init acpi_nvs_nosave(void); |
289 | void __init acpi_nvs_nosave_s3(void); | ||
264 | #endif /* CONFIG_PM_SLEEP */ | 290 | #endif /* CONFIG_PM_SLEEP */ |
265 | 291 | ||
266 | struct acpi_osc_context { | 292 | struct acpi_osc_context { |
@@ -364,6 +390,17 @@ extern int acpi_nvs_register(__u64 start, __u64 size); | |||
364 | extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), | 390 | extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), |
365 | void *data); | 391 | void *data); |
366 | 392 | ||
393 | const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, | ||
394 | const struct device *dev); | ||
395 | |||
396 | static inline bool acpi_driver_match_device(struct device *dev, | ||
397 | const struct device_driver *drv) | ||
398 | { | ||
399 | return !!acpi_match_device(drv->acpi_match_table, dev); | ||
400 | } | ||
401 | |||
402 | #define ACPI_PTR(_ptr) (_ptr) | ||
403 | |||
367 | #else /* !CONFIG_ACPI */ | 404 | #else /* !CONFIG_ACPI */ |
368 | 405 | ||
369 | #define acpi_disabled 1 | 406 | #define acpi_disabled 1 |
@@ -418,6 +455,22 @@ static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), | |||
418 | return 0; | 455 | return 0; |
419 | } | 456 | } |
420 | 457 | ||
458 | struct acpi_device_id; | ||
459 | |||
460 | static inline const struct acpi_device_id *acpi_match_device( | ||
461 | const struct acpi_device_id *ids, const struct device *dev) | ||
462 | { | ||
463 | return NULL; | ||
464 | } | ||
465 | |||
466 | static inline bool acpi_driver_match_device(struct device *dev, | ||
467 | const struct device_driver *drv) | ||
468 | { | ||
469 | return false; | ||
470 | } | ||
471 | |||
472 | #define ACPI_PTR(_ptr) (NULL) | ||
473 | |||
421 | #endif /* !CONFIG_ACPI */ | 474 | #endif /* !CONFIG_ACPI */ |
422 | 475 | ||
423 | #ifdef CONFIG_ACPI | 476 | #ifdef CONFIG_ACPI |
@@ -430,4 +483,84 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, | |||
430 | #define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) | 483 | #define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) |
431 | #endif | 484 | #endif |
432 | 485 | ||
486 | #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME) | ||
487 | int acpi_dev_runtime_suspend(struct device *dev); | ||
488 | int acpi_dev_runtime_resume(struct device *dev); | ||
489 | int acpi_subsys_runtime_suspend(struct device *dev); | ||
490 | int acpi_subsys_runtime_resume(struct device *dev); | ||
491 | #else | ||
492 | static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; } | ||
493 | static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; } | ||
494 | static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; } | ||
495 | static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } | ||
496 | #endif | ||
497 | |||
498 | #ifdef CONFIG_ACPI_SLEEP | ||
499 | int acpi_dev_suspend_late(struct device *dev); | ||
500 | int acpi_dev_resume_early(struct device *dev); | ||
501 | int acpi_subsys_prepare(struct device *dev); | ||
502 | int acpi_subsys_suspend_late(struct device *dev); | ||
503 | int acpi_subsys_resume_early(struct device *dev); | ||
504 | #else | ||
505 | static inline int acpi_dev_suspend_late(struct device *dev) { return 0; } | ||
506 | static inline int acpi_dev_resume_early(struct device *dev) { return 0; } | ||
507 | static inline int acpi_subsys_prepare(struct device *dev) { return 0; } | ||
508 | static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } | ||
509 | static inline int acpi_subsys_resume_early(struct device *dev) { return 0; } | ||
510 | #endif | ||
511 | |||
512 | #if defined(CONFIG_ACPI) && defined(CONFIG_PM) | ||
513 | int acpi_dev_pm_attach(struct device *dev, bool power_on); | ||
514 | void acpi_dev_pm_detach(struct device *dev, bool power_off); | ||
515 | #else | ||
516 | static inline int acpi_dev_pm_attach(struct device *dev, bool power_on) | ||
517 | { | ||
518 | return -ENODEV; | ||
519 | } | ||
520 | static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {} | ||
521 | #endif | ||
522 | |||
523 | #ifdef CONFIG_ACPI | ||
524 | __printf(3, 4) | ||
525 | void acpi_handle_printk(const char *level, acpi_handle handle, | ||
526 | const char *fmt, ...); | ||
527 | #else /* !CONFIG_ACPI */ | ||
528 | static inline __printf(3, 4) void | ||
529 | acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} | ||
530 | #endif /* !CONFIG_ACPI */ | ||
531 | |||
532 | /* | ||
533 | * acpi_handle_<level>: Print message with ACPI prefix and object path | ||
534 | * | ||
535 | * These interfaces acquire the global namespace mutex to obtain an object | ||
536 | * path. In interrupt context, it shows the object path as <n/a>. | ||
537 | */ | ||
538 | #define acpi_handle_emerg(handle, fmt, ...) \ | ||
539 | acpi_handle_printk(KERN_EMERG, handle, fmt, ##__VA_ARGS__) | ||
540 | #define acpi_handle_alert(handle, fmt, ...) \ | ||
541 | acpi_handle_printk(KERN_ALERT, handle, fmt, ##__VA_ARGS__) | ||
542 | #define acpi_handle_crit(handle, fmt, ...) \ | ||
543 | acpi_handle_printk(KERN_CRIT, handle, fmt, ##__VA_ARGS__) | ||
544 | #define acpi_handle_err(handle, fmt, ...) \ | ||
545 | acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__) | ||
546 | #define acpi_handle_warn(handle, fmt, ...) \ | ||
547 | acpi_handle_printk(KERN_WARNING, handle, fmt, ##__VA_ARGS__) | ||
548 | #define acpi_handle_notice(handle, fmt, ...) \ | ||
549 | acpi_handle_printk(KERN_NOTICE, handle, fmt, ##__VA_ARGS__) | ||
550 | #define acpi_handle_info(handle, fmt, ...) \ | ||
551 | acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__) | ||
552 | |||
553 | /* REVISIT: Support CONFIG_DYNAMIC_DEBUG when necessary */ | ||
554 | #if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG) | ||
555 | #define acpi_handle_debug(handle, fmt, ...) \ | ||
556 | acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__) | ||
557 | #else | ||
558 | #define acpi_handle_debug(handle, fmt, ...) \ | ||
559 | ({ \ | ||
560 | if (0) \ | ||
561 | acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__); \ | ||
562 | 0; \ | ||
563 | }) | ||
564 | #endif | ||
565 | |||
433 | #endif /*_LINUX_ACPI_H*/ | 566 | #endif /*_LINUX_ACPI_H*/ |
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h new file mode 100644 index 000000000000..91615a389b65 --- /dev/null +++ b/include/linux/acpi_gpio.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _LINUX_ACPI_GPIO_H_ | ||
2 | #define _LINUX_ACPI_GPIO_H_ | ||
3 | |||
4 | #include <linux/errno.h> | ||
5 | |||
6 | #ifdef CONFIG_GPIO_ACPI | ||
7 | |||
8 | int acpi_get_gpio(char *path, int pin); | ||
9 | |||
10 | #else /* CONFIG_GPIO_ACPI */ | ||
11 | |||
12 | static inline int acpi_get_gpio(char *path, int pin) | ||
13 | { | ||
14 | return -ENODEV; | ||
15 | } | ||
16 | |||
17 | #endif /* CONFIG_GPIO_ACPI */ | ||
18 | |||
19 | #endif /* _LINUX_ACPI_GPIO_H_ */ | ||
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index b60f6ba01d0c..a55b88eaf96a 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #ifndef _LINUX_CPUFREQ_H | 11 | #ifndef _LINUX_CPUFREQ_H |
12 | #define _LINUX_CPUFREQ_H | 12 | #define _LINUX_CPUFREQ_H |
13 | 13 | ||
14 | #include <asm/cputime.h> | ||
14 | #include <linux/mutex.h> | 15 | #include <linux/mutex.h> |
15 | #include <linux/notifier.h> | 16 | #include <linux/notifier.h> |
16 | #include <linux/threads.h> | 17 | #include <linux/threads.h> |
@@ -22,6 +23,8 @@ | |||
22 | #include <asm/div64.h> | 23 | #include <asm/div64.h> |
23 | 24 | ||
24 | #define CPUFREQ_NAME_LEN 16 | 25 | #define CPUFREQ_NAME_LEN 16 |
26 | /* Print length for names. Extra 1 space for accomodating '\n' in prints */ | ||
27 | #define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1) | ||
25 | 28 | ||
26 | 29 | ||
27 | /********************************************************************* | 30 | /********************************************************************* |
@@ -404,6 +407,4 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, | |||
404 | unsigned int cpu); | 407 | unsigned int cpu); |
405 | 408 | ||
406 | void cpufreq_frequency_table_put_attr(unsigned int cpu); | 409 | void cpufreq_frequency_table_put_attr(unsigned int cpu); |
407 | |||
408 | |||
409 | #endif /* _LINUX_CPUFREQ_H */ | 410 | #endif /* _LINUX_CPUFREQ_H */ |
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 279b1eaa8b73..3711b34dc4f9 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h | |||
@@ -82,13 +82,6 @@ cpuidle_set_statedata(struct cpuidle_state_usage *st_usage, void *data) | |||
82 | st_usage->driver_data = data; | 82 | st_usage->driver_data = data; |
83 | } | 83 | } |
84 | 84 | ||
85 | struct cpuidle_state_kobj { | ||
86 | struct cpuidle_state *state; | ||
87 | struct cpuidle_state_usage *state_usage; | ||
88 | struct completion kobj_unregister; | ||
89 | struct kobject kobj; | ||
90 | }; | ||
91 | |||
92 | struct cpuidle_device { | 85 | struct cpuidle_device { |
93 | unsigned int registered:1; | 86 | unsigned int registered:1; |
94 | unsigned int enabled:1; | 87 | unsigned int enabled:1; |
@@ -98,7 +91,7 @@ struct cpuidle_device { | |||
98 | int state_count; | 91 | int state_count; |
99 | struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; | 92 | struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; |
100 | struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; | 93 | struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; |
101 | 94 | struct cpuidle_driver_kobj *kobj_driver; | |
102 | struct list_head device_list; | 95 | struct list_head device_list; |
103 | struct kobject kobj; | 96 | struct kobject kobj; |
104 | struct completion kobj_unregister; | 97 | struct completion kobj_unregister; |
@@ -131,6 +124,7 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev) | |||
131 | struct cpuidle_driver { | 124 | struct cpuidle_driver { |
132 | const char *name; | 125 | const char *name; |
133 | struct module *owner; | 126 | struct module *owner; |
127 | int refcnt; | ||
134 | 128 | ||
135 | unsigned int power_specified:1; | 129 | unsigned int power_specified:1; |
136 | /* set to 1 to use the core cpuidle time keeping (for all states). */ | 130 | /* set to 1 to use the core cpuidle time keeping (for all states). */ |
@@ -163,6 +157,10 @@ extern int cpuidle_wrap_enter(struct cpuidle_device *dev, | |||
163 | struct cpuidle_driver *drv, int index)); | 157 | struct cpuidle_driver *drv, int index)); |
164 | extern int cpuidle_play_dead(void); | 158 | extern int cpuidle_play_dead(void); |
165 | 159 | ||
160 | extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); | ||
161 | extern int cpuidle_register_cpu_driver(struct cpuidle_driver *drv, int cpu); | ||
162 | extern void cpuidle_unregister_cpu_driver(struct cpuidle_driver *drv, int cpu); | ||
163 | |||
166 | #else | 164 | #else |
167 | static inline void disable_cpuidle(void) { } | 165 | static inline void disable_cpuidle(void) { } |
168 | static inline int cpuidle_idle_call(void) { return -ENODEV; } | 166 | static inline int cpuidle_idle_call(void) { return -ENODEV; } |
@@ -189,7 +187,6 @@ static inline int cpuidle_wrap_enter(struct cpuidle_device *dev, | |||
189 | struct cpuidle_driver *drv, int index)) | 187 | struct cpuidle_driver *drv, int index)) |
190 | { return -ENODEV; } | 188 | { return -ENODEV; } |
191 | static inline int cpuidle_play_dead(void) {return -ENODEV; } | 189 | static inline int cpuidle_play_dead(void) {return -ENODEV; } |
192 | |||
193 | #endif | 190 | #endif |
194 | 191 | ||
195 | #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED | 192 | #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED |
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 281c72a3b9d5..e83ef39b3bea 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h | |||
@@ -25,12 +25,12 @@ struct devfreq; | |||
25 | * struct devfreq_dev_status - Data given from devfreq user device to | 25 | * struct devfreq_dev_status - Data given from devfreq user device to |
26 | * governors. Represents the performance | 26 | * governors. Represents the performance |
27 | * statistics. | 27 | * statistics. |
28 | * @total_time The total time represented by this instance of | 28 | * @total_time: The total time represented by this instance of |
29 | * devfreq_dev_status | 29 | * devfreq_dev_status |
30 | * @busy_time The time that the device was working among the | 30 | * @busy_time: The time that the device was working among the |
31 | * total_time. | 31 | * total_time. |
32 | * @current_frequency The operating frequency. | 32 | * @current_frequency: The operating frequency. |
33 | * @private_data An entry not specified by the devfreq framework. | 33 | * @private_data: An entry not specified by the devfreq framework. |
34 | * A device and a specific governor may have their | 34 | * A device and a specific governor may have their |
35 | * own protocol with private_data. However, because | 35 | * own protocol with private_data. However, because |
36 | * this is governor-specific, a governor using this | 36 | * this is governor-specific, a governor using this |
@@ -54,23 +54,27 @@ struct devfreq_dev_status { | |||
54 | 54 | ||
55 | /** | 55 | /** |
56 | * struct devfreq_dev_profile - Devfreq's user device profile | 56 | * struct devfreq_dev_profile - Devfreq's user device profile |
57 | * @initial_freq The operating frequency when devfreq_add_device() is | 57 | * @initial_freq: The operating frequency when devfreq_add_device() is |
58 | * called. | 58 | * called. |
59 | * @polling_ms The polling interval in ms. 0 disables polling. | 59 | * @polling_ms: The polling interval in ms. 0 disables polling. |
60 | * @target The device should set its operating frequency at | 60 | * @target: The device should set its operating frequency at |
61 | * freq or lowest-upper-than-freq value. If freq is | 61 | * freq or lowest-upper-than-freq value. If freq is |
62 | * higher than any operable frequency, set maximum. | 62 | * higher than any operable frequency, set maximum. |
63 | * Before returning, target function should set | 63 | * Before returning, target function should set |
64 | * freq at the current frequency. | 64 | * freq at the current frequency. |
65 | * The "flags" parameter's possible values are | 65 | * The "flags" parameter's possible values are |
66 | * explained above with "DEVFREQ_FLAG_*" macros. | 66 | * explained above with "DEVFREQ_FLAG_*" macros. |
67 | * @get_dev_status The device should provide the current performance | 67 | * @get_dev_status: The device should provide the current performance |
68 | * status to devfreq, which is used by governors. | 68 | * status to devfreq, which is used by governors. |
69 | * @exit An optional callback that is called when devfreq | 69 | * @get_cur_freq: The device should provide the current frequency |
70 | * at which it is operating. | ||
71 | * @exit: An optional callback that is called when devfreq | ||
70 | * is removing the devfreq object due to error or | 72 | * is removing the devfreq object due to error or |
71 | * from devfreq_remove_device() call. If the user | 73 | * from devfreq_remove_device() call. If the user |
72 | * has registered devfreq->nb at a notifier-head, | 74 | * has registered devfreq->nb at a notifier-head, |
73 | * this is the time to unregister it. | 75 | * this is the time to unregister it. |
76 | * @freq_table: Optional list of frequencies to support statistics. | ||
77 | * @max_state: The size of freq_table. | ||
74 | */ | 78 | */ |
75 | struct devfreq_dev_profile { | 79 | struct devfreq_dev_profile { |
76 | unsigned long initial_freq; | 80 | unsigned long initial_freq; |
@@ -79,63 +83,63 @@ struct devfreq_dev_profile { | |||
79 | int (*target)(struct device *dev, unsigned long *freq, u32 flags); | 83 | int (*target)(struct device *dev, unsigned long *freq, u32 flags); |
80 | int (*get_dev_status)(struct device *dev, | 84 | int (*get_dev_status)(struct device *dev, |
81 | struct devfreq_dev_status *stat); | 85 | struct devfreq_dev_status *stat); |
86 | int (*get_cur_freq)(struct device *dev, unsigned long *freq); | ||
82 | void (*exit)(struct device *dev); | 87 | void (*exit)(struct device *dev); |
88 | |||
89 | unsigned int *freq_table; | ||
90 | unsigned int max_state; | ||
83 | }; | 91 | }; |
84 | 92 | ||
85 | /** | 93 | /** |
86 | * struct devfreq_governor - Devfreq policy governor | 94 | * struct devfreq_governor - Devfreq policy governor |
87 | * @name Governor's name | 95 | * @node: list node - contains registered devfreq governors |
88 | * @get_target_freq Returns desired operating frequency for the device. | 96 | * @name: Governor's name |
97 | * @get_target_freq: Returns desired operating frequency for the device. | ||
89 | * Basically, get_target_freq will run | 98 | * Basically, get_target_freq will run |
90 | * devfreq_dev_profile.get_dev_status() to get the | 99 | * devfreq_dev_profile.get_dev_status() to get the |
91 | * status of the device (load = busy_time / total_time). | 100 | * status of the device (load = busy_time / total_time). |
92 | * If no_central_polling is set, this callback is called | 101 | * If no_central_polling is set, this callback is called |
93 | * only with update_devfreq() notified by OPP. | 102 | * only with update_devfreq() notified by OPP. |
94 | * @init Called when the devfreq is being attached to a device | 103 | * @event_handler: Callback for devfreq core framework to notify events |
95 | * @exit Called when the devfreq is being removed from a | 104 | * to governors. Events include per device governor |
96 | * device. Governor should stop any internal routines | 105 | * init and exit, opp changes out of devfreq, suspend |
97 | * before return because related data may be | 106 | * and resume of per device devfreq during device idle. |
98 | * freed after exit(). | ||
99 | * @no_central_polling Do not use devfreq's central polling mechanism. | ||
100 | * When this is set, devfreq will not call | ||
101 | * get_target_freq with devfreq_monitor(). However, | ||
102 | * devfreq will call get_target_freq with | ||
103 | * devfreq_update() notified by OPP framework. | ||
104 | * | 107 | * |
105 | * Note that the callbacks are called with devfreq->lock locked by devfreq. | 108 | * Note that the callbacks are called with devfreq->lock locked by devfreq. |
106 | */ | 109 | */ |
107 | struct devfreq_governor { | 110 | struct devfreq_governor { |
111 | struct list_head node; | ||
112 | |||
108 | const char name[DEVFREQ_NAME_LEN]; | 113 | const char name[DEVFREQ_NAME_LEN]; |
109 | int (*get_target_freq)(struct devfreq *this, unsigned long *freq); | 114 | int (*get_target_freq)(struct devfreq *this, unsigned long *freq); |
110 | int (*init)(struct devfreq *this); | 115 | int (*event_handler)(struct devfreq *devfreq, |
111 | void (*exit)(struct devfreq *this); | 116 | unsigned int event, void *data); |
112 | const bool no_central_polling; | ||
113 | }; | 117 | }; |
114 | 118 | ||
115 | /** | 119 | /** |
116 | * struct devfreq - Device devfreq structure | 120 | * struct devfreq - Device devfreq structure |
117 | * @node list node - contains the devices with devfreq that have been | 121 | * @node: list node - contains the devices with devfreq that have been |
118 | * registered. | 122 | * registered. |
119 | * @lock a mutex to protect accessing devfreq. | 123 | * @lock: a mutex to protect accessing devfreq. |
120 | * @dev device registered by devfreq class. dev.parent is the device | 124 | * @dev: device registered by devfreq class. dev.parent is the device |
121 | * using devfreq. | 125 | * using devfreq. |
122 | * @profile device-specific devfreq profile | 126 | * @profile: device-specific devfreq profile |
123 | * @governor method how to choose frequency based on the usage. | 127 | * @governor: method how to choose frequency based on the usage. |
124 | * @nb notifier block used to notify devfreq object that it should | 128 | * @governor_name: devfreq governor name for use with this devfreq |
129 | * @nb: notifier block used to notify devfreq object that it should | ||
125 | * reevaluate operable frequencies. Devfreq users may use | 130 | * reevaluate operable frequencies. Devfreq users may use |
126 | * devfreq.nb to the corresponding register notifier call chain. | 131 | * devfreq.nb to the corresponding register notifier call chain. |
127 | * @polling_jiffies interval in jiffies. | 132 | * @work: delayed work for load monitoring. |
128 | * @previous_freq previously configured frequency value. | 133 | * @previous_freq: previously configured frequency value. |
129 | * @next_polling the number of remaining jiffies to poll with | 134 | * @data: Private data of the governor. The devfreq framework does not |
130 | * "devfreq_monitor" executions to reevaluate | ||
131 | * frequency/voltage of the device. Set by | ||
132 | * profile's polling_ms interval. | ||
133 | * @data Private data of the governor. The devfreq framework does not | ||
134 | * touch this. | 135 | * touch this. |
135 | * @being_removed a flag to mark that this object is being removed in | 136 | * @min_freq: Limit minimum frequency requested by user (0: none) |
136 | * order to prevent trying to remove the object multiple times. | 137 | * @max_freq: Limit maximum frequency requested by user (0: none) |
137 | * @min_freq Limit minimum frequency requested by user (0: none) | 138 | * @stop_polling: devfreq polling status of a device. |
138 | * @max_freq Limit maximum frequency requested by user (0: none) | 139 | * @total_trans: Number of devfreq transitions |
140 | * @trans_table: Statistics of devfreq transitions | ||
141 | * @time_in_state: Statistics of devfreq states | ||
142 | * @last_stat_updated: The last time stat updated | ||
139 | * | 143 | * |
140 | * This structure stores the devfreq information for a give device. | 144 | * This structure stores the devfreq information for a give device. |
141 | * | 145 | * |
@@ -152,26 +156,33 @@ struct devfreq { | |||
152 | struct device dev; | 156 | struct device dev; |
153 | struct devfreq_dev_profile *profile; | 157 | struct devfreq_dev_profile *profile; |
154 | const struct devfreq_governor *governor; | 158 | const struct devfreq_governor *governor; |
159 | char governor_name[DEVFREQ_NAME_LEN]; | ||
155 | struct notifier_block nb; | 160 | struct notifier_block nb; |
161 | struct delayed_work work; | ||
156 | 162 | ||
157 | unsigned long polling_jiffies; | ||
158 | unsigned long previous_freq; | 163 | unsigned long previous_freq; |
159 | unsigned int next_polling; | ||
160 | 164 | ||
161 | void *data; /* private data for governors */ | 165 | void *data; /* private data for governors */ |
162 | 166 | ||
163 | bool being_removed; | ||
164 | |||
165 | unsigned long min_freq; | 167 | unsigned long min_freq; |
166 | unsigned long max_freq; | 168 | unsigned long max_freq; |
169 | bool stop_polling; | ||
170 | |||
171 | /* information for device freqeuncy transition */ | ||
172 | unsigned int total_trans; | ||
173 | unsigned int *trans_table; | ||
174 | unsigned long *time_in_state; | ||
175 | unsigned long last_stat_updated; | ||
167 | }; | 176 | }; |
168 | 177 | ||
169 | #if defined(CONFIG_PM_DEVFREQ) | 178 | #if defined(CONFIG_PM_DEVFREQ) |
170 | extern struct devfreq *devfreq_add_device(struct device *dev, | 179 | extern struct devfreq *devfreq_add_device(struct device *dev, |
171 | struct devfreq_dev_profile *profile, | 180 | struct devfreq_dev_profile *profile, |
172 | const struct devfreq_governor *governor, | 181 | const char *governor_name, |
173 | void *data); | 182 | void *data); |
174 | extern int devfreq_remove_device(struct devfreq *devfreq); | 183 | extern int devfreq_remove_device(struct devfreq *devfreq); |
184 | extern int devfreq_suspend_device(struct devfreq *devfreq); | ||
185 | extern int devfreq_resume_device(struct devfreq *devfreq); | ||
175 | 186 | ||
176 | /* Helper functions for devfreq user device driver with OPP. */ | 187 | /* Helper functions for devfreq user device driver with OPP. */ |
177 | extern struct opp *devfreq_recommended_opp(struct device *dev, | 188 | extern struct opp *devfreq_recommended_opp(struct device *dev, |
@@ -181,23 +192,13 @@ extern int devfreq_register_opp_notifier(struct device *dev, | |||
181 | extern int devfreq_unregister_opp_notifier(struct device *dev, | 192 | extern int devfreq_unregister_opp_notifier(struct device *dev, |
182 | struct devfreq *devfreq); | 193 | struct devfreq *devfreq); |
183 | 194 | ||
184 | #ifdef CONFIG_DEVFREQ_GOV_POWERSAVE | 195 | #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) |
185 | extern const struct devfreq_governor devfreq_powersave; | ||
186 | #endif | ||
187 | #ifdef CONFIG_DEVFREQ_GOV_PERFORMANCE | ||
188 | extern const struct devfreq_governor devfreq_performance; | ||
189 | #endif | ||
190 | #ifdef CONFIG_DEVFREQ_GOV_USERSPACE | ||
191 | extern const struct devfreq_governor devfreq_userspace; | ||
192 | #endif | ||
193 | #ifdef CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND | ||
194 | extern const struct devfreq_governor devfreq_simple_ondemand; | ||
195 | /** | 196 | /** |
196 | * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq | 197 | * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq |
197 | * and devfreq_add_device | 198 | * and devfreq_add_device |
198 | * @ upthreshold If the load is over this value, the frequency jumps. | 199 | * @upthreshold: If the load is over this value, the frequency jumps. |
199 | * Specify 0 to use the default. Valid value = 0 to 100. | 200 | * Specify 0 to use the default. Valid value = 0 to 100. |
200 | * @ downdifferential If the load is under upthreshold - downdifferential, | 201 | * @downdifferential: If the load is under upthreshold - downdifferential, |
201 | * the governor may consider slowing the frequency down. | 202 | * the governor may consider slowing the frequency down. |
202 | * Specify 0 to use the default. Valid value = 0 to 100. | 203 | * Specify 0 to use the default. Valid value = 0 to 100. |
203 | * downdifferential < upthreshold must hold. | 204 | * downdifferential < upthreshold must hold. |
@@ -214,7 +215,7 @@ struct devfreq_simple_ondemand_data { | |||
214 | #else /* !CONFIG_PM_DEVFREQ */ | 215 | #else /* !CONFIG_PM_DEVFREQ */ |
215 | static struct devfreq *devfreq_add_device(struct device *dev, | 216 | static struct devfreq *devfreq_add_device(struct device *dev, |
216 | struct devfreq_dev_profile *profile, | 217 | struct devfreq_dev_profile *profile, |
217 | struct devfreq_governor *governor, | 218 | const char *governor_name, |
218 | void *data) | 219 | void *data) |
219 | { | 220 | { |
220 | return NULL; | 221 | return NULL; |
@@ -225,6 +226,16 @@ static int devfreq_remove_device(struct devfreq *devfreq) | |||
225 | return 0; | 226 | return 0; |
226 | } | 227 | } |
227 | 228 | ||
229 | static int devfreq_suspend_device(struct devfreq *devfreq) | ||
230 | { | ||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static int devfreq_resume_device(struct devfreq *devfreq) | ||
235 | { | ||
236 | return 0; | ||
237 | } | ||
238 | |||
228 | static struct opp *devfreq_recommended_opp(struct device *dev, | 239 | static struct opp *devfreq_recommended_opp(struct device *dev, |
229 | unsigned long *freq, u32 flags) | 240 | unsigned long *freq, u32 flags) |
230 | { | 241 | { |
@@ -243,11 +254,6 @@ static int devfreq_unregister_opp_notifier(struct device *dev, | |||
243 | return -EINVAL; | 254 | return -EINVAL; |
244 | } | 255 | } |
245 | 256 | ||
246 | #define devfreq_powersave NULL | ||
247 | #define devfreq_performance NULL | ||
248 | #define devfreq_userspace NULL | ||
249 | #define devfreq_simple_ondemand NULL | ||
250 | |||
251 | #endif /* CONFIG_PM_DEVFREQ */ | 257 | #endif /* CONFIG_PM_DEVFREQ */ |
252 | 258 | ||
253 | #endif /* __LINUX_DEVFREQ_H__ */ | 259 | #endif /* __LINUX_DEVFREQ_H__ */ |
diff --git a/include/linux/device.h b/include/linux/device.h index 86ef6ab553b1..05292e488346 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -190,6 +190,7 @@ extern struct klist *bus_get_device_klist(struct bus_type *bus); | |||
190 | * @mod_name: Used for built-in modules. | 190 | * @mod_name: Used for built-in modules. |
191 | * @suppress_bind_attrs: Disables bind/unbind via sysfs. | 191 | * @suppress_bind_attrs: Disables bind/unbind via sysfs. |
192 | * @of_match_table: The open firmware table. | 192 | * @of_match_table: The open firmware table. |
193 | * @acpi_match_table: The ACPI match table. | ||
193 | * @probe: Called to query the existence of a specific device, | 194 | * @probe: Called to query the existence of a specific device, |
194 | * whether this driver can work with it, and bind the driver | 195 | * whether this driver can work with it, and bind the driver |
195 | * to a specific device. | 196 | * to a specific device. |
@@ -223,6 +224,7 @@ struct device_driver { | |||
223 | bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ | 224 | bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ |
224 | 225 | ||
225 | const struct of_device_id *of_match_table; | 226 | const struct of_device_id *of_match_table; |
227 | const struct acpi_device_id *acpi_match_table; | ||
226 | 228 | ||
227 | int (*probe) (struct device *dev); | 229 | int (*probe) (struct device *dev); |
228 | int (*remove) (struct device *dev); | 230 | int (*remove) (struct device *dev); |
@@ -576,6 +578,12 @@ struct device_dma_parameters { | |||
576 | unsigned long segment_boundary_mask; | 578 | unsigned long segment_boundary_mask; |
577 | }; | 579 | }; |
578 | 580 | ||
581 | struct acpi_dev_node { | ||
582 | #ifdef CONFIG_ACPI | ||
583 | void *handle; | ||
584 | #endif | ||
585 | }; | ||
586 | |||
579 | /** | 587 | /** |
580 | * struct device - The basic device structure | 588 | * struct device - The basic device structure |
581 | * @parent: The device's "parent" device, the device to which it is attached. | 589 | * @parent: The device's "parent" device, the device to which it is attached. |
@@ -616,6 +624,7 @@ struct device_dma_parameters { | |||
616 | * @dma_mem: Internal for coherent mem override. | 624 | * @dma_mem: Internal for coherent mem override. |
617 | * @archdata: For arch-specific additions. | 625 | * @archdata: For arch-specific additions. |
618 | * @of_node: Associated device tree node. | 626 | * @of_node: Associated device tree node. |
627 | * @acpi_node: Associated ACPI device node. | ||
619 | * @devt: For creating the sysfs "dev". | 628 | * @devt: For creating the sysfs "dev". |
620 | * @id: device instance | 629 | * @id: device instance |
621 | * @devres_lock: Spinlock to protect the resource of the device. | 630 | * @devres_lock: Spinlock to protect the resource of the device. |
@@ -680,6 +689,7 @@ struct device { | |||
680 | struct dev_archdata archdata; | 689 | struct dev_archdata archdata; |
681 | 690 | ||
682 | struct device_node *of_node; /* associated device tree node */ | 691 | struct device_node *of_node; /* associated device tree node */ |
692 | struct acpi_dev_node acpi_node; /* associated ACPI device node */ | ||
683 | 693 | ||
684 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 694 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
685 | u32 id; /* device instance */ | 695 | u32 id; /* device instance */ |
@@ -700,6 +710,14 @@ static inline struct device *kobj_to_dev(struct kobject *kobj) | |||
700 | return container_of(kobj, struct device, kobj); | 710 | return container_of(kobj, struct device, kobj); |
701 | } | 711 | } |
702 | 712 | ||
713 | #ifdef CONFIG_ACPI | ||
714 | #define ACPI_HANDLE(dev) ((dev)->acpi_node.handle) | ||
715 | #define ACPI_HANDLE_SET(dev, _handle_) (dev)->acpi_node.handle = (_handle_) | ||
716 | #else | ||
717 | #define ACPI_HANDLE(dev) (NULL) | ||
718 | #define ACPI_HANDLE_SET(dev, _handle_) do { } while (0) | ||
719 | #endif | ||
720 | |||
703 | /* Get the wakeup routines, which depend on struct device */ | 721 | /* Get the wakeup routines, which depend on struct device */ |
704 | #include <linux/pm_wakeup.h> | 722 | #include <linux/pm_wakeup.h> |
705 | 723 | ||
diff --git a/include/linux/freezer.h b/include/linux/freezer.h index d09af4b67cf1..b90091af5798 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h | |||
@@ -177,6 +177,7 @@ static inline int freeze_kernel_threads(void) { return -ENOSYS; } | |||
177 | static inline void thaw_processes(void) {} | 177 | static inline void thaw_processes(void) {} |
178 | static inline void thaw_kernel_threads(void) {} | 178 | static inline void thaw_kernel_threads(void) {} |
179 | 179 | ||
180 | static inline bool try_to_freeze_nowarn(void) { return false; } | ||
180 | static inline bool try_to_freeze(void) { return false; } | 181 | static inline bool try_to_freeze(void) { return false; } |
181 | 182 | ||
182 | static inline void freezer_do_not_count(void) {} | 183 | static inline void freezer_do_not_count(void) {} |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 800de224336b..d0c4db7b4872 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -259,6 +259,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data) | |||
259 | * @platform_data: stored in i2c_client.dev.platform_data | 259 | * @platform_data: stored in i2c_client.dev.platform_data |
260 | * @archdata: copied into i2c_client.dev.archdata | 260 | * @archdata: copied into i2c_client.dev.archdata |
261 | * @of_node: pointer to OpenFirmware device node | 261 | * @of_node: pointer to OpenFirmware device node |
262 | * @acpi_node: ACPI device node | ||
262 | * @irq: stored in i2c_client.irq | 263 | * @irq: stored in i2c_client.irq |
263 | * | 264 | * |
264 | * I2C doesn't actually support hardware probing, although controllers and | 265 | * I2C doesn't actually support hardware probing, although controllers and |
@@ -279,6 +280,7 @@ struct i2c_board_info { | |||
279 | void *platform_data; | 280 | void *platform_data; |
280 | struct dev_archdata *archdata; | 281 | struct dev_archdata *archdata; |
281 | struct device_node *of_node; | 282 | struct device_node *of_node; |
283 | struct acpi_dev_node acpi_node; | ||
282 | int irq; | 284 | int irq; |
283 | }; | 285 | }; |
284 | 286 | ||
@@ -501,4 +503,11 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap) | |||
501 | i2c_del_driver) | 503 | i2c_del_driver) |
502 | 504 | ||
503 | #endif /* I2C */ | 505 | #endif /* I2C */ |
506 | |||
507 | #if IS_ENABLED(CONFIG_ACPI_I2C) | ||
508 | extern void acpi_i2c_register_devices(struct i2c_adapter *adap); | ||
509 | #else | ||
510 | static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) {} | ||
511 | #endif | ||
512 | |||
504 | #endif /* _LINUX_I2C_H */ | 513 | #endif /* _LINUX_I2C_H */ |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 5711e9525a2a..a9ded9a3c175 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
@@ -55,6 +55,7 @@ extern int platform_add_devices(struct platform_device **, int); | |||
55 | 55 | ||
56 | struct platform_device_info { | 56 | struct platform_device_info { |
57 | struct device *parent; | 57 | struct device *parent; |
58 | struct acpi_dev_node acpi_node; | ||
58 | 59 | ||
59 | const char *name; | 60 | const char *name; |
60 | int id; | 61 | int id; |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 007e687c4f69..03d7bb145311 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -546,10 +546,9 @@ struct dev_pm_info { | |||
546 | unsigned long active_jiffies; | 546 | unsigned long active_jiffies; |
547 | unsigned long suspended_jiffies; | 547 | unsigned long suspended_jiffies; |
548 | unsigned long accounting_timestamp; | 548 | unsigned long accounting_timestamp; |
549 | struct dev_pm_qos_request *pq_req; | ||
550 | #endif | 549 | #endif |
551 | struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ | 550 | struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ |
552 | struct pm_qos_constraints *constraints; | 551 | struct dev_pm_qos *qos; |
553 | }; | 552 | }; |
554 | 553 | ||
555 | extern void update_pm_runtime_accounting(struct device *dev); | 554 | extern void update_pm_runtime_accounting(struct device *dev); |
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 9924ea1f22e0..5a95013905c8 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h | |||
@@ -20,6 +20,13 @@ enum { | |||
20 | PM_QOS_NUM_CLASSES, | 20 | PM_QOS_NUM_CLASSES, |
21 | }; | 21 | }; |
22 | 22 | ||
23 | enum pm_qos_flags_status { | ||
24 | PM_QOS_FLAGS_UNDEFINED = -1, | ||
25 | PM_QOS_FLAGS_NONE, | ||
26 | PM_QOS_FLAGS_SOME, | ||
27 | PM_QOS_FLAGS_ALL, | ||
28 | }; | ||
29 | |||
23 | #define PM_QOS_DEFAULT_VALUE -1 | 30 | #define PM_QOS_DEFAULT_VALUE -1 |
24 | 31 | ||
25 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | 32 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) |
@@ -27,14 +34,31 @@ enum { | |||
27 | #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 | 34 | #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 |
28 | #define PM_QOS_DEV_LAT_DEFAULT_VALUE 0 | 35 | #define PM_QOS_DEV_LAT_DEFAULT_VALUE 0 |
29 | 36 | ||
37 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) | ||
38 | #define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1) | ||
39 | |||
30 | struct pm_qos_request { | 40 | struct pm_qos_request { |
31 | struct plist_node node; | 41 | struct plist_node node; |
32 | int pm_qos_class; | 42 | int pm_qos_class; |
33 | struct delayed_work work; /* for pm_qos_update_request_timeout */ | 43 | struct delayed_work work; /* for pm_qos_update_request_timeout */ |
34 | }; | 44 | }; |
35 | 45 | ||
46 | struct pm_qos_flags_request { | ||
47 | struct list_head node; | ||
48 | s32 flags; /* Do not change to 64 bit */ | ||
49 | }; | ||
50 | |||
51 | enum dev_pm_qos_req_type { | ||
52 | DEV_PM_QOS_LATENCY = 1, | ||
53 | DEV_PM_QOS_FLAGS, | ||
54 | }; | ||
55 | |||
36 | struct dev_pm_qos_request { | 56 | struct dev_pm_qos_request { |
37 | struct plist_node node; | 57 | enum dev_pm_qos_req_type type; |
58 | union { | ||
59 | struct plist_node pnode; | ||
60 | struct pm_qos_flags_request flr; | ||
61 | } data; | ||
38 | struct device *dev; | 62 | struct device *dev; |
39 | }; | 63 | }; |
40 | 64 | ||
@@ -45,8 +69,8 @@ enum pm_qos_type { | |||
45 | }; | 69 | }; |
46 | 70 | ||
47 | /* | 71 | /* |
48 | * Note: The lockless read path depends on the CPU accessing | 72 | * Note: The lockless read path depends on the CPU accessing target_value |
49 | * target_value atomically. Atomic access is only guaranteed on all CPU | 73 | * or effective_flags atomically. Atomic access is only guaranteed on all CPU |
50 | * types linux supports for 32 bit quantites | 74 | * types linux supports for 32 bit quantites |
51 | */ | 75 | */ |
52 | struct pm_qos_constraints { | 76 | struct pm_qos_constraints { |
@@ -57,6 +81,18 @@ struct pm_qos_constraints { | |||
57 | struct blocking_notifier_head *notifiers; | 81 | struct blocking_notifier_head *notifiers; |
58 | }; | 82 | }; |
59 | 83 | ||
84 | struct pm_qos_flags { | ||
85 | struct list_head list; | ||
86 | s32 effective_flags; /* Do not change to 64 bit */ | ||
87 | }; | ||
88 | |||
89 | struct dev_pm_qos { | ||
90 | struct pm_qos_constraints latency; | ||
91 | struct pm_qos_flags flags; | ||
92 | struct dev_pm_qos_request *latency_req; | ||
93 | struct dev_pm_qos_request *flags_req; | ||
94 | }; | ||
95 | |||
60 | /* Action requested to pm_qos_update_target */ | 96 | /* Action requested to pm_qos_update_target */ |
61 | enum pm_qos_req_action { | 97 | enum pm_qos_req_action { |
62 | PM_QOS_ADD_REQ, /* Add a new request */ | 98 | PM_QOS_ADD_REQ, /* Add a new request */ |
@@ -71,6 +107,9 @@ static inline int dev_pm_qos_request_active(struct dev_pm_qos_request *req) | |||
71 | 107 | ||
72 | int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, | 108 | int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, |
73 | enum pm_qos_req_action action, int value); | 109 | enum pm_qos_req_action action, int value); |
110 | bool pm_qos_update_flags(struct pm_qos_flags *pqf, | ||
111 | struct pm_qos_flags_request *req, | ||
112 | enum pm_qos_req_action action, s32 val); | ||
74 | void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, | 113 | void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, |
75 | s32 value); | 114 | s32 value); |
76 | void pm_qos_update_request(struct pm_qos_request *req, | 115 | void pm_qos_update_request(struct pm_qos_request *req, |
@@ -86,10 +125,12 @@ int pm_qos_request_active(struct pm_qos_request *req); | |||
86 | s32 pm_qos_read_value(struct pm_qos_constraints *c); | 125 | s32 pm_qos_read_value(struct pm_qos_constraints *c); |
87 | 126 | ||
88 | #ifdef CONFIG_PM | 127 | #ifdef CONFIG_PM |
128 | enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask); | ||
129 | enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask); | ||
89 | s32 __dev_pm_qos_read_value(struct device *dev); | 130 | s32 __dev_pm_qos_read_value(struct device *dev); |
90 | s32 dev_pm_qos_read_value(struct device *dev); | 131 | s32 dev_pm_qos_read_value(struct device *dev); |
91 | int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, | 132 | int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, |
92 | s32 value); | 133 | enum dev_pm_qos_req_type type, s32 value); |
93 | int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value); | 134 | int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value); |
94 | int dev_pm_qos_remove_request(struct dev_pm_qos_request *req); | 135 | int dev_pm_qos_remove_request(struct dev_pm_qos_request *req); |
95 | int dev_pm_qos_add_notifier(struct device *dev, | 136 | int dev_pm_qos_add_notifier(struct device *dev, |
@@ -103,12 +144,19 @@ void dev_pm_qos_constraints_destroy(struct device *dev); | |||
103 | int dev_pm_qos_add_ancestor_request(struct device *dev, | 144 | int dev_pm_qos_add_ancestor_request(struct device *dev, |
104 | struct dev_pm_qos_request *req, s32 value); | 145 | struct dev_pm_qos_request *req, s32 value); |
105 | #else | 146 | #else |
147 | static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, | ||
148 | s32 mask) | ||
149 | { return PM_QOS_FLAGS_UNDEFINED; } | ||
150 | static inline enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, | ||
151 | s32 mask) | ||
152 | { return PM_QOS_FLAGS_UNDEFINED; } | ||
106 | static inline s32 __dev_pm_qos_read_value(struct device *dev) | 153 | static inline s32 __dev_pm_qos_read_value(struct device *dev) |
107 | { return 0; } | 154 | { return 0; } |
108 | static inline s32 dev_pm_qos_read_value(struct device *dev) | 155 | static inline s32 dev_pm_qos_read_value(struct device *dev) |
109 | { return 0; } | 156 | { return 0; } |
110 | static inline int dev_pm_qos_add_request(struct device *dev, | 157 | static inline int dev_pm_qos_add_request(struct device *dev, |
111 | struct dev_pm_qos_request *req, | 158 | struct dev_pm_qos_request *req, |
159 | enum dev_pm_qos_req_type type, | ||
112 | s32 value) | 160 | s32 value) |
113 | { return 0; } | 161 | { return 0; } |
114 | static inline int dev_pm_qos_update_request(struct dev_pm_qos_request *req, | 162 | static inline int dev_pm_qos_update_request(struct dev_pm_qos_request *req, |
@@ -144,10 +192,31 @@ static inline int dev_pm_qos_add_ancestor_request(struct device *dev, | |||
144 | #ifdef CONFIG_PM_RUNTIME | 192 | #ifdef CONFIG_PM_RUNTIME |
145 | int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value); | 193 | int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value); |
146 | void dev_pm_qos_hide_latency_limit(struct device *dev); | 194 | void dev_pm_qos_hide_latency_limit(struct device *dev); |
195 | int dev_pm_qos_expose_flags(struct device *dev, s32 value); | ||
196 | void dev_pm_qos_hide_flags(struct device *dev); | ||
197 | int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set); | ||
198 | |||
199 | static inline s32 dev_pm_qos_requested_latency(struct device *dev) | ||
200 | { | ||
201 | return dev->power.qos->latency_req->data.pnode.prio; | ||
202 | } | ||
203 | |||
204 | static inline s32 dev_pm_qos_requested_flags(struct device *dev) | ||
205 | { | ||
206 | return dev->power.qos->flags_req->data.flr.flags; | ||
207 | } | ||
147 | #else | 208 | #else |
148 | static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) | 209 | static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) |
149 | { return 0; } | 210 | { return 0; } |
150 | static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {} | 211 | static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {} |
212 | static inline int dev_pm_qos_expose_flags(struct device *dev, s32 value) | ||
213 | { return 0; } | ||
214 | static inline void dev_pm_qos_hide_flags(struct device *dev) {} | ||
215 | static inline int dev_pm_qos_update_flags(struct device *dev, s32 m, bool set) | ||
216 | { return 0; } | ||
217 | |||
218 | static inline s32 dev_pm_qos_requested_latency(struct device *dev) { return 0; } | ||
219 | static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; } | ||
151 | #endif | 220 | #endif |
152 | 221 | ||
153 | #endif | 222 | #endif |
diff --git a/include/linux/tick.h b/include/linux/tick.h index f37fceb69b73..1a6567b48492 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
@@ -142,4 +142,10 @@ static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } | |||
142 | static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } | 142 | static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } |
143 | # endif /* !NO_HZ */ | 143 | # endif /* !NO_HZ */ |
144 | 144 | ||
145 | # ifdef CONFIG_CPU_IDLE_GOV_MENU | ||
146 | extern void menu_hrtimer_cancel(void); | ||
147 | # else | ||
148 | static inline void menu_hrtimer_cancel(void) {} | ||
149 | # endif /* CONFIG_CPU_IDLE_GOV_MENU */ | ||
150 | |||
145 | #endif | 151 | #endif |