bpf: split eBPF out of NET
[linux-2.6/btrfs-unstable.git] / include / linux / pm_opp.h
blob0330217abfad912506ae3c4153ff93ee6ee84c21
1 /*
2 * Generic OPP Interface
4 * Copyright (C) 2009-2010 Texas Instruments Incorporated.
5 * Nishanth Menon
6 * Romit Dasgupta
7 * Kevin Hilman
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.
14 #ifndef __LINUX_OPP_H__
15 #define __LINUX_OPP_H__
17 #include <linux/err.h>
18 #include <linux/notifier.h>
20 struct dev_pm_opp;
21 struct device;
23 enum dev_pm_opp_event {
24 OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
27 #if defined(CONFIG_PM_OPP)
29 unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
31 unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
33 int dev_pm_opp_get_opp_count(struct device *dev);
35 struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
36 unsigned long freq,
37 bool available);
39 struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
40 unsigned long *freq);
42 struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
43 unsigned long *freq);
45 int dev_pm_opp_add(struct device *dev, unsigned long freq,
46 unsigned long u_volt);
48 int dev_pm_opp_enable(struct device *dev, unsigned long freq);
50 int dev_pm_opp_disable(struct device *dev, unsigned long freq);
52 struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev);
53 #else
54 static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
56 return 0;
59 static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
61 return 0;
64 static inline int dev_pm_opp_get_opp_count(struct device *dev)
66 return 0;
69 static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
70 unsigned long freq, bool available)
72 return ERR_PTR(-EINVAL);
75 static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
76 unsigned long *freq)
78 return ERR_PTR(-EINVAL);
81 static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
82 unsigned long *freq)
84 return ERR_PTR(-EINVAL);
87 static inline int dev_pm_opp_add(struct device *dev, unsigned long freq,
88 unsigned long u_volt)
90 return -EINVAL;
93 static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq)
95 return 0;
98 static inline int dev_pm_opp_disable(struct device *dev, unsigned long freq)
100 return 0;
103 static inline struct srcu_notifier_head *dev_pm_opp_get_notifier(
104 struct device *dev)
106 return ERR_PTR(-EINVAL);
108 #endif /* CONFIG_PM_OPP */
110 #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
111 int of_init_opp_table(struct device *dev);
112 #else
113 static inline int of_init_opp_table(struct device *dev)
115 return -EINVAL;
117 #endif
119 #endif /* __LINUX_OPP_H__ */