VSOCK: Introduce virtio_vsock_common.ko
[deliverable/linux.git] / include / linux / pm_opp.h
1 /*
2 * Generic OPP Interface
3 *
4 * Copyright (C) 2009-2010 Texas Instruments Incorporated.
5 * Nishanth Menon
6 * Romit Dasgupta
7 * Kevin Hilman
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14 #ifndef __LINUX_OPP_H__
15 #define __LINUX_OPP_H__
16
17 #include <linux/err.h>
18 #include <linux/notifier.h>
19
20 struct dev_pm_opp;
21 struct device;
22
23 enum dev_pm_opp_event {
24 OPP_EVENT_ADD, OPP_EVENT_REMOVE, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
25 };
26
27 #if defined(CONFIG_PM_OPP)
28
29 unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
30
31 unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
32
33 bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp);
34
35 int dev_pm_opp_get_opp_count(struct device *dev);
36 unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev);
37 unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev);
38 unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev);
39 struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev);
40
41 struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
42 unsigned long freq,
43 bool available);
44
45 struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
46 unsigned long *freq);
47
48 struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
49 unsigned long *freq);
50
51 int dev_pm_opp_add(struct device *dev, unsigned long freq,
52 unsigned long u_volt);
53 void dev_pm_opp_remove(struct device *dev, unsigned long freq);
54
55 int dev_pm_opp_enable(struct device *dev, unsigned long freq);
56
57 int dev_pm_opp_disable(struct device *dev, unsigned long freq);
58
59 struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev);
60 int dev_pm_opp_set_supported_hw(struct device *dev, const u32 *versions,
61 unsigned int count);
62 void dev_pm_opp_put_supported_hw(struct device *dev);
63 int dev_pm_opp_set_prop_name(struct device *dev, const char *name);
64 void dev_pm_opp_put_prop_name(struct device *dev);
65 int dev_pm_opp_set_regulator(struct device *dev, const char *name);
66 void dev_pm_opp_put_regulator(struct device *dev);
67 int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq);
68 int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask);
69 int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask);
70 void dev_pm_opp_remove_table(struct device *dev);
71 void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask);
72 #else
73 static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
74 {
75 return 0;
76 }
77
78 static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
79 {
80 return 0;
81 }
82
83 static inline bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp)
84 {
85 return false;
86 }
87
88 static inline int dev_pm_opp_get_opp_count(struct device *dev)
89 {
90 return 0;
91 }
92
93 static inline unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev)
94 {
95 return 0;
96 }
97
98 static inline unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
99 {
100 return 0;
101 }
102
103 static inline unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev)
104 {
105 return 0;
106 }
107
108 static inline struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev)
109 {
110 return NULL;
111 }
112
113 static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
114 unsigned long freq, bool available)
115 {
116 return ERR_PTR(-ENOTSUPP);
117 }
118
119 static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
120 unsigned long *freq)
121 {
122 return ERR_PTR(-ENOTSUPP);
123 }
124
125 static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
126 unsigned long *freq)
127 {
128 return ERR_PTR(-ENOTSUPP);
129 }
130
131 static inline int dev_pm_opp_add(struct device *dev, unsigned long freq,
132 unsigned long u_volt)
133 {
134 return -ENOTSUPP;
135 }
136
137 static inline void dev_pm_opp_remove(struct device *dev, unsigned long freq)
138 {
139 }
140
141 static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq)
142 {
143 return 0;
144 }
145
146 static inline int dev_pm_opp_disable(struct device *dev, unsigned long freq)
147 {
148 return 0;
149 }
150
151 static inline struct srcu_notifier_head *dev_pm_opp_get_notifier(
152 struct device *dev)
153 {
154 return ERR_PTR(-ENOTSUPP);
155 }
156
157 static inline int dev_pm_opp_set_supported_hw(struct device *dev,
158 const u32 *versions,
159 unsigned int count)
160 {
161 return -ENOTSUPP;
162 }
163
164 static inline void dev_pm_opp_put_supported_hw(struct device *dev) {}
165
166 static inline int dev_pm_opp_set_prop_name(struct device *dev, const char *name)
167 {
168 return -ENOTSUPP;
169 }
170
171 static inline void dev_pm_opp_put_prop_name(struct device *dev) {}
172
173 static inline int dev_pm_opp_set_regulator(struct device *dev, const char *name)
174 {
175 return -ENOTSUPP;
176 }
177
178 static inline void dev_pm_opp_put_regulator(struct device *dev) {}
179
180 static inline int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
181 {
182 return -ENOTSUPP;
183 }
184
185 static inline int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask)
186 {
187 return -ENOTSUPP;
188 }
189
190 static inline int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
191 {
192 return -EINVAL;
193 }
194
195 static inline void dev_pm_opp_remove_table(struct device *dev)
196 {
197 }
198
199 static inline void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask)
200 {
201 }
202
203 #endif /* CONFIG_PM_OPP */
204
205 #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
206 int dev_pm_opp_of_add_table(struct device *dev);
207 void dev_pm_opp_of_remove_table(struct device *dev);
208 int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask);
209 void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask);
210 int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask);
211 #else
212 static inline int dev_pm_opp_of_add_table(struct device *dev)
213 {
214 return -ENOTSUPP;
215 }
216
217 static inline void dev_pm_opp_of_remove_table(struct device *dev)
218 {
219 }
220
221 static inline int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask)
222 {
223 return -ENOTSUPP;
224 }
225
226 static inline void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask)
227 {
228 }
229
230 static inline int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
231 {
232 return -ENOTSUPP;
233 }
234 #endif
235
236 #endif /* __LINUX_OPP_H__ */
This page took 0.035876 seconds and 5 git commands to generate.