source: GPL/trunk/include/linux/pm_qos.h

Last change on this file was 679, checked in by David Azarewicz, 4 years ago

Merge changes from Paul's uniaud32next branch.

File size: 2.5 KB
Line 
1#ifndef _LINUX_PM_QOS_H
2#define _LINUX_PM_QOS_H
3
4#define PM_QOS_RESERVED 0
5#define PM_QOS_CPU_DMA_LATENCY 1
6#define PM_QOS_NETWORK_LATENCY 2
7#define PM_QOS_NETWORK_THROUGHPUT 3
8
9#define PM_QOS_NUM_CLASSES 4
10#define PM_QOS_DEFAULT_VALUE -1
11
12#include <linux/version.h>
13#include <linux/plist.h>
14#include <linux/notifier.h>
15#include <linux/device.h>
16#include <linux/workqueue.h>
17
18enum dev_pm_qos_req_type {
19 DEV_PM_QOS_RESUME_LATENCY = 1,
20 DEV_PM_QOS_LATENCY_TOLERANCE,
21 DEV_PM_QOS_FLAGS,
22};
23
24struct pm_qos_flags_request {
25 struct list_head node;
26 s32 flags; /* Do not change to 64 bit */
27};
28
29struct dev_pm_qos_request {
30 enum dev_pm_qos_req_type type;
31 union {
32 struct plist_node pnode;
33 struct pm_qos_flags_request flr;
34 } data;
35 struct device *dev;
36};
37
38struct pm_qos_request {
39 struct plist_node node;
40 int pm_qos_class;
41 struct delayed_work work; /* for pm_qos_update_request_timeout */
42};
43
44#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
45#include <linux/latency.h>
46
47static inline int pm_qos_add_requirement(int qos, char *name, s32 value)
48{
49 set_acceptable_latency(name, value);
50 return 0;
51}
52
53static inline void pm_qos_remove_requirement(int qos, char *name)
54{
55 remove_acceptable_latency(name);
56}
57
58#else
59
60static inline int pm_qos_add_requirement(int qos, char *name, s32 value)
61{
62 return 0;
63}
64
65static inline void pm_qos_remove_requirement(int qos, char *name)
66{
67}
68
69static inline int dev_pm_qos_request_active(struct dev_pm_qos_request *req)
70{
71 return req->dev != NULL;
72}
73
74static inline void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,
75 s32 value) {}
76static inline void pm_qos_update_request(struct pm_qos_request *req,
77 s32 new_value) {}
78static inline void pm_qos_update_request_timeout(struct pm_qos_request *req,
79 s32 new_value, unsigned long timeout_us) {}
80static inline void pm_qos_remove_request(struct pm_qos_request *req) {}
81
82static inline int pm_qos_request_active(struct pm_qos_request *req)
83{
84 return 0;
85}
86#endif /* >= 2.6.19 */
87
88static inline s32 cpu_latency_qos_limit(void) { return INT_MAX; }
89static inline bool cpu_latency_qos_request_active(struct pm_qos_request *req)
90{
91 return false;
92}
93static inline void cpu_latency_qos_add_request(struct pm_qos_request *req,
94 s32 value) {}
95static inline void cpu_latency_qos_update_request(struct pm_qos_request *req,
96 s32 new_value) {}
97static inline void cpu_latency_qos_remove_request(struct pm_qos_request *req) {}
98
99#endif /* _LINUX_PM_QOS_H */
Note: See TracBrowser for help on using the repository browser.