]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/linux/pm_opp.h
Merge tag 'microcode_fixes_for-3.21' of git://git.kernel.org/pub/scm/linux/kernel...
[mirror_ubuntu-artful-kernel.git] / include / linux / pm_opp.h
CommitLineData
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 20struct dev_pm_opp;
313162d0 21struct device;
e1f60b29 22
47d43ba7 23enum dev_pm_opp_event {
129eec55 24 OPP_EVENT_ADD, OPP_EVENT_REMOVE, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
03ca370f
MH
25};
26
e1f60b29
NM
27#if defined(CONFIG_PM_OPP)
28
47d43ba7 29unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
e1f60b29 30
47d43ba7 31unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
e1f60b29 32
5d4879cd 33int dev_pm_opp_get_opp_count(struct device *dev);
e1f60b29 34
47d43ba7
NM
35struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
36 unsigned long freq,
37 bool available);
e1f60b29 38
47d43ba7
NM
39struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
40 unsigned long *freq);
e1f60b29 41
47d43ba7
NM
42struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
43 unsigned long *freq);
e1f60b29 44
5d4879cd
NM
45int dev_pm_opp_add(struct device *dev, unsigned long freq,
46 unsigned long u_volt);
129eec55 47void dev_pm_opp_remove(struct device *dev, unsigned long freq);
e1f60b29 48
5d4879cd 49int dev_pm_opp_enable(struct device *dev, unsigned long freq);
e1f60b29 50
5d4879cd 51int dev_pm_opp_disable(struct device *dev, unsigned long freq);
e1f60b29 52
5d4879cd 53struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev);
e1f60b29 54#else
47d43ba7 55static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
e1f60b29
NM
56{
57 return 0;
58}
59
47d43ba7 60static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
e1f60b29
NM
61{
62 return 0;
63}
64
5d4879cd 65static inline int dev_pm_opp_get_opp_count(struct device *dev)
e1f60b29
NM
66{
67 return 0;
68}
69
47d43ba7 70static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
e1f60b29
NM
71 unsigned long freq, bool available)
72{
73 return ERR_PTR(-EINVAL);
74}
75
47d43ba7 76static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
e1f60b29
NM
77 unsigned long *freq)
78{
79 return ERR_PTR(-EINVAL);
80}
81
47d43ba7 82static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
e1f60b29
NM
83 unsigned long *freq)
84{
85 return ERR_PTR(-EINVAL);
86}
87
5d4879cd 88static inline int dev_pm_opp_add(struct device *dev, unsigned long freq,
e1f60b29
NM
89 unsigned long u_volt)
90{
91 return -EINVAL;
92}
93
129eec55
VK
94static inline void dev_pm_opp_remove(struct device *dev, unsigned long freq)
95{
96}
97
5d4879cd 98static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq)
e1f60b29
NM
99{
100 return 0;
101}
102
5d4879cd 103static inline int dev_pm_opp_disable(struct device *dev, unsigned long freq)
e1f60b29
NM
104{
105 return 0;
106}
03ca370f 107
5d4879cd
NM
108static inline struct srcu_notifier_head *dev_pm_opp_get_notifier(
109 struct device *dev)
03ca370f
MH
110{
111 return ERR_PTR(-EINVAL);
112}
a96d69d1 113#endif /* CONFIG_PM_OPP */
e1f60b29 114
d6561bb2
SG
115#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
116int of_init_opp_table(struct device *dev);
129eec55 117void of_free_opp_table(struct device *dev);
d6561bb2
SG
118#else
119static inline int of_init_opp_table(struct device *dev)
120{
121 return -EINVAL;
122}
129eec55
VK
123
124static inline void of_free_opp_table(struct device *dev)
125{
126}
d6561bb2
SG
127#endif
128
e1f60b29 129#endif /* __LINUX_OPP_H__ */