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