xref: /OK3568_Linux_fs/kernel/include/linux/pm_opp.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Generic OPP Interface
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright (C) 2009-2010 Texas Instruments Incorporated.
6*4882a593Smuzhiyun  *	Nishanth Menon
7*4882a593Smuzhiyun  *	Romit Dasgupta
8*4882a593Smuzhiyun  *	Kevin Hilman
9*4882a593Smuzhiyun  */
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #ifndef __LINUX_OPP_H__
12*4882a593Smuzhiyun #define __LINUX_OPP_H__
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #include <linux/energy_model.h>
15*4882a593Smuzhiyun #include <linux/err.h>
16*4882a593Smuzhiyun #include <linux/notifier.h>
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun struct clk;
19*4882a593Smuzhiyun struct regulator;
20*4882a593Smuzhiyun struct dev_pm_opp;
21*4882a593Smuzhiyun struct device;
22*4882a593Smuzhiyun struct opp_table;
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun enum dev_pm_opp_event {
25*4882a593Smuzhiyun 	OPP_EVENT_ADD, OPP_EVENT_REMOVE, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
26*4882a593Smuzhiyun 	OPP_EVENT_ADJUST_VOLTAGE,
27*4882a593Smuzhiyun };
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun /**
30*4882a593Smuzhiyun  * struct dev_pm_opp_supply - Power supply voltage/current values
31*4882a593Smuzhiyun  * @u_volt:	Target voltage in microvolts corresponding to this OPP
32*4882a593Smuzhiyun  * @u_volt_min:	Minimum voltage in microvolts corresponding to this OPP
33*4882a593Smuzhiyun  * @u_volt_max:	Maximum voltage in microvolts corresponding to this OPP
34*4882a593Smuzhiyun  * @u_amp:	Maximum current drawn by the device in microamperes
35*4882a593Smuzhiyun  *
36*4882a593Smuzhiyun  * This structure stores the voltage/current values for a single power supply.
37*4882a593Smuzhiyun  */
38*4882a593Smuzhiyun struct dev_pm_opp_supply {
39*4882a593Smuzhiyun 	unsigned long u_volt;
40*4882a593Smuzhiyun 	unsigned long u_volt_min;
41*4882a593Smuzhiyun 	unsigned long u_volt_max;
42*4882a593Smuzhiyun 	unsigned long u_amp;
43*4882a593Smuzhiyun };
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun /**
46*4882a593Smuzhiyun  * struct dev_pm_opp_icc_bw - Interconnect bandwidth values
47*4882a593Smuzhiyun  * @avg:	Average bandwidth corresponding to this OPP (in icc units)
48*4882a593Smuzhiyun  * @peak:	Peak bandwidth corresponding to this OPP (in icc units)
49*4882a593Smuzhiyun  *
50*4882a593Smuzhiyun  * This structure stores the bandwidth values for a single interconnect path.
51*4882a593Smuzhiyun  */
52*4882a593Smuzhiyun struct dev_pm_opp_icc_bw {
53*4882a593Smuzhiyun 	u32 avg;
54*4882a593Smuzhiyun 	u32 peak;
55*4882a593Smuzhiyun };
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun /**
58*4882a593Smuzhiyun  * struct dev_pm_opp_info - OPP freq/voltage/current values
59*4882a593Smuzhiyun  * @rate:	Target clk rate in hz
60*4882a593Smuzhiyun  * @supplies:	Array of voltage/current values for all power supplies
61*4882a593Smuzhiyun  *
62*4882a593Smuzhiyun  * This structure stores the freq/voltage/current values for a single OPP.
63*4882a593Smuzhiyun  */
64*4882a593Smuzhiyun struct dev_pm_opp_info {
65*4882a593Smuzhiyun 	unsigned long rate;
66*4882a593Smuzhiyun 	struct dev_pm_opp_supply *supplies;
67*4882a593Smuzhiyun };
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun /**
70*4882a593Smuzhiyun  * struct dev_pm_set_opp_data - Set OPP data
71*4882a593Smuzhiyun  * @old_opp:	Old OPP info
72*4882a593Smuzhiyun  * @new_opp:	New OPP info
73*4882a593Smuzhiyun  * @regulators:	Array of regulator pointers
74*4882a593Smuzhiyun  * @regulator_count: Number of regulators
75*4882a593Smuzhiyun  * @clk:	Pointer to clk
76*4882a593Smuzhiyun  * @dev:	Pointer to the struct device
77*4882a593Smuzhiyun  *
78*4882a593Smuzhiyun  * This structure contains all information required for setting an OPP.
79*4882a593Smuzhiyun  */
80*4882a593Smuzhiyun struct dev_pm_set_opp_data {
81*4882a593Smuzhiyun 	struct dev_pm_opp_info old_opp;
82*4882a593Smuzhiyun 	struct dev_pm_opp_info new_opp;
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun 	struct regulator **regulators;
85*4882a593Smuzhiyun 	unsigned int regulator_count;
86*4882a593Smuzhiyun 	struct clk *clk;
87*4882a593Smuzhiyun 	struct device *dev;
88*4882a593Smuzhiyun };
89*4882a593Smuzhiyun 
90*4882a593Smuzhiyun #if defined(CONFIG_PM_OPP)
91*4882a593Smuzhiyun 
92*4882a593Smuzhiyun struct opp_table *dev_pm_opp_get_opp_table(struct device *dev);
93*4882a593Smuzhiyun struct opp_table *dev_pm_opp_get_opp_table_indexed(struct device *dev, int index);
94*4882a593Smuzhiyun void dev_pm_opp_put_opp_table(struct opp_table *opp_table);
95*4882a593Smuzhiyun 
96*4882a593Smuzhiyun unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
97*4882a593Smuzhiyun 
98*4882a593Smuzhiyun unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
99*4882a593Smuzhiyun 
100*4882a593Smuzhiyun unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp);
101*4882a593Smuzhiyun 
102*4882a593Smuzhiyun bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp);
103*4882a593Smuzhiyun 
104*4882a593Smuzhiyun int dev_pm_opp_get_opp_count(struct device *dev);
105*4882a593Smuzhiyun unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev);
106*4882a593Smuzhiyun unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev);
107*4882a593Smuzhiyun unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev);
108*4882a593Smuzhiyun unsigned long dev_pm_opp_get_suspend_opp_freq(struct device *dev);
109*4882a593Smuzhiyun 
110*4882a593Smuzhiyun struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
111*4882a593Smuzhiyun 					      unsigned long freq,
112*4882a593Smuzhiyun 					      bool available);
113*4882a593Smuzhiyun struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev,
114*4882a593Smuzhiyun 					       unsigned int level);
115*4882a593Smuzhiyun 
116*4882a593Smuzhiyun struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
117*4882a593Smuzhiyun 					      unsigned long *freq);
118*4882a593Smuzhiyun struct dev_pm_opp *dev_pm_opp_find_freq_ceil_by_volt(struct device *dev,
119*4882a593Smuzhiyun 						     unsigned long u_volt);
120*4882a593Smuzhiyun 
121*4882a593Smuzhiyun struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
122*4882a593Smuzhiyun 					     unsigned long *freq);
123*4882a593Smuzhiyun void dev_pm_opp_put(struct dev_pm_opp *opp);
124*4882a593Smuzhiyun 
125*4882a593Smuzhiyun int dev_pm_opp_add(struct device *dev, unsigned long freq,
126*4882a593Smuzhiyun 		   unsigned long u_volt);
127*4882a593Smuzhiyun void dev_pm_opp_remove(struct device *dev, unsigned long freq);
128*4882a593Smuzhiyun void dev_pm_opp_remove_all_dynamic(struct device *dev);
129*4882a593Smuzhiyun 
130*4882a593Smuzhiyun int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq,
131*4882a593Smuzhiyun 			      unsigned long u_volt, unsigned long u_volt_min,
132*4882a593Smuzhiyun 			      unsigned long u_volt_max);
133*4882a593Smuzhiyun 
134*4882a593Smuzhiyun int dev_pm_opp_enable(struct device *dev, unsigned long freq);
135*4882a593Smuzhiyun 
136*4882a593Smuzhiyun int dev_pm_opp_disable(struct device *dev, unsigned long freq);
137*4882a593Smuzhiyun 
138*4882a593Smuzhiyun int dev_pm_opp_register_notifier(struct device *dev, struct notifier_block *nb);
139*4882a593Smuzhiyun int dev_pm_opp_unregister_notifier(struct device *dev, struct notifier_block *nb);
140*4882a593Smuzhiyun 
141*4882a593Smuzhiyun struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, unsigned int count);
142*4882a593Smuzhiyun void dev_pm_opp_put_supported_hw(struct opp_table *opp_table);
143*4882a593Smuzhiyun struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name);
144*4882a593Smuzhiyun void dev_pm_opp_put_prop_name(struct opp_table *opp_table);
145*4882a593Smuzhiyun struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count);
146*4882a593Smuzhiyun void dev_pm_opp_put_regulators(struct opp_table *opp_table);
147*4882a593Smuzhiyun struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name);
148*4882a593Smuzhiyun void dev_pm_opp_put_clkname(struct opp_table *opp_table);
149*4882a593Smuzhiyun struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data));
150*4882a593Smuzhiyun void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table);
151*4882a593Smuzhiyun struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names, struct device ***virt_devs);
152*4882a593Smuzhiyun void dev_pm_opp_detach_genpd(struct opp_table *opp_table);
153*4882a593Smuzhiyun int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate);
154*4882a593Smuzhiyun int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq);
155*4882a593Smuzhiyun int dev_pm_opp_set_bw(struct device *dev, struct dev_pm_opp *opp);
156*4882a593Smuzhiyun int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask);
157*4882a593Smuzhiyun int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask);
158*4882a593Smuzhiyun void dev_pm_opp_remove_table(struct device *dev);
159*4882a593Smuzhiyun void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask);
160*4882a593Smuzhiyun #else
dev_pm_opp_get_opp_table(struct device * dev)161*4882a593Smuzhiyun static inline struct opp_table *dev_pm_opp_get_opp_table(struct device *dev)
162*4882a593Smuzhiyun {
163*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
164*4882a593Smuzhiyun }
165*4882a593Smuzhiyun 
dev_pm_opp_get_opp_table_indexed(struct device * dev,int index)166*4882a593Smuzhiyun static inline struct opp_table *dev_pm_opp_get_opp_table_indexed(struct device *dev, int index)
167*4882a593Smuzhiyun {
168*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
169*4882a593Smuzhiyun }
170*4882a593Smuzhiyun 
dev_pm_opp_put_opp_table(struct opp_table * opp_table)171*4882a593Smuzhiyun static inline void dev_pm_opp_put_opp_table(struct opp_table *opp_table) {}
172*4882a593Smuzhiyun 
dev_pm_opp_get_voltage(struct dev_pm_opp * opp)173*4882a593Smuzhiyun static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
174*4882a593Smuzhiyun {
175*4882a593Smuzhiyun 	return 0;
176*4882a593Smuzhiyun }
177*4882a593Smuzhiyun 
dev_pm_opp_get_freq(struct dev_pm_opp * opp)178*4882a593Smuzhiyun static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
179*4882a593Smuzhiyun {
180*4882a593Smuzhiyun 	return 0;
181*4882a593Smuzhiyun }
182*4882a593Smuzhiyun 
dev_pm_opp_get_level(struct dev_pm_opp * opp)183*4882a593Smuzhiyun static inline unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp)
184*4882a593Smuzhiyun {
185*4882a593Smuzhiyun 	return 0;
186*4882a593Smuzhiyun }
187*4882a593Smuzhiyun 
dev_pm_opp_is_turbo(struct dev_pm_opp * opp)188*4882a593Smuzhiyun static inline bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp)
189*4882a593Smuzhiyun {
190*4882a593Smuzhiyun 	return false;
191*4882a593Smuzhiyun }
192*4882a593Smuzhiyun 
dev_pm_opp_get_opp_count(struct device * dev)193*4882a593Smuzhiyun static inline int dev_pm_opp_get_opp_count(struct device *dev)
194*4882a593Smuzhiyun {
195*4882a593Smuzhiyun 	return 0;
196*4882a593Smuzhiyun }
197*4882a593Smuzhiyun 
dev_pm_opp_get_max_clock_latency(struct device * dev)198*4882a593Smuzhiyun static inline unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev)
199*4882a593Smuzhiyun {
200*4882a593Smuzhiyun 	return 0;
201*4882a593Smuzhiyun }
202*4882a593Smuzhiyun 
dev_pm_opp_get_max_volt_latency(struct device * dev)203*4882a593Smuzhiyun static inline unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
204*4882a593Smuzhiyun {
205*4882a593Smuzhiyun 	return 0;
206*4882a593Smuzhiyun }
207*4882a593Smuzhiyun 
dev_pm_opp_get_max_transition_latency(struct device * dev)208*4882a593Smuzhiyun static inline unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev)
209*4882a593Smuzhiyun {
210*4882a593Smuzhiyun 	return 0;
211*4882a593Smuzhiyun }
212*4882a593Smuzhiyun 
dev_pm_opp_get_suspend_opp_freq(struct device * dev)213*4882a593Smuzhiyun static inline unsigned long dev_pm_opp_get_suspend_opp_freq(struct device *dev)
214*4882a593Smuzhiyun {
215*4882a593Smuzhiyun 	return 0;
216*4882a593Smuzhiyun }
217*4882a593Smuzhiyun 
dev_pm_opp_find_freq_exact(struct device * dev,unsigned long freq,bool available)218*4882a593Smuzhiyun static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
219*4882a593Smuzhiyun 					unsigned long freq, bool available)
220*4882a593Smuzhiyun {
221*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
222*4882a593Smuzhiyun }
223*4882a593Smuzhiyun 
dev_pm_opp_find_level_exact(struct device * dev,unsigned int level)224*4882a593Smuzhiyun static inline struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev,
225*4882a593Smuzhiyun 					unsigned int level)
226*4882a593Smuzhiyun {
227*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
228*4882a593Smuzhiyun }
229*4882a593Smuzhiyun 
dev_pm_opp_find_freq_floor(struct device * dev,unsigned long * freq)230*4882a593Smuzhiyun static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
231*4882a593Smuzhiyun 					unsigned long *freq)
232*4882a593Smuzhiyun {
233*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
234*4882a593Smuzhiyun }
235*4882a593Smuzhiyun 
dev_pm_opp_find_freq_ceil_by_volt(struct device * dev,unsigned long u_volt)236*4882a593Smuzhiyun static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil_by_volt(struct device *dev,
237*4882a593Smuzhiyun 					unsigned long u_volt)
238*4882a593Smuzhiyun {
239*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
240*4882a593Smuzhiyun }
241*4882a593Smuzhiyun 
dev_pm_opp_find_freq_ceil(struct device * dev,unsigned long * freq)242*4882a593Smuzhiyun static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
243*4882a593Smuzhiyun 					unsigned long *freq)
244*4882a593Smuzhiyun {
245*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
246*4882a593Smuzhiyun }
247*4882a593Smuzhiyun 
dev_pm_opp_put(struct dev_pm_opp * opp)248*4882a593Smuzhiyun static inline void dev_pm_opp_put(struct dev_pm_opp *opp) {}
249*4882a593Smuzhiyun 
dev_pm_opp_add(struct device * dev,unsigned long freq,unsigned long u_volt)250*4882a593Smuzhiyun static inline int dev_pm_opp_add(struct device *dev, unsigned long freq,
251*4882a593Smuzhiyun 					unsigned long u_volt)
252*4882a593Smuzhiyun {
253*4882a593Smuzhiyun 	return -ENOTSUPP;
254*4882a593Smuzhiyun }
255*4882a593Smuzhiyun 
dev_pm_opp_remove(struct device * dev,unsigned long freq)256*4882a593Smuzhiyun static inline void dev_pm_opp_remove(struct device *dev, unsigned long freq)
257*4882a593Smuzhiyun {
258*4882a593Smuzhiyun }
259*4882a593Smuzhiyun 
dev_pm_opp_remove_all_dynamic(struct device * dev)260*4882a593Smuzhiyun static inline void dev_pm_opp_remove_all_dynamic(struct device *dev)
261*4882a593Smuzhiyun {
262*4882a593Smuzhiyun }
263*4882a593Smuzhiyun 
264*4882a593Smuzhiyun static inline int
dev_pm_opp_adjust_voltage(struct device * dev,unsigned long freq,unsigned long u_volt,unsigned long u_volt_min,unsigned long u_volt_max)265*4882a593Smuzhiyun dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq,
266*4882a593Smuzhiyun 			  unsigned long u_volt, unsigned long u_volt_min,
267*4882a593Smuzhiyun 			  unsigned long u_volt_max)
268*4882a593Smuzhiyun {
269*4882a593Smuzhiyun 	return 0;
270*4882a593Smuzhiyun }
271*4882a593Smuzhiyun 
dev_pm_opp_enable(struct device * dev,unsigned long freq)272*4882a593Smuzhiyun static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq)
273*4882a593Smuzhiyun {
274*4882a593Smuzhiyun 	return 0;
275*4882a593Smuzhiyun }
276*4882a593Smuzhiyun 
dev_pm_opp_disable(struct device * dev,unsigned long freq)277*4882a593Smuzhiyun static inline int dev_pm_opp_disable(struct device *dev, unsigned long freq)
278*4882a593Smuzhiyun {
279*4882a593Smuzhiyun 	return 0;
280*4882a593Smuzhiyun }
281*4882a593Smuzhiyun 
dev_pm_opp_register_notifier(struct device * dev,struct notifier_block * nb)282*4882a593Smuzhiyun static inline int dev_pm_opp_register_notifier(struct device *dev, struct notifier_block *nb)
283*4882a593Smuzhiyun {
284*4882a593Smuzhiyun 	return -ENOTSUPP;
285*4882a593Smuzhiyun }
286*4882a593Smuzhiyun 
dev_pm_opp_unregister_notifier(struct device * dev,struct notifier_block * nb)287*4882a593Smuzhiyun static inline int dev_pm_opp_unregister_notifier(struct device *dev, struct notifier_block *nb)
288*4882a593Smuzhiyun {
289*4882a593Smuzhiyun 	return -ENOTSUPP;
290*4882a593Smuzhiyun }
291*4882a593Smuzhiyun 
dev_pm_opp_set_supported_hw(struct device * dev,const u32 * versions,unsigned int count)292*4882a593Smuzhiyun static inline struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev,
293*4882a593Smuzhiyun 							    const u32 *versions,
294*4882a593Smuzhiyun 							    unsigned int count)
295*4882a593Smuzhiyun {
296*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
297*4882a593Smuzhiyun }
298*4882a593Smuzhiyun 
dev_pm_opp_put_supported_hw(struct opp_table * opp_table)299*4882a593Smuzhiyun static inline void dev_pm_opp_put_supported_hw(struct opp_table *opp_table) {}
300*4882a593Smuzhiyun 
dev_pm_opp_register_set_opp_helper(struct device * dev,int (* set_opp)(struct dev_pm_set_opp_data * data))301*4882a593Smuzhiyun static inline struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev,
302*4882a593Smuzhiyun 			int (*set_opp)(struct dev_pm_set_opp_data *data))
303*4882a593Smuzhiyun {
304*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
305*4882a593Smuzhiyun }
306*4882a593Smuzhiyun 
dev_pm_opp_unregister_set_opp_helper(struct opp_table * opp_table)307*4882a593Smuzhiyun static inline void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table) {}
308*4882a593Smuzhiyun 
dev_pm_opp_set_prop_name(struct device * dev,const char * name)309*4882a593Smuzhiyun static inline struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name)
310*4882a593Smuzhiyun {
311*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
312*4882a593Smuzhiyun }
313*4882a593Smuzhiyun 
dev_pm_opp_put_prop_name(struct opp_table * opp_table)314*4882a593Smuzhiyun static inline void dev_pm_opp_put_prop_name(struct opp_table *opp_table) {}
315*4882a593Smuzhiyun 
dev_pm_opp_set_regulators(struct device * dev,const char * const names[],unsigned int count)316*4882a593Smuzhiyun static inline struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count)
317*4882a593Smuzhiyun {
318*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
319*4882a593Smuzhiyun }
320*4882a593Smuzhiyun 
dev_pm_opp_put_regulators(struct opp_table * opp_table)321*4882a593Smuzhiyun static inline void dev_pm_opp_put_regulators(struct opp_table *opp_table) {}
322*4882a593Smuzhiyun 
dev_pm_opp_set_clkname(struct device * dev,const char * name)323*4882a593Smuzhiyun static inline struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name)
324*4882a593Smuzhiyun {
325*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
326*4882a593Smuzhiyun }
327*4882a593Smuzhiyun 
dev_pm_opp_put_clkname(struct opp_table * opp_table)328*4882a593Smuzhiyun static inline void dev_pm_opp_put_clkname(struct opp_table *opp_table) {}
329*4882a593Smuzhiyun 
dev_pm_opp_attach_genpd(struct device * dev,const char ** names,struct device *** virt_devs)330*4882a593Smuzhiyun static inline struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names, struct device ***virt_devs)
331*4882a593Smuzhiyun {
332*4882a593Smuzhiyun 	return ERR_PTR(-ENOTSUPP);
333*4882a593Smuzhiyun }
334*4882a593Smuzhiyun 
dev_pm_opp_detach_genpd(struct opp_table * opp_table)335*4882a593Smuzhiyun static inline void dev_pm_opp_detach_genpd(struct opp_table *opp_table) {}
336*4882a593Smuzhiyun 
dev_pm_opp_xlate_performance_state(struct opp_table * src_table,struct opp_table * dst_table,unsigned int pstate)337*4882a593Smuzhiyun static inline int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate)
338*4882a593Smuzhiyun {
339*4882a593Smuzhiyun 	return -ENOTSUPP;
340*4882a593Smuzhiyun }
341*4882a593Smuzhiyun 
dev_pm_opp_set_rate(struct device * dev,unsigned long target_freq)342*4882a593Smuzhiyun static inline int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
343*4882a593Smuzhiyun {
344*4882a593Smuzhiyun 	return -ENOTSUPP;
345*4882a593Smuzhiyun }
346*4882a593Smuzhiyun 
dev_pm_opp_set_bw(struct device * dev,struct dev_pm_opp * opp)347*4882a593Smuzhiyun static inline int dev_pm_opp_set_bw(struct device *dev, struct dev_pm_opp *opp)
348*4882a593Smuzhiyun {
349*4882a593Smuzhiyun 	return -EOPNOTSUPP;
350*4882a593Smuzhiyun }
351*4882a593Smuzhiyun 
dev_pm_opp_set_sharing_cpus(struct device * cpu_dev,const struct cpumask * cpumask)352*4882a593Smuzhiyun static inline int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask)
353*4882a593Smuzhiyun {
354*4882a593Smuzhiyun 	return -ENOTSUPP;
355*4882a593Smuzhiyun }
356*4882a593Smuzhiyun 
dev_pm_opp_get_sharing_cpus(struct device * cpu_dev,struct cpumask * cpumask)357*4882a593Smuzhiyun static inline int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
358*4882a593Smuzhiyun {
359*4882a593Smuzhiyun 	return -EINVAL;
360*4882a593Smuzhiyun }
361*4882a593Smuzhiyun 
dev_pm_opp_remove_table(struct device * dev)362*4882a593Smuzhiyun static inline void dev_pm_opp_remove_table(struct device *dev)
363*4882a593Smuzhiyun {
364*4882a593Smuzhiyun }
365*4882a593Smuzhiyun 
dev_pm_opp_cpumask_remove_table(const struct cpumask * cpumask)366*4882a593Smuzhiyun static inline void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask)
367*4882a593Smuzhiyun {
368*4882a593Smuzhiyun }
369*4882a593Smuzhiyun 
370*4882a593Smuzhiyun #endif		/* CONFIG_PM_OPP */
371*4882a593Smuzhiyun 
372*4882a593Smuzhiyun #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
373*4882a593Smuzhiyun int dev_pm_opp_of_add_table(struct device *dev);
374*4882a593Smuzhiyun int dev_pm_opp_of_add_table_indexed(struct device *dev, int index);
375*4882a593Smuzhiyun void dev_pm_opp_of_remove_table(struct device *dev);
376*4882a593Smuzhiyun int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask);
377*4882a593Smuzhiyun void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask);
378*4882a593Smuzhiyun int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask);
379*4882a593Smuzhiyun struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev);
380*4882a593Smuzhiyun struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp);
381*4882a593Smuzhiyun int of_get_required_opp_performance_state(struct device_node *np, int index);
382*4882a593Smuzhiyun int dev_pm_opp_of_find_icc_paths(struct device *dev, struct opp_table *opp_table);
383*4882a593Smuzhiyun int dev_pm_opp_of_register_em(struct device *dev, struct cpumask *cpus);
dev_pm_opp_of_unregister_em(struct device * dev)384*4882a593Smuzhiyun static inline void dev_pm_opp_of_unregister_em(struct device *dev)
385*4882a593Smuzhiyun {
386*4882a593Smuzhiyun 	em_dev_unregister_perf_domain(dev);
387*4882a593Smuzhiyun }
388*4882a593Smuzhiyun #else
dev_pm_opp_of_add_table(struct device * dev)389*4882a593Smuzhiyun static inline int dev_pm_opp_of_add_table(struct device *dev)
390*4882a593Smuzhiyun {
391*4882a593Smuzhiyun 	return -ENOTSUPP;
392*4882a593Smuzhiyun }
393*4882a593Smuzhiyun 
dev_pm_opp_of_add_table_indexed(struct device * dev,int index)394*4882a593Smuzhiyun static inline int dev_pm_opp_of_add_table_indexed(struct device *dev, int index)
395*4882a593Smuzhiyun {
396*4882a593Smuzhiyun 	return -ENOTSUPP;
397*4882a593Smuzhiyun }
398*4882a593Smuzhiyun 
dev_pm_opp_of_remove_table(struct device * dev)399*4882a593Smuzhiyun static inline void dev_pm_opp_of_remove_table(struct device *dev)
400*4882a593Smuzhiyun {
401*4882a593Smuzhiyun }
402*4882a593Smuzhiyun 
dev_pm_opp_of_cpumask_add_table(const struct cpumask * cpumask)403*4882a593Smuzhiyun static inline int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask)
404*4882a593Smuzhiyun {
405*4882a593Smuzhiyun 	return -ENOTSUPP;
406*4882a593Smuzhiyun }
407*4882a593Smuzhiyun 
dev_pm_opp_of_cpumask_remove_table(const struct cpumask * cpumask)408*4882a593Smuzhiyun static inline void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask)
409*4882a593Smuzhiyun {
410*4882a593Smuzhiyun }
411*4882a593Smuzhiyun 
dev_pm_opp_of_get_sharing_cpus(struct device * cpu_dev,struct cpumask * cpumask)412*4882a593Smuzhiyun static inline int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
413*4882a593Smuzhiyun {
414*4882a593Smuzhiyun 	return -ENOTSUPP;
415*4882a593Smuzhiyun }
416*4882a593Smuzhiyun 
dev_pm_opp_of_get_opp_desc_node(struct device * dev)417*4882a593Smuzhiyun static inline struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev)
418*4882a593Smuzhiyun {
419*4882a593Smuzhiyun 	return NULL;
420*4882a593Smuzhiyun }
421*4882a593Smuzhiyun 
dev_pm_opp_get_of_node(struct dev_pm_opp * opp)422*4882a593Smuzhiyun static inline struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp)
423*4882a593Smuzhiyun {
424*4882a593Smuzhiyun 	return NULL;
425*4882a593Smuzhiyun }
426*4882a593Smuzhiyun 
dev_pm_opp_of_register_em(struct device * dev,struct cpumask * cpus)427*4882a593Smuzhiyun static inline int dev_pm_opp_of_register_em(struct device *dev,
428*4882a593Smuzhiyun 					    struct cpumask *cpus)
429*4882a593Smuzhiyun {
430*4882a593Smuzhiyun 	return -ENOTSUPP;
431*4882a593Smuzhiyun }
432*4882a593Smuzhiyun 
dev_pm_opp_of_unregister_em(struct device * dev)433*4882a593Smuzhiyun static inline void dev_pm_opp_of_unregister_em(struct device *dev)
434*4882a593Smuzhiyun {
435*4882a593Smuzhiyun }
436*4882a593Smuzhiyun 
of_get_required_opp_performance_state(struct device_node * np,int index)437*4882a593Smuzhiyun static inline int of_get_required_opp_performance_state(struct device_node *np, int index)
438*4882a593Smuzhiyun {
439*4882a593Smuzhiyun 	return -ENOTSUPP;
440*4882a593Smuzhiyun }
441*4882a593Smuzhiyun 
dev_pm_opp_of_find_icc_paths(struct device * dev,struct opp_table * opp_table)442*4882a593Smuzhiyun static inline int dev_pm_opp_of_find_icc_paths(struct device *dev, struct opp_table *opp_table)
443*4882a593Smuzhiyun {
444*4882a593Smuzhiyun 	return -ENOTSUPP;
445*4882a593Smuzhiyun }
446*4882a593Smuzhiyun #endif
447*4882a593Smuzhiyun 
448*4882a593Smuzhiyun #endif		/* __LINUX_OPP_H__ */
449