aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_opp.h
diff options
context:
space:
mode:
authorNishanth Menon <nm@ti.com>2013-09-19 17:03:52 -0400
committerRafael J. Wysocki <rjw@rjwysocki.net>2013-10-25 16:33:23 -0400
commite4db1c7439b31993a4886b273bb9235a8eea82bf (patch)
tree209058dd30b6793ad2f5598548063d5889b49328 /include/linux/pm_opp.h
parent47d43ba73eb98d8ba731208735c899129d9849e1 (diff)
PM / OPP: rename header to linux/pm_opp.h
Since Operating Performance Points (OPP) functions are specific to device specific power management, be specific and rename opp.h to pm_opp.h Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/pm_opp.h')
-rw-r--r--include/linux/pm_opp.h139
1 files changed, 139 insertions, 0 deletions
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
new file mode 100644
index 000000000000..5151b0059585
--- /dev/null
+++ b/include/linux/pm_opp.h
@@ -0,0 +1,139 @@
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/cpufreq.h>
19#include <linux/notifier.h>
20
21struct dev_pm_opp;
22struct device;
23
24enum dev_pm_opp_event {
25 OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
26};
27
28#if defined(CONFIG_PM_OPP)
29
30unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
31
32unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
33
34int dev_pm_opp_get_opp_count(struct device *dev);
35
36struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
37 unsigned long freq,
38 bool available);
39
40struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
41 unsigned long *freq);
42
43struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
44 unsigned long *freq);
45
46int dev_pm_opp_add(struct device *dev, unsigned long freq,
47 unsigned long u_volt);
48
49int dev_pm_opp_enable(struct device *dev, unsigned long freq);
50
51int dev_pm_opp_disable(struct device *dev, unsigned long freq);
52
53struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev);
54#else
55static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
56{
57 return 0;
58}
59
60static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
61{
62 return 0;
63}
64
65static inline int dev_pm_opp_get_opp_count(struct device *dev)
66{
67 return 0;
68}
69
70static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
71 unsigned long freq, bool available)
72{
73 return ERR_PTR(-EINVAL);
74}
75
76static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
77 unsigned long *freq)
78{
79 return ERR_PTR(-EINVAL);
80}
81
82static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
83 unsigned long *freq)
84{
85 return ERR_PTR(-EINVAL);
86}
87
88static inline int dev_pm_opp_add(struct device *dev, unsigned long freq,
89 unsigned long u_volt)
90{
91 return -EINVAL;
92}
93
94static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq)
95{
96 return 0;
97}
98
99static inline int dev_pm_opp_disable(struct device *dev, unsigned long freq)
100{
101 return 0;
102}
103
104static inline struct srcu_notifier_head *dev_pm_opp_get_notifier(
105 struct device *dev)
106{
107 return ERR_PTR(-EINVAL);
108}
109#endif /* CONFIG_PM_OPP */
110
111#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
112int of_init_opp_table(struct device *dev);
113#else
114static inline int of_init_opp_table(struct device *dev)
115{
116 return -EINVAL;
117}
118#endif
119
120#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
121int dev_pm_opp_init_cpufreq_table(struct device *dev,
122 struct cpufreq_frequency_table **table);
123void dev_pm_opp_free_cpufreq_table(struct device *dev,
124 struct cpufreq_frequency_table **table);
125#else
126static inline int dev_pm_opp_init_cpufreq_table(struct device *dev,
127 struct cpufreq_frequency_table **table)
128{
129 return -EINVAL;
130}
131
132static inline
133void dev_pm_opp_free_cpufreq_table(struct device *dev,
134 struct cpufreq_frequency_table **table)
135{
136}
137#endif /* CONFIG_CPU_FREQ */
138
139#endif /* __LINUX_OPP_H__ */