ASoC: Fix section mismatch in wm8995.c
[linux-2.6/next.git] / include / linux / opp.h
blob5449945d589f994ed5ac25f018ced4a5dc81db30
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/cpufreq.h>
20 struct opp;
22 #if defined(CONFIG_PM_OPP)
24 unsigned long opp_get_voltage(struct opp *opp);
26 unsigned long opp_get_freq(struct opp *opp);
28 int opp_get_opp_count(struct device *dev);
30 struct opp *opp_find_freq_exact(struct device *dev, unsigned long freq,
31 bool available);
33 struct opp *opp_find_freq_floor(struct device *dev, unsigned long *freq);
35 struct opp *opp_find_freq_ceil(struct device *dev, unsigned long *freq);
37 int opp_add(struct device *dev, unsigned long freq, unsigned long u_volt);
39 int opp_enable(struct device *dev, unsigned long freq);
41 int opp_disable(struct device *dev, unsigned long freq);
43 #else
44 static inline unsigned long opp_get_voltage(struct opp *opp)
46 return 0;
49 static inline unsigned long opp_get_freq(struct opp *opp)
51 return 0;
54 static inline int opp_get_opp_count(struct device *dev)
56 return 0;
59 static inline struct opp *opp_find_freq_exact(struct device *dev,
60 unsigned long freq, bool available)
62 return ERR_PTR(-EINVAL);
65 static inline struct opp *opp_find_freq_floor(struct device *dev,
66 unsigned long *freq)
68 return ERR_PTR(-EINVAL);
71 static inline struct opp *opp_find_freq_ceil(struct device *dev,
72 unsigned long *freq)
74 return ERR_PTR(-EINVAL);
77 static inline int opp_add(struct device *dev, unsigned long freq,
78 unsigned long u_volt)
80 return -EINVAL;
83 static inline int opp_enable(struct device *dev, unsigned long freq)
85 return 0;
88 static inline int opp_disable(struct device *dev, unsigned long freq)
90 return 0;
92 #endif /* CONFIG_PM */
94 #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
95 int opp_init_cpufreq_table(struct device *dev,
96 struct cpufreq_frequency_table **table);
97 #else
98 static inline int opp_init_cpufreq_table(struct device *dev,
99 struct cpufreq_frequency_table **table)
101 return -EINVAL;
103 #endif /* CONFIG_CPU_FREQ */
105 #endif /* __LINUX_OPP_H__ */