2 * Generic OPP Interface
4 * Copyright (C) 2009-2010 Texas Instruments Incorporated.
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/cpufreq.h>
19 #include <linux/notifier.h>
24 OPP_EVENT_ADD
, OPP_EVENT_ENABLE
, OPP_EVENT_DISABLE
,
27 #if defined(CONFIG_PM_OPP)
29 unsigned long opp_get_voltage(struct opp
*opp
);
31 unsigned long opp_get_freq(struct opp
*opp
);
33 int opp_get_opp_count(struct device
*dev
);
35 struct opp
*opp_find_freq_exact(struct device
*dev
, unsigned long freq
,
38 struct opp
*opp_find_freq_floor(struct device
*dev
, unsigned long *freq
);
40 struct opp
*opp_find_freq_ceil(struct device
*dev
, unsigned long *freq
);
42 int opp_add(struct device
*dev
, unsigned long freq
, unsigned long u_volt
);
44 int opp_enable(struct device
*dev
, unsigned long freq
);
46 int opp_disable(struct device
*dev
, unsigned long freq
);
48 struct srcu_notifier_head
*opp_get_notifier(struct device
*dev
);
51 static inline unsigned long opp_get_voltage(struct opp
*opp
)
56 static inline unsigned long opp_get_freq(struct opp
*opp
)
61 static inline int opp_get_opp_count(struct device
*dev
)
66 static inline struct opp
*opp_find_freq_exact(struct device
*dev
,
67 unsigned long freq
, bool available
)
69 return ERR_PTR(-EINVAL
);
72 static inline struct opp
*opp_find_freq_floor(struct device
*dev
,
75 return ERR_PTR(-EINVAL
);
78 static inline struct opp
*opp_find_freq_ceil(struct device
*dev
,
81 return ERR_PTR(-EINVAL
);
84 static inline int opp_add(struct device
*dev
, unsigned long freq
,
90 static inline int opp_enable(struct device
*dev
, unsigned long freq
)
95 static inline int opp_disable(struct device
*dev
, unsigned long freq
)
100 static inline struct srcu_notifier_head
*opp_get_notifier(struct device
*dev
)
102 return ERR_PTR(-EINVAL
);
104 #endif /* CONFIG_PM_OPP */
106 #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
107 int opp_init_cpufreq_table(struct device
*dev
,
108 struct cpufreq_frequency_table
**table
);
109 void opp_free_cpufreq_table(struct device
*dev
,
110 struct cpufreq_frequency_table
**table
);
112 static inline int opp_init_cpufreq_table(struct device
*dev
,
113 struct cpufreq_frequency_table
**table
)
119 void opp_free_cpufreq_table(struct device
*dev
,
120 struct cpufreq_frequency_table
**table
)
123 #endif /* CONFIG_CPU_FREQ */
125 #endif /* __LINUX_OPP_H__ */