]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/linux/opp.h
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>
25 OPP_EVENT_ADD
, OPP_EVENT_ENABLE
, OPP_EVENT_DISABLE
,
28 #if defined(CONFIG_PM_OPP)
30 unsigned long dev_pm_opp_get_voltage(struct opp
*opp
);
32 unsigned long dev_pm_opp_get_freq(struct opp
*opp
);
34 int dev_pm_opp_get_opp_count(struct device
*dev
);
36 struct opp
*dev_pm_opp_find_freq_exact(struct device
*dev
, unsigned long freq
,
39 struct opp
*dev_pm_opp_find_freq_floor(struct device
*dev
, unsigned long *freq
);
41 struct opp
*dev_pm_opp_find_freq_ceil(struct device
*dev
, unsigned long *freq
);
43 int dev_pm_opp_add(struct device
*dev
, unsigned long freq
,
44 unsigned long u_volt
);
46 int dev_pm_opp_enable(struct device
*dev
, unsigned long freq
);
48 int dev_pm_opp_disable(struct device
*dev
, unsigned long freq
);
50 struct srcu_notifier_head
*dev_pm_opp_get_notifier(struct device
*dev
);
52 static inline unsigned long dev_pm_opp_get_voltage(struct opp
*opp
)
57 static inline unsigned long dev_pm_opp_get_freq(struct opp
*opp
)
62 static inline int dev_pm_opp_get_opp_count(struct device
*dev
)
67 static inline struct opp
*dev_pm_opp_find_freq_exact(struct device
*dev
,
68 unsigned long freq
, bool available
)
70 return ERR_PTR(-EINVAL
);
73 static inline struct opp
*dev_pm_opp_find_freq_floor(struct device
*dev
,
76 return ERR_PTR(-EINVAL
);
79 static inline struct opp
*dev_pm_opp_find_freq_ceil(struct device
*dev
,
82 return ERR_PTR(-EINVAL
);
85 static inline int dev_pm_opp_add(struct device
*dev
, unsigned long freq
,
91 static inline int dev_pm_opp_enable(struct device
*dev
, unsigned long freq
)
96 static inline int dev_pm_opp_disable(struct device
*dev
, unsigned long freq
)
101 static inline struct srcu_notifier_head
*dev_pm_opp_get_notifier(
104 return ERR_PTR(-EINVAL
);
106 #endif /* CONFIG_PM_OPP */
108 #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
109 int of_init_opp_table(struct device
*dev
);
111 static inline int of_init_opp_table(struct device
*dev
)
117 #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
118 int dev_pm_opp_init_cpufreq_table(struct device
*dev
,
119 struct cpufreq_frequency_table
**table
);
120 void dev_pm_opp_free_cpufreq_table(struct device
*dev
,
121 struct cpufreq_frequency_table
**table
);
123 static inline int dev_pm_opp_init_cpufreq_table(struct device
*dev
,
124 struct cpufreq_frequency_table
**table
)
130 void dev_pm_opp_free_cpufreq_table(struct device
*dev
,
131 struct cpufreq_frequency_table
**table
)
134 #endif /* CONFIG_CPU_FREQ */
136 #endif /* __LINUX_OPP_H__ */