1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * devfreq: Generic Dynamic Voltage and Frequency Scaling (DVFS) Framework
4*4882a593Smuzhiyun * for Non-CPU Devices.
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * Copyright (C) 2011 Samsung Electronics
7*4882a593Smuzhiyun * MyungJoo Ham <myungjoo.ham@samsung.com>
8*4882a593Smuzhiyun */
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun #ifndef __LINUX_DEVFREQ_H__
11*4882a593Smuzhiyun #define __LINUX_DEVFREQ_H__
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun #include <linux/device.h>
14*4882a593Smuzhiyun #include <linux/notifier.h>
15*4882a593Smuzhiyun #include <linux/pm_opp.h>
16*4882a593Smuzhiyun #include <linux/pm_qos.h>
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun #define DEVFREQ_NAME_LEN 16
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun /* DEVFREQ governor name */
21*4882a593Smuzhiyun #define DEVFREQ_GOV_SIMPLE_ONDEMAND "simple_ondemand"
22*4882a593Smuzhiyun #define DEVFREQ_GOV_PERFORMANCE "performance"
23*4882a593Smuzhiyun #define DEVFREQ_GOV_POWERSAVE "powersave"
24*4882a593Smuzhiyun #define DEVFREQ_GOV_USERSPACE "userspace"
25*4882a593Smuzhiyun #define DEVFREQ_GOV_PASSIVE "passive"
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun /* DEVFREQ notifier interface */
28*4882a593Smuzhiyun #define DEVFREQ_TRANSITION_NOTIFIER (0)
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun /* Transition notifiers of DEVFREQ_TRANSITION_NOTIFIER */
31*4882a593Smuzhiyun #define DEVFREQ_PRECHANGE (0)
32*4882a593Smuzhiyun #define DEVFREQ_POSTCHANGE (1)
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun /* DEVFREQ work timers */
35*4882a593Smuzhiyun enum devfreq_timer {
36*4882a593Smuzhiyun DEVFREQ_TIMER_DEFERRABLE = 0,
37*4882a593Smuzhiyun DEVFREQ_TIMER_DELAYED,
38*4882a593Smuzhiyun DEVFREQ_TIMER_NUM,
39*4882a593Smuzhiyun };
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun struct devfreq;
42*4882a593Smuzhiyun struct devfreq_governor;
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun /**
45*4882a593Smuzhiyun * struct devfreq_dev_status - Data given from devfreq user device to
46*4882a593Smuzhiyun * governors. Represents the performance
47*4882a593Smuzhiyun * statistics.
48*4882a593Smuzhiyun * @total_time: The total time represented by this instance of
49*4882a593Smuzhiyun * devfreq_dev_status
50*4882a593Smuzhiyun * @busy_time: The time that the device was working among the
51*4882a593Smuzhiyun * total_time.
52*4882a593Smuzhiyun * @current_frequency: The operating frequency.
53*4882a593Smuzhiyun * @private_data: An entry not specified by the devfreq framework.
54*4882a593Smuzhiyun * A device and a specific governor may have their
55*4882a593Smuzhiyun * own protocol with private_data. However, because
56*4882a593Smuzhiyun * this is governor-specific, a governor using this
57*4882a593Smuzhiyun * will be only compatible with devices aware of it.
58*4882a593Smuzhiyun */
59*4882a593Smuzhiyun struct devfreq_dev_status {
60*4882a593Smuzhiyun /* both since the last measure */
61*4882a593Smuzhiyun unsigned long total_time;
62*4882a593Smuzhiyun unsigned long busy_time;
63*4882a593Smuzhiyun unsigned long current_frequency;
64*4882a593Smuzhiyun void *private_data;
65*4882a593Smuzhiyun };
66*4882a593Smuzhiyun
67*4882a593Smuzhiyun /*
68*4882a593Smuzhiyun * The resulting frequency should be at most this. (this bound is the
69*4882a593Smuzhiyun * least upper bound; thus, the resulting freq should be lower or same)
70*4882a593Smuzhiyun * If the flag is not set, the resulting frequency should be at most the
71*4882a593Smuzhiyun * bound (greatest lower bound)
72*4882a593Smuzhiyun */
73*4882a593Smuzhiyun #define DEVFREQ_FLAG_LEAST_UPPER_BOUND 0x1
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun /**
76*4882a593Smuzhiyun * struct devfreq_dev_profile - Devfreq's user device profile
77*4882a593Smuzhiyun * @initial_freq: The operating frequency when devfreq_add_device() is
78*4882a593Smuzhiyun * called.
79*4882a593Smuzhiyun * @polling_ms: The polling interval in ms. 0 disables polling.
80*4882a593Smuzhiyun * @timer: Timer type is either deferrable or delayed timer.
81*4882a593Smuzhiyun * @target: The device should set its operating frequency at
82*4882a593Smuzhiyun * freq or lowest-upper-than-freq value. If freq is
83*4882a593Smuzhiyun * higher than any operable frequency, set maximum.
84*4882a593Smuzhiyun * Before returning, target function should set
85*4882a593Smuzhiyun * freq at the current frequency.
86*4882a593Smuzhiyun * The "flags" parameter's possible values are
87*4882a593Smuzhiyun * explained above with "DEVFREQ_FLAG_*" macros.
88*4882a593Smuzhiyun * @get_dev_status: The device should provide the current performance
89*4882a593Smuzhiyun * status to devfreq. Governors are recommended not to
90*4882a593Smuzhiyun * use this directly. Instead, governors are recommended
91*4882a593Smuzhiyun * to use devfreq_update_stats() along with
92*4882a593Smuzhiyun * devfreq.last_status.
93*4882a593Smuzhiyun * @get_cur_freq: The device should provide the current frequency
94*4882a593Smuzhiyun * at which it is operating.
95*4882a593Smuzhiyun * @exit: An optional callback that is called when devfreq
96*4882a593Smuzhiyun * is removing the devfreq object due to error or
97*4882a593Smuzhiyun * from devfreq_remove_device() call. If the user
98*4882a593Smuzhiyun * has registered devfreq->nb at a notifier-head,
99*4882a593Smuzhiyun * this is the time to unregister it.
100*4882a593Smuzhiyun * @freq_table: Optional list of frequencies to support statistics
101*4882a593Smuzhiyun * and freq_table must be generated in ascending order.
102*4882a593Smuzhiyun * @max_state: The size of freq_table.
103*4882a593Smuzhiyun */
104*4882a593Smuzhiyun struct devfreq_dev_profile {
105*4882a593Smuzhiyun unsigned long initial_freq;
106*4882a593Smuzhiyun unsigned int polling_ms;
107*4882a593Smuzhiyun enum devfreq_timer timer;
108*4882a593Smuzhiyun
109*4882a593Smuzhiyun int (*target)(struct device *dev, unsigned long *freq, u32 flags);
110*4882a593Smuzhiyun int (*get_dev_status)(struct device *dev,
111*4882a593Smuzhiyun struct devfreq_dev_status *stat);
112*4882a593Smuzhiyun int (*get_cur_freq)(struct device *dev, unsigned long *freq);
113*4882a593Smuzhiyun void (*exit)(struct device *dev);
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun unsigned long *freq_table;
116*4882a593Smuzhiyun unsigned int max_state;
117*4882a593Smuzhiyun };
118*4882a593Smuzhiyun
119*4882a593Smuzhiyun /**
120*4882a593Smuzhiyun * struct devfreq_stats - Statistics of devfreq device behavior
121*4882a593Smuzhiyun * @total_trans: Number of devfreq transitions.
122*4882a593Smuzhiyun * @trans_table: Statistics of devfreq transitions.
123*4882a593Smuzhiyun * @time_in_state: Statistics of devfreq states.
124*4882a593Smuzhiyun * @last_update: The last time stats were updated.
125*4882a593Smuzhiyun */
126*4882a593Smuzhiyun struct devfreq_stats {
127*4882a593Smuzhiyun unsigned int total_trans;
128*4882a593Smuzhiyun unsigned int *trans_table;
129*4882a593Smuzhiyun u64 *time_in_state;
130*4882a593Smuzhiyun u64 last_update;
131*4882a593Smuzhiyun };
132*4882a593Smuzhiyun
133*4882a593Smuzhiyun /**
134*4882a593Smuzhiyun * struct devfreq - Device devfreq structure
135*4882a593Smuzhiyun * @node: list node - contains the devices with devfreq that have been
136*4882a593Smuzhiyun * registered.
137*4882a593Smuzhiyun * @lock: a mutex to protect accessing devfreq.
138*4882a593Smuzhiyun * @dev: device registered by devfreq class. dev.parent is the device
139*4882a593Smuzhiyun * using devfreq.
140*4882a593Smuzhiyun * @profile: device-specific devfreq profile
141*4882a593Smuzhiyun * @governor: method how to choose frequency based on the usage.
142*4882a593Smuzhiyun * @governor_name: devfreq governor name for use with this devfreq
143*4882a593Smuzhiyun * @nb: notifier block used to notify devfreq object that it should
144*4882a593Smuzhiyun * reevaluate operable frequencies. Devfreq users may use
145*4882a593Smuzhiyun * devfreq.nb to the corresponding register notifier call chain.
146*4882a593Smuzhiyun * @work: delayed work for load monitoring.
147*4882a593Smuzhiyun * @previous_freq: previously configured frequency value.
148*4882a593Smuzhiyun * @last_status: devfreq user device info, performance statistics
149*4882a593Smuzhiyun * @data: Private data of the governor. The devfreq framework does not
150*4882a593Smuzhiyun * touch this.
151*4882a593Smuzhiyun * @user_min_freq_req: PM QoS minimum frequency request from user (via sysfs)
152*4882a593Smuzhiyun * @user_max_freq_req: PM QoS maximum frequency request from user (via sysfs)
153*4882a593Smuzhiyun * @scaling_min_freq: Limit minimum frequency requested by OPP interface
154*4882a593Smuzhiyun * @scaling_max_freq: Limit maximum frequency requested by OPP interface
155*4882a593Smuzhiyun * @stop_polling: devfreq polling status of a device.
156*4882a593Smuzhiyun * @suspend_freq: frequency of a device set during suspend phase.
157*4882a593Smuzhiyun * @resume_freq: frequency of a device set in resume phase.
158*4882a593Smuzhiyun * @suspend_count: suspend requests counter for a device.
159*4882a593Smuzhiyun * @stats: Statistics of devfreq device behavior
160*4882a593Smuzhiyun * @transition_notifier_list: list head of DEVFREQ_TRANSITION_NOTIFIER notifier
161*4882a593Smuzhiyun * @nb_min: Notifier block for DEV_PM_QOS_MIN_FREQUENCY
162*4882a593Smuzhiyun * @nb_max: Notifier block for DEV_PM_QOS_MAX_FREQUENCY
163*4882a593Smuzhiyun *
164*4882a593Smuzhiyun * This structure stores the devfreq information for a given device.
165*4882a593Smuzhiyun *
166*4882a593Smuzhiyun * Note that when a governor accesses entries in struct devfreq in its
167*4882a593Smuzhiyun * functions except for the context of callbacks defined in struct
168*4882a593Smuzhiyun * devfreq_governor, the governor should protect its access with the
169*4882a593Smuzhiyun * struct mutex lock in struct devfreq. A governor may use this mutex
170*4882a593Smuzhiyun * to protect its own private data in ``void *data`` as well.
171*4882a593Smuzhiyun */
172*4882a593Smuzhiyun struct devfreq {
173*4882a593Smuzhiyun struct list_head node;
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun struct mutex lock;
176*4882a593Smuzhiyun struct device dev;
177*4882a593Smuzhiyun struct devfreq_dev_profile *profile;
178*4882a593Smuzhiyun const struct devfreq_governor *governor;
179*4882a593Smuzhiyun char governor_name[DEVFREQ_NAME_LEN];
180*4882a593Smuzhiyun struct notifier_block nb;
181*4882a593Smuzhiyun struct delayed_work work;
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun unsigned long previous_freq;
184*4882a593Smuzhiyun struct devfreq_dev_status last_status;
185*4882a593Smuzhiyun
186*4882a593Smuzhiyun void *data; /* private data for governors */
187*4882a593Smuzhiyun
188*4882a593Smuzhiyun struct dev_pm_qos_request user_min_freq_req;
189*4882a593Smuzhiyun struct dev_pm_qos_request user_max_freq_req;
190*4882a593Smuzhiyun unsigned long scaling_min_freq;
191*4882a593Smuzhiyun unsigned long scaling_max_freq;
192*4882a593Smuzhiyun bool stop_polling;
193*4882a593Smuzhiyun
194*4882a593Smuzhiyun unsigned long suspend_freq;
195*4882a593Smuzhiyun unsigned long resume_freq;
196*4882a593Smuzhiyun atomic_t suspend_count;
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun /* information for device frequency transitions */
199*4882a593Smuzhiyun struct devfreq_stats stats;
200*4882a593Smuzhiyun
201*4882a593Smuzhiyun struct srcu_notifier_head transition_notifier_list;
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun struct notifier_block nb_min;
204*4882a593Smuzhiyun struct notifier_block nb_max;
205*4882a593Smuzhiyun };
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun struct devfreq_freqs {
208*4882a593Smuzhiyun unsigned long old;
209*4882a593Smuzhiyun unsigned long new;
210*4882a593Smuzhiyun };
211*4882a593Smuzhiyun
212*4882a593Smuzhiyun #if defined(CONFIG_PM_DEVFREQ)
213*4882a593Smuzhiyun struct devfreq *devfreq_add_device(struct device *dev,
214*4882a593Smuzhiyun struct devfreq_dev_profile *profile,
215*4882a593Smuzhiyun const char *governor_name,
216*4882a593Smuzhiyun void *data);
217*4882a593Smuzhiyun int devfreq_remove_device(struct devfreq *devfreq);
218*4882a593Smuzhiyun struct devfreq *devm_devfreq_add_device(struct device *dev,
219*4882a593Smuzhiyun struct devfreq_dev_profile *profile,
220*4882a593Smuzhiyun const char *governor_name,
221*4882a593Smuzhiyun void *data);
222*4882a593Smuzhiyun void devm_devfreq_remove_device(struct device *dev, struct devfreq *devfreq);
223*4882a593Smuzhiyun
224*4882a593Smuzhiyun /* Supposed to be called by PM callbacks */
225*4882a593Smuzhiyun int devfreq_suspend_device(struct devfreq *devfreq);
226*4882a593Smuzhiyun int devfreq_resume_device(struct devfreq *devfreq);
227*4882a593Smuzhiyun
228*4882a593Smuzhiyun void devfreq_suspend(void);
229*4882a593Smuzhiyun void devfreq_resume(void);
230*4882a593Smuzhiyun
231*4882a593Smuzhiyun /* update_devfreq() - Reevaluate the device and configure frequency */
232*4882a593Smuzhiyun int update_devfreq(struct devfreq *devfreq);
233*4882a593Smuzhiyun
234*4882a593Smuzhiyun /* Helper functions for devfreq user device driver with OPP. */
235*4882a593Smuzhiyun struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
236*4882a593Smuzhiyun unsigned long *freq, u32 flags);
237*4882a593Smuzhiyun int devfreq_register_opp_notifier(struct device *dev,
238*4882a593Smuzhiyun struct devfreq *devfreq);
239*4882a593Smuzhiyun int devfreq_unregister_opp_notifier(struct device *dev,
240*4882a593Smuzhiyun struct devfreq *devfreq);
241*4882a593Smuzhiyun int devm_devfreq_register_opp_notifier(struct device *dev,
242*4882a593Smuzhiyun struct devfreq *devfreq);
243*4882a593Smuzhiyun void devm_devfreq_unregister_opp_notifier(struct device *dev,
244*4882a593Smuzhiyun struct devfreq *devfreq);
245*4882a593Smuzhiyun int devfreq_register_notifier(struct devfreq *devfreq,
246*4882a593Smuzhiyun struct notifier_block *nb,
247*4882a593Smuzhiyun unsigned int list);
248*4882a593Smuzhiyun int devfreq_unregister_notifier(struct devfreq *devfreq,
249*4882a593Smuzhiyun struct notifier_block *nb,
250*4882a593Smuzhiyun unsigned int list);
251*4882a593Smuzhiyun int devm_devfreq_register_notifier(struct device *dev,
252*4882a593Smuzhiyun struct devfreq *devfreq,
253*4882a593Smuzhiyun struct notifier_block *nb,
254*4882a593Smuzhiyun unsigned int list);
255*4882a593Smuzhiyun void devm_devfreq_unregister_notifier(struct device *dev,
256*4882a593Smuzhiyun struct devfreq *devfreq,
257*4882a593Smuzhiyun struct notifier_block *nb,
258*4882a593Smuzhiyun unsigned int list);
259*4882a593Smuzhiyun struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node);
260*4882a593Smuzhiyun struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
261*4882a593Smuzhiyun const char *phandle_name, int index);
262*4882a593Smuzhiyun
263*4882a593Smuzhiyun #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
264*4882a593Smuzhiyun /**
265*4882a593Smuzhiyun * struct devfreq_simple_ondemand_data - ``void *data`` fed to struct devfreq
266*4882a593Smuzhiyun * and devfreq_add_device
267*4882a593Smuzhiyun * @upthreshold: If the load is over this value, the frequency jumps.
268*4882a593Smuzhiyun * Specify 0 to use the default. Valid value = 0 to 100.
269*4882a593Smuzhiyun * @downdifferential: If the load is under upthreshold - downdifferential,
270*4882a593Smuzhiyun * the governor may consider slowing the frequency down.
271*4882a593Smuzhiyun * Specify 0 to use the default. Valid value = 0 to 100.
272*4882a593Smuzhiyun * downdifferential < upthreshold must hold.
273*4882a593Smuzhiyun *
274*4882a593Smuzhiyun * If the fed devfreq_simple_ondemand_data pointer is NULL to the governor,
275*4882a593Smuzhiyun * the governor uses the default values.
276*4882a593Smuzhiyun */
277*4882a593Smuzhiyun struct devfreq_simple_ondemand_data {
278*4882a593Smuzhiyun unsigned int upthreshold;
279*4882a593Smuzhiyun unsigned int downdifferential;
280*4882a593Smuzhiyun };
281*4882a593Smuzhiyun #endif
282*4882a593Smuzhiyun
283*4882a593Smuzhiyun #if IS_ENABLED(CONFIG_DEVFREQ_GOV_PASSIVE)
284*4882a593Smuzhiyun /**
285*4882a593Smuzhiyun * struct devfreq_passive_data - ``void *data`` fed to struct devfreq
286*4882a593Smuzhiyun * and devfreq_add_device
287*4882a593Smuzhiyun * @parent: the devfreq instance of parent device.
288*4882a593Smuzhiyun * @get_target_freq: Optional callback, Returns desired operating frequency
289*4882a593Smuzhiyun * for the device using passive governor. That is called
290*4882a593Smuzhiyun * when passive governor should decide the next frequency
291*4882a593Smuzhiyun * by using the new frequency of parent devfreq device
292*4882a593Smuzhiyun * using governors except for passive governor.
293*4882a593Smuzhiyun * If the devfreq device has the specific method to decide
294*4882a593Smuzhiyun * the next frequency, should use this callback.
295*4882a593Smuzhiyun * @this: the devfreq instance of own device.
296*4882a593Smuzhiyun * @nb: the notifier block for DEVFREQ_TRANSITION_NOTIFIER list
297*4882a593Smuzhiyun *
298*4882a593Smuzhiyun * The devfreq_passive_data have to set the devfreq instance of parent
299*4882a593Smuzhiyun * device with governors except for the passive governor. But, don't need to
300*4882a593Smuzhiyun * initialize the 'this' and 'nb' field because the devfreq core will handle
301*4882a593Smuzhiyun * them.
302*4882a593Smuzhiyun */
303*4882a593Smuzhiyun struct devfreq_passive_data {
304*4882a593Smuzhiyun /* Should set the devfreq instance of parent device */
305*4882a593Smuzhiyun struct devfreq *parent;
306*4882a593Smuzhiyun
307*4882a593Smuzhiyun /* Optional callback to decide the next frequency of passvice device */
308*4882a593Smuzhiyun int (*get_target_freq)(struct devfreq *this, unsigned long *freq);
309*4882a593Smuzhiyun
310*4882a593Smuzhiyun /* For passive governor's internal use. Don't need to set them */
311*4882a593Smuzhiyun struct devfreq *this;
312*4882a593Smuzhiyun struct notifier_block nb;
313*4882a593Smuzhiyun };
314*4882a593Smuzhiyun #endif
315*4882a593Smuzhiyun
316*4882a593Smuzhiyun #else /* !CONFIG_PM_DEVFREQ */
devfreq_add_device(struct device * dev,struct devfreq_dev_profile * profile,const char * governor_name,void * data)317*4882a593Smuzhiyun static inline struct devfreq *devfreq_add_device(struct device *dev,
318*4882a593Smuzhiyun struct devfreq_dev_profile *profile,
319*4882a593Smuzhiyun const char *governor_name,
320*4882a593Smuzhiyun void *data)
321*4882a593Smuzhiyun {
322*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
323*4882a593Smuzhiyun }
324*4882a593Smuzhiyun
devfreq_remove_device(struct devfreq * devfreq)325*4882a593Smuzhiyun static inline int devfreq_remove_device(struct devfreq *devfreq)
326*4882a593Smuzhiyun {
327*4882a593Smuzhiyun return 0;
328*4882a593Smuzhiyun }
329*4882a593Smuzhiyun
devm_devfreq_add_device(struct device * dev,struct devfreq_dev_profile * profile,const char * governor_name,void * data)330*4882a593Smuzhiyun static inline struct devfreq *devm_devfreq_add_device(struct device *dev,
331*4882a593Smuzhiyun struct devfreq_dev_profile *profile,
332*4882a593Smuzhiyun const char *governor_name,
333*4882a593Smuzhiyun void *data)
334*4882a593Smuzhiyun {
335*4882a593Smuzhiyun return ERR_PTR(-ENOSYS);
336*4882a593Smuzhiyun }
337*4882a593Smuzhiyun
devm_devfreq_remove_device(struct device * dev,struct devfreq * devfreq)338*4882a593Smuzhiyun static inline void devm_devfreq_remove_device(struct device *dev,
339*4882a593Smuzhiyun struct devfreq *devfreq)
340*4882a593Smuzhiyun {
341*4882a593Smuzhiyun }
342*4882a593Smuzhiyun
devfreq_suspend_device(struct devfreq * devfreq)343*4882a593Smuzhiyun static inline int devfreq_suspend_device(struct devfreq *devfreq)
344*4882a593Smuzhiyun {
345*4882a593Smuzhiyun return 0;
346*4882a593Smuzhiyun }
347*4882a593Smuzhiyun
devfreq_resume_device(struct devfreq * devfreq)348*4882a593Smuzhiyun static inline int devfreq_resume_device(struct devfreq *devfreq)
349*4882a593Smuzhiyun {
350*4882a593Smuzhiyun return 0;
351*4882a593Smuzhiyun }
352*4882a593Smuzhiyun
devfreq_suspend(void)353*4882a593Smuzhiyun static inline void devfreq_suspend(void) {}
devfreq_resume(void)354*4882a593Smuzhiyun static inline void devfreq_resume(void) {}
355*4882a593Smuzhiyun
devfreq_recommended_opp(struct device * dev,unsigned long * freq,u32 flags)356*4882a593Smuzhiyun static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
357*4882a593Smuzhiyun unsigned long *freq, u32 flags)
358*4882a593Smuzhiyun {
359*4882a593Smuzhiyun return ERR_PTR(-EINVAL);
360*4882a593Smuzhiyun }
361*4882a593Smuzhiyun
devfreq_register_opp_notifier(struct device * dev,struct devfreq * devfreq)362*4882a593Smuzhiyun static inline int devfreq_register_opp_notifier(struct device *dev,
363*4882a593Smuzhiyun struct devfreq *devfreq)
364*4882a593Smuzhiyun {
365*4882a593Smuzhiyun return -EINVAL;
366*4882a593Smuzhiyun }
367*4882a593Smuzhiyun
devfreq_unregister_opp_notifier(struct device * dev,struct devfreq * devfreq)368*4882a593Smuzhiyun static inline int devfreq_unregister_opp_notifier(struct device *dev,
369*4882a593Smuzhiyun struct devfreq *devfreq)
370*4882a593Smuzhiyun {
371*4882a593Smuzhiyun return -EINVAL;
372*4882a593Smuzhiyun }
373*4882a593Smuzhiyun
devm_devfreq_register_opp_notifier(struct device * dev,struct devfreq * devfreq)374*4882a593Smuzhiyun static inline int devm_devfreq_register_opp_notifier(struct device *dev,
375*4882a593Smuzhiyun struct devfreq *devfreq)
376*4882a593Smuzhiyun {
377*4882a593Smuzhiyun return -EINVAL;
378*4882a593Smuzhiyun }
379*4882a593Smuzhiyun
devm_devfreq_unregister_opp_notifier(struct device * dev,struct devfreq * devfreq)380*4882a593Smuzhiyun static inline void devm_devfreq_unregister_opp_notifier(struct device *dev,
381*4882a593Smuzhiyun struct devfreq *devfreq)
382*4882a593Smuzhiyun {
383*4882a593Smuzhiyun }
384*4882a593Smuzhiyun
devfreq_register_notifier(struct devfreq * devfreq,struct notifier_block * nb,unsigned int list)385*4882a593Smuzhiyun static inline int devfreq_register_notifier(struct devfreq *devfreq,
386*4882a593Smuzhiyun struct notifier_block *nb,
387*4882a593Smuzhiyun unsigned int list)
388*4882a593Smuzhiyun {
389*4882a593Smuzhiyun return 0;
390*4882a593Smuzhiyun }
391*4882a593Smuzhiyun
devfreq_unregister_notifier(struct devfreq * devfreq,struct notifier_block * nb,unsigned int list)392*4882a593Smuzhiyun static inline int devfreq_unregister_notifier(struct devfreq *devfreq,
393*4882a593Smuzhiyun struct notifier_block *nb,
394*4882a593Smuzhiyun unsigned int list)
395*4882a593Smuzhiyun {
396*4882a593Smuzhiyun return 0;
397*4882a593Smuzhiyun }
398*4882a593Smuzhiyun
devm_devfreq_register_notifier(struct device * dev,struct devfreq * devfreq,struct notifier_block * nb,unsigned int list)399*4882a593Smuzhiyun static inline int devm_devfreq_register_notifier(struct device *dev,
400*4882a593Smuzhiyun struct devfreq *devfreq,
401*4882a593Smuzhiyun struct notifier_block *nb,
402*4882a593Smuzhiyun unsigned int list)
403*4882a593Smuzhiyun {
404*4882a593Smuzhiyun return 0;
405*4882a593Smuzhiyun }
406*4882a593Smuzhiyun
devm_devfreq_unregister_notifier(struct device * dev,struct devfreq * devfreq,struct notifier_block * nb,unsigned int list)407*4882a593Smuzhiyun static inline void devm_devfreq_unregister_notifier(struct device *dev,
408*4882a593Smuzhiyun struct devfreq *devfreq,
409*4882a593Smuzhiyun struct notifier_block *nb,
410*4882a593Smuzhiyun unsigned int list)
411*4882a593Smuzhiyun {
412*4882a593Smuzhiyun }
413*4882a593Smuzhiyun
devfreq_get_devfreq_by_node(struct device_node * node)414*4882a593Smuzhiyun static inline struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node)
415*4882a593Smuzhiyun {
416*4882a593Smuzhiyun return ERR_PTR(-ENODEV);
417*4882a593Smuzhiyun }
418*4882a593Smuzhiyun
devfreq_get_devfreq_by_phandle(struct device * dev,const char * phandle_name,int index)419*4882a593Smuzhiyun static inline struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
420*4882a593Smuzhiyun const char *phandle_name, int index)
421*4882a593Smuzhiyun {
422*4882a593Smuzhiyun return ERR_PTR(-ENODEV);
423*4882a593Smuzhiyun }
424*4882a593Smuzhiyun
devfreq_update_stats(struct devfreq * df)425*4882a593Smuzhiyun static inline int devfreq_update_stats(struct devfreq *df)
426*4882a593Smuzhiyun {
427*4882a593Smuzhiyun return -EINVAL;
428*4882a593Smuzhiyun }
429*4882a593Smuzhiyun #endif /* CONFIG_PM_DEVFREQ */
430*4882a593Smuzhiyun
431*4882a593Smuzhiyun #endif /* __LINUX_DEVFREQ_H__ */
432