diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-27 07:42:42 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-27 07:42:42 -0500 |
commit | 45c36462aef0cccadb7755ea4edc78d13334a2be (patch) | |
tree | d707b2863494452585941d3818347005f34c636e /include/linux | |
parent | c4e050376c69bb9d67895842665264df2a2004d9 (diff) | |
parent | b88ce2a41562d1a9554f209e0f31a32d9f473794 (diff) |
Merge branch 'acpi-dev-pm' into acpi-enumeration
Subsequent commits in this branch will depend on 'acpi-dev-pm'
material.
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/acpi.h | 38 | ||||
-rw-r--r-- | include/linux/pm.h | 3 | ||||
-rw-r--r-- | include/linux/pm_qos.h | 77 |
3 files changed, 112 insertions, 6 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 32fbc4e73a56..3574e4a2bf14 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #ifndef _LINUX_ACPI_H | 25 | #ifndef _LINUX_ACPI_H |
26 | #define _LINUX_ACPI_H | 26 | #define _LINUX_ACPI_H |
27 | 27 | ||
28 | #include <linux/errno.h> | ||
28 | #include <linux/ioport.h> /* for struct resource */ | 29 | #include <linux/ioport.h> /* for struct resource */ |
29 | #include <linux/device.h> | 30 | #include <linux/device.h> |
30 | 31 | ||
@@ -478,4 +479,41 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, | |||
478 | #define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) | 479 | #define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) |
479 | #endif | 480 | #endif |
480 | 481 | ||
482 | #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME) | ||
483 | int acpi_dev_runtime_suspend(struct device *dev); | ||
484 | int acpi_dev_runtime_resume(struct device *dev); | ||
485 | int acpi_subsys_runtime_suspend(struct device *dev); | ||
486 | int acpi_subsys_runtime_resume(struct device *dev); | ||
487 | #else | ||
488 | static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; } | ||
489 | static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; } | ||
490 | static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; } | ||
491 | static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } | ||
492 | #endif | ||
493 | |||
494 | #ifdef CONFIG_ACPI_SLEEP | ||
495 | int acpi_dev_suspend_late(struct device *dev); | ||
496 | int acpi_dev_resume_early(struct device *dev); | ||
497 | int acpi_subsys_prepare(struct device *dev); | ||
498 | int acpi_subsys_suspend_late(struct device *dev); | ||
499 | int acpi_subsys_resume_early(struct device *dev); | ||
500 | #else | ||
501 | static inline int acpi_dev_suspend_late(struct device *dev) { return 0; } | ||
502 | static inline int acpi_dev_resume_early(struct device *dev) { return 0; } | ||
503 | static inline int acpi_subsys_prepare(struct device *dev) { return 0; } | ||
504 | static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } | ||
505 | static inline int acpi_subsys_resume_early(struct device *dev) { return 0; } | ||
506 | #endif | ||
507 | |||
508 | #if defined(CONFIG_ACPI) && defined(CONFIG_PM) | ||
509 | int acpi_dev_pm_attach(struct device *dev, bool power_on); | ||
510 | int acpi_dev_pm_detach(struct device *dev, bool power_off); | ||
511 | #else | ||
512 | static inline int acpi_dev_pm_attach(struct device *dev, bool power_on) | ||
513 | { | ||
514 | return -ENODEV; | ||
515 | } | ||
516 | static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {} | ||
517 | #endif | ||
518 | |||
481 | #endif /*_LINUX_ACPI_H*/ | 519 | #endif /*_LINUX_ACPI_H*/ |
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 |