]>
Commit | Line | Data |
---|---|---|
e1f60b29 NM |
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> | |
03ca370f | 18 | #include <linux/notifier.h> |
e1f60b29 | 19 | |
47d43ba7 | 20 | struct dev_pm_opp; |
313162d0 | 21 | struct device; |
e1f60b29 | 22 | |
47d43ba7 | 23 | enum dev_pm_opp_event { |
03ca370f MH |
24 | OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, |
25 | }; | |
26 | ||
e1f60b29 NM |
27 | #if defined(CONFIG_PM_OPP) |
28 | ||
47d43ba7 | 29 | unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp); |
e1f60b29 | 30 | |
47d43ba7 | 31 | unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp); |
e1f60b29 | 32 | |
5d4879cd | 33 | int dev_pm_opp_get_opp_count(struct device *dev); |
e1f60b29 | 34 | |
47d43ba7 NM |
35 | struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev, |
36 | unsigned long freq, | |
37 | bool available); | |
e1f60b29 | 38 | |
47d43ba7 NM |
39 | struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev, |
40 | unsigned long *freq); | |
e1f60b29 | 41 | |
47d43ba7 NM |
42 | struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, |
43 | unsigned long *freq); | |
e1f60b29 | 44 | |
5d4879cd NM |
45 | int dev_pm_opp_add(struct device *dev, unsigned long freq, |
46 | unsigned long u_volt); | |
e1f60b29 | 47 | |
5d4879cd | 48 | int dev_pm_opp_enable(struct device *dev, unsigned long freq); |
e1f60b29 | 49 | |
5d4879cd | 50 | int dev_pm_opp_disable(struct device *dev, unsigned long freq); |
e1f60b29 | 51 | |
5d4879cd | 52 | struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev); |
e1f60b29 | 53 | #else |
47d43ba7 | 54 | static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp) |
e1f60b29 NM |
55 | { |
56 | return 0; | |
57 | } | |
58 | ||
47d43ba7 | 59 | static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp) |
e1f60b29 NM |
60 | { |
61 | return 0; | |
62 | } | |
63 | ||
5d4879cd | 64 | static inline int dev_pm_opp_get_opp_count(struct device *dev) |
e1f60b29 NM |
65 | { |
66 | return 0; | |
67 | } | |
68 | ||
47d43ba7 | 69 | static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev, |
e1f60b29 NM |
70 | unsigned long freq, bool available) |
71 | { | |
72 | return ERR_PTR(-EINVAL); | |
73 | } | |
74 | ||
47d43ba7 | 75 | static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev, |
e1f60b29 NM |
76 | unsigned long *freq) |
77 | { | |
78 | return ERR_PTR(-EINVAL); | |
79 | } | |
80 | ||
47d43ba7 | 81 | static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, |
e1f60b29 NM |
82 | unsigned long *freq) |
83 | { | |
84 | return ERR_PTR(-EINVAL); | |
85 | } | |
86 | ||
5d4879cd | 87 | static inline int dev_pm_opp_add(struct device *dev, unsigned long freq, |
e1f60b29 NM |
88 | unsigned long u_volt) |
89 | { | |
90 | return -EINVAL; | |
91 | } | |
92 | ||
5d4879cd | 93 | static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) |
e1f60b29 NM |
94 | { |
95 | return 0; | |
96 | } | |
97 | ||
5d4879cd | 98 | static inline int dev_pm_opp_disable(struct device *dev, unsigned long freq) |
e1f60b29 NM |
99 | { |
100 | return 0; | |
101 | } | |
03ca370f | 102 | |
5d4879cd NM |
103 | static inline struct srcu_notifier_head *dev_pm_opp_get_notifier( |
104 | struct device *dev) | |
03ca370f MH |
105 | { |
106 | return ERR_PTR(-EINVAL); | |
107 | } | |
a96d69d1 | 108 | #endif /* CONFIG_PM_OPP */ |
e1f60b29 | 109 | |
d6561bb2 SG |
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) | |
114 | { | |
115 | return -EINVAL; | |
116 | } | |
117 | #endif | |
118 | ||
e1f60b29 | 119 | #endif /* __LINUX_OPP_H__ */ |