diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-11 15:45:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-11 15:45:35 -0500 |
commit | bad73c5aa069f1f14cc07ce7bbae8d463635560c (patch) | |
tree | db905bb3400e6fe70be95cd20158bed79b2b2c6c /include/linux | |
parent | b58ed041a360ed051fab17e4d9b0f451c6fedba7 (diff) | |
parent | f316fc56555a5c3bcf6350f3d5ac26dd2c55f4cb (diff) |
Merge tag 'pm+acpi-for-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management updates from Rafael Wysocki:
- Introduction of device PM QoS flags.
- ACPI device power management update allowing subsystems other than
PCI to use it more easily.
- ACPI device enumeration rework allowing additional kinds of devices
to be enumerated via ACPI. From Mika Westerberg, Adrian Hunter,
Mathias Nyman, Andy Shevchenko, and Rafael J. Wysocki.
- ACPICA update to version 20121018 from Bob Moore and Lv Zheng.
- ACPI memory hotplug update from Wen Congyang and Yasuaki Ishimatsu.
- Introduction of acpi_handle_<level>() messaging macros and ACPI-based
CPU hot-remove support from Toshi Kani.
- ACPI EC updates from Feng Tang.
- cpufreq updates from Viresh Kumar, Fabio Baltieri and others.
- cpuidle changes to quickly notice governor prediction failure from
Youquan Song.
- Support for using multiple cpuidle drivers at the same time and
cpuidle cleanups from Daniel Lezcano.
- devfreq updates from Nishanth Menon and others.
- cpupower update from Thomas Renninger.
- Fixes and small cleanups all over the place.
* tag 'pm+acpi-for-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (196 commits)
mmc: sdhci-acpi: enable runtime-pm for device HID INT33C6
ACPI: add Haswell LPSS devices to acpi_platform_device_ids list
ACPI: add documentation about ACPI 5 enumeration
pnpacpi: fix incorrect TEST_ALPHA() test
ACPI / PM: Fix header of acpi_dev_pm_detach() in acpi.h
ACPI / video: ignore BIOS initial backlight value for HP Folio 13-2000
ACPI : do not use Lid and Sleep button for S5 wakeup
ACPI / PNP: Do not crash due to stale pointer use during system resume
ACPI / video: Add "Asus UL30VT" to ACPI video detect blacklist
ACPI: do acpisleep dmi check when CONFIG_ACPI_SLEEP is set
spi / ACPI: add ACPI enumeration support
gpio / ACPI: add ACPI support
PM / devfreq: remove compiler error with module governors (2)
cpupower: IvyBridge (0x3a and 0x3e models) support
cpupower: Provide -c param for cpupower monitor to schedule process on all cores
cpupower tools: Fix warning and a bug with the cpu package count
cpupower tools: Fix malloc of cpu_info structure
cpupower tools: Fix issues with sysfs_topology_read_file
cpupower tools: Fix minor warnings
cpupower tools: Update .gitignore for files created in the debug directories
...
Diffstat (limited to 'include/linux')
-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 |
12 files changed, 342 insertions, 83 deletions
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 |