1 #ifndef _LINUX_PM_QOS_H
2 #define _LINUX_PM_QOS_H
3 /* interface for the pm_qos_power infrastructure of the linux kernel.
5 * Mark Gross <mgross@linux.intel.com>
7 #include <linux/plist.h>
8 #include <linux/notifier.h>
9 #include <linux/miscdevice.h>
11 #define PM_QOS_RESERVED 0
12 #define PM_QOS_CPU_DMA_LATENCY 1
13 #define PM_QOS_NETWORK_LATENCY 2
14 #define PM_QOS_NETWORK_THROUGHPUT 3
16 #define PM_QOS_NUM_CLASSES 4
17 #define PM_QOS_DEFAULT_VALUE -1
19 #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
20 #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
21 #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
23 struct pm_qos_request {
24 struct plist_node node;
30 PM_QOS_MAX, /* return the largest value */
31 PM_QOS_MIN /* return the smallest value */
35 * Note: The lockless read path depends on the CPU accessing
36 * target_value atomically. Atomic access is only guaranteed on all CPU
37 * types linux supports for 32 bit quantites
39 struct pm_qos_constraints {
40 struct plist_head list;
41 s32 target_value; /* Do not change to 64 bit */
43 enum pm_qos_type type;
44 struct blocking_notifier_head *notifiers;
47 /* Action requested to pm_qos_update_target */
48 enum pm_qos_req_action {
49 PM_QOS_ADD_REQ, /* Add a new request */
50 PM_QOS_UPDATE_REQ, /* Update an existing request */
51 PM_QOS_REMOVE_REQ /* Remove an existing request */
55 int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
56 enum pm_qos_req_action action, int value);
57 void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,
59 void pm_qos_update_request(struct pm_qos_request *req,
61 void pm_qos_remove_request(struct pm_qos_request *req);
63 int pm_qos_request(int pm_qos_class);
64 int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier);
65 int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
66 int pm_qos_request_active(struct pm_qos_request *req);
68 static inline int pm_qos_update_target(struct pm_qos_constraints *c,
69 struct plist_node *node,
70 enum pm_qos_req_action action,
73 static inline void pm_qos_add_request(struct pm_qos_request *req,
74 int pm_qos_class, s32 value)
76 static inline void pm_qos_update_request(struct pm_qos_request *req,
79 static inline void pm_qos_remove_request(struct pm_qos_request *req)
82 static inline int pm_qos_request(int pm_qos_class)
84 static inline int pm_qos_add_notifier(int pm_qos_class,
85 struct notifier_block *notifier)
87 static inline int pm_qos_remove_notifier(int pm_qos_class,
88 struct notifier_block *notifier)
90 static inline int pm_qos_request_active(struct pm_qos_request *req)