xref: /OK3568_Linux_fs/kernel/Documentation/power/opp.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun==========================================
2*4882a593SmuzhiyunOperating Performance Points (OPP) Library
3*4882a593Smuzhiyun==========================================
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun(C) 2009-2010 Nishanth Menon <nm@ti.com>, Texas Instruments Incorporated
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun.. Contents
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun  1. Introduction
10*4882a593Smuzhiyun  2. Initial OPP List Registration
11*4882a593Smuzhiyun  3. OPP Search Functions
12*4882a593Smuzhiyun  4. OPP Availability Control Functions
13*4882a593Smuzhiyun  5. OPP Data Retrieval Functions
14*4882a593Smuzhiyun  6. Data Structures
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun1. Introduction
17*4882a593Smuzhiyun===============
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun1.1 What is an Operating Performance Point (OPP)?
20*4882a593Smuzhiyun-------------------------------------------------
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunComplex SoCs of today consists of a multiple sub-modules working in conjunction.
23*4882a593SmuzhiyunIn an operational system executing varied use cases, not all modules in the SoC
24*4882a593Smuzhiyunneed to function at their highest performing frequency all the time. To
25*4882a593Smuzhiyunfacilitate this, sub-modules in a SoC are grouped into domains, allowing some
26*4882a593Smuzhiyundomains to run at lower voltage and frequency while other domains run at
27*4882a593Smuzhiyunvoltage/frequency pairs that are higher.
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunThe set of discrete tuples consisting of frequency and voltage pairs that
30*4882a593Smuzhiyunthe device will support per domain are called Operating Performance Points or
31*4882a593SmuzhiyunOPPs.
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunAs an example:
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunLet us consider an MPU device which supports the following:
36*4882a593Smuzhiyun{300MHz at minimum voltage of 1V}, {800MHz at minimum voltage of 1.2V},
37*4882a593Smuzhiyun{1GHz at minimum voltage of 1.3V}
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunWe can represent these as three OPPs as the following {Hz, uV} tuples:
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun- {300000000, 1000000}
42*4882a593Smuzhiyun- {800000000, 1200000}
43*4882a593Smuzhiyun- {1000000000, 1300000}
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun1.2 Operating Performance Points Library
46*4882a593Smuzhiyun----------------------------------------
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunOPP library provides a set of helper functions to organize and query the OPP
49*4882a593Smuzhiyuninformation. The library is located in drivers/opp/ directory and the header
50*4882a593Smuzhiyunis located in include/linux/pm_opp.h. OPP library can be enabled by enabling
51*4882a593SmuzhiyunCONFIG_PM_OPP from power management menuconfig menu. OPP library depends on
52*4882a593SmuzhiyunCONFIG_PM as certain SoCs such as Texas Instrument's OMAP framework allows to
53*4882a593Smuzhiyunoptionally boot at a certain OPP without needing cpufreq.
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunTypical usage of the OPP library is as follows::
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun (users)	-> registers a set of default OPPs		-> (library)
58*4882a593Smuzhiyun SoC framework	-> modifies on required cases certain OPPs	-> OPP layer
59*4882a593Smuzhiyun		-> queries to search/retrieve information	->
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunOPP layer expects each domain to be represented by a unique device pointer. SoC
62*4882a593Smuzhiyunframework registers a set of initial OPPs per device with the OPP layer. This
63*4882a593Smuzhiyunlist is expected to be an optimally small number typically around 5 per device.
64*4882a593SmuzhiyunThis initial list contains a set of OPPs that the framework expects to be safely
65*4882a593Smuzhiyunenabled by default in the system.
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunNote on OPP Availability
68*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^
69*4882a593Smuzhiyun
70*4882a593SmuzhiyunAs the system proceeds to operate, SoC framework may choose to make certain
71*4882a593SmuzhiyunOPPs available or not available on each device based on various external
72*4882a593Smuzhiyunfactors. Example usage: Thermal management or other exceptional situations where
73*4882a593SmuzhiyunSoC framework might choose to disable a higher frequency OPP to safely continue
74*4882a593Smuzhiyunoperations until that OPP could be re-enabled if possible.
75*4882a593Smuzhiyun
76*4882a593SmuzhiyunOPP library facilitates this concept in its implementation. The following
77*4882a593Smuzhiyunoperational functions operate only on available opps:
78*4882a593Smuzhiyunopp_find_freq_{ceil, floor}, dev_pm_opp_get_voltage, dev_pm_opp_get_freq,
79*4882a593Smuzhiyundev_pm_opp_get_opp_count
80*4882a593Smuzhiyun
81*4882a593Smuzhiyundev_pm_opp_find_freq_exact is meant to be used to find the opp pointer
82*4882a593Smuzhiyunwhich can then be used for dev_pm_opp_enable/disable functions to make an
83*4882a593Smuzhiyunopp available as required.
84*4882a593Smuzhiyun
85*4882a593SmuzhiyunWARNING: Users of OPP library should refresh their availability count using
86*4882a593Smuzhiyunget_opp_count if dev_pm_opp_enable/disable functions are invoked for a
87*4882a593Smuzhiyundevice, the exact mechanism to trigger these or the notification mechanism
88*4882a593Smuzhiyunto other dependent subsystems such as cpufreq are left to the discretion of
89*4882a593Smuzhiyunthe SoC specific framework which uses the OPP library. Similar care needs
90*4882a593Smuzhiyunto be taken care to refresh the cpufreq table in cases of these operations.
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun2. Initial OPP List Registration
93*4882a593Smuzhiyun================================
94*4882a593SmuzhiyunThe SoC implementation calls dev_pm_opp_add function iteratively to add OPPs per
95*4882a593Smuzhiyundevice. It is expected that the SoC framework will register the OPP entries
96*4882a593Smuzhiyunoptimally- typical numbers range to be less than 5. The list generated by
97*4882a593Smuzhiyunregistering the OPPs is maintained by OPP library throughout the device
98*4882a593Smuzhiyunoperation. The SoC framework can subsequently control the availability of the
99*4882a593SmuzhiyunOPPs dynamically using the dev_pm_opp_enable / disable functions.
100*4882a593Smuzhiyun
101*4882a593Smuzhiyundev_pm_opp_add
102*4882a593Smuzhiyun	Add a new OPP for a specific domain represented by the device pointer.
103*4882a593Smuzhiyun	The OPP is defined using the frequency and voltage. Once added, the OPP
104*4882a593Smuzhiyun	is assumed to be available and control of its availability can be done
105*4882a593Smuzhiyun	with the dev_pm_opp_enable/disable functions. OPP library
106*4882a593Smuzhiyun	internally stores and manages this information in the opp struct.
107*4882a593Smuzhiyun	This function may be used by SoC framework to define a optimal list
108*4882a593Smuzhiyun	as per the demands of SoC usage environment.
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun	WARNING:
111*4882a593Smuzhiyun		Do not use this function in interrupt context.
112*4882a593Smuzhiyun
113*4882a593Smuzhiyun	Example::
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun	 soc_pm_init()
116*4882a593Smuzhiyun	 {
117*4882a593Smuzhiyun		/* Do things */
118*4882a593Smuzhiyun		r = dev_pm_opp_add(mpu_dev, 1000000, 900000);
119*4882a593Smuzhiyun		if (!r) {
120*4882a593Smuzhiyun			pr_err("%s: unable to register mpu opp(%d)\n", r);
121*4882a593Smuzhiyun			goto no_cpufreq;
122*4882a593Smuzhiyun		}
123*4882a593Smuzhiyun		/* Do cpufreq things */
124*4882a593Smuzhiyun	 no_cpufreq:
125*4882a593Smuzhiyun		/* Do remaining things */
126*4882a593Smuzhiyun	 }
127*4882a593Smuzhiyun
128*4882a593Smuzhiyun3. OPP Search Functions
129*4882a593Smuzhiyun=======================
130*4882a593SmuzhiyunHigh level framework such as cpufreq operates on frequencies. To map the
131*4882a593Smuzhiyunfrequency back to the corresponding OPP, OPP library provides handy functions
132*4882a593Smuzhiyunto search the OPP list that OPP library internally manages. These search
133*4882a593Smuzhiyunfunctions return the matching pointer representing the opp if a match is
134*4882a593Smuzhiyunfound, else returns error. These errors are expected to be handled by standard
135*4882a593Smuzhiyunerror checks such as IS_ERR() and appropriate actions taken by the caller.
136*4882a593Smuzhiyun
137*4882a593SmuzhiyunCallers of these functions shall call dev_pm_opp_put() after they have used the
138*4882a593SmuzhiyunOPP. Otherwise the memory for the OPP will never get freed and result in
139*4882a593Smuzhiyunmemleak.
140*4882a593Smuzhiyun
141*4882a593Smuzhiyundev_pm_opp_find_freq_exact
142*4882a593Smuzhiyun	Search for an OPP based on an *exact* frequency and
143*4882a593Smuzhiyun	availability. This function is especially useful to enable an OPP which
144*4882a593Smuzhiyun	is not available by default.
145*4882a593Smuzhiyun	Example: In a case when SoC framework detects a situation where a
146*4882a593Smuzhiyun	higher frequency could be made available, it can use this function to
147*4882a593Smuzhiyun	find the OPP prior to call the dev_pm_opp_enable to actually make
148*4882a593Smuzhiyun	it available::
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun	 opp = dev_pm_opp_find_freq_exact(dev, 1000000000, false);
151*4882a593Smuzhiyun	 dev_pm_opp_put(opp);
152*4882a593Smuzhiyun	 /* dont operate on the pointer.. just do a sanity check.. */
153*4882a593Smuzhiyun	 if (IS_ERR(opp)) {
154*4882a593Smuzhiyun		pr_err("frequency not disabled!\n");
155*4882a593Smuzhiyun		/* trigger appropriate actions.. */
156*4882a593Smuzhiyun	 } else {
157*4882a593Smuzhiyun		dev_pm_opp_enable(dev,1000000000);
158*4882a593Smuzhiyun	 }
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun	NOTE:
161*4882a593Smuzhiyun	  This is the only search function that operates on OPPs which are
162*4882a593Smuzhiyun	  not available.
163*4882a593Smuzhiyun
164*4882a593Smuzhiyundev_pm_opp_find_freq_floor
165*4882a593Smuzhiyun	Search for an available OPP which is *at most* the
166*4882a593Smuzhiyun	provided frequency. This function is useful while searching for a lesser
167*4882a593Smuzhiyun	match OR operating on OPP information in the order of decreasing
168*4882a593Smuzhiyun	frequency.
169*4882a593Smuzhiyun	Example: To find the highest opp for a device::
170*4882a593Smuzhiyun
171*4882a593Smuzhiyun	 freq = ULONG_MAX;
172*4882a593Smuzhiyun	 opp = dev_pm_opp_find_freq_floor(dev, &freq);
173*4882a593Smuzhiyun	 dev_pm_opp_put(opp);
174*4882a593Smuzhiyun
175*4882a593Smuzhiyundev_pm_opp_find_freq_ceil
176*4882a593Smuzhiyun	Search for an available OPP which is *at least* the
177*4882a593Smuzhiyun	provided frequency. This function is useful while searching for a
178*4882a593Smuzhiyun	higher match OR operating on OPP information in the order of increasing
179*4882a593Smuzhiyun	frequency.
180*4882a593Smuzhiyun	Example 1: To find the lowest opp for a device::
181*4882a593Smuzhiyun
182*4882a593Smuzhiyun	 freq = 0;
183*4882a593Smuzhiyun	 opp = dev_pm_opp_find_freq_ceil(dev, &freq);
184*4882a593Smuzhiyun	 dev_pm_opp_put(opp);
185*4882a593Smuzhiyun
186*4882a593Smuzhiyun	Example 2: A simplified implementation of a SoC cpufreq_driver->target::
187*4882a593Smuzhiyun
188*4882a593Smuzhiyun	 soc_cpufreq_target(..)
189*4882a593Smuzhiyun	 {
190*4882a593Smuzhiyun		/* Do stuff like policy checks etc. */
191*4882a593Smuzhiyun		/* Find the best frequency match for the req */
192*4882a593Smuzhiyun		opp = dev_pm_opp_find_freq_ceil(dev, &freq);
193*4882a593Smuzhiyun		dev_pm_opp_put(opp);
194*4882a593Smuzhiyun		if (!IS_ERR(opp))
195*4882a593Smuzhiyun			soc_switch_to_freq_voltage(freq);
196*4882a593Smuzhiyun		else
197*4882a593Smuzhiyun			/* do something when we can't satisfy the req */
198*4882a593Smuzhiyun		/* do other stuff */
199*4882a593Smuzhiyun	 }
200*4882a593Smuzhiyun
201*4882a593Smuzhiyun4. OPP Availability Control Functions
202*4882a593Smuzhiyun=====================================
203*4882a593SmuzhiyunA default OPP list registered with the OPP library may not cater to all possible
204*4882a593Smuzhiyunsituation. The OPP library provides a set of functions to modify the
205*4882a593Smuzhiyunavailability of a OPP within the OPP list. This allows SoC frameworks to have
206*4882a593Smuzhiyunfine grained dynamic control of which sets of OPPs are operationally available.
207*4882a593SmuzhiyunThese functions are intended to *temporarily* remove an OPP in conditions such
208*4882a593Smuzhiyunas thermal considerations (e.g. don't use OPPx until the temperature drops).
209*4882a593Smuzhiyun
210*4882a593SmuzhiyunWARNING:
211*4882a593Smuzhiyun	Do not use these functions in interrupt context.
212*4882a593Smuzhiyun
213*4882a593Smuzhiyundev_pm_opp_enable
214*4882a593Smuzhiyun	Make a OPP available for operation.
215*4882a593Smuzhiyun	Example: Lets say that 1GHz OPP is to be made available only if the
216*4882a593Smuzhiyun	SoC temperature is lower than a certain threshold. The SoC framework
217*4882a593Smuzhiyun	implementation might choose to do something as follows::
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun	 if (cur_temp < temp_low_thresh) {
220*4882a593Smuzhiyun		/* Enable 1GHz if it was disabled */
221*4882a593Smuzhiyun		opp = dev_pm_opp_find_freq_exact(dev, 1000000000, false);
222*4882a593Smuzhiyun		dev_pm_opp_put(opp);
223*4882a593Smuzhiyun		/* just error check */
224*4882a593Smuzhiyun		if (!IS_ERR(opp))
225*4882a593Smuzhiyun			ret = dev_pm_opp_enable(dev, 1000000000);
226*4882a593Smuzhiyun		else
227*4882a593Smuzhiyun			goto try_something_else;
228*4882a593Smuzhiyun	 }
229*4882a593Smuzhiyun
230*4882a593Smuzhiyundev_pm_opp_disable
231*4882a593Smuzhiyun	Make an OPP to be not available for operation
232*4882a593Smuzhiyun	Example: Lets say that 1GHz OPP is to be disabled if the temperature
233*4882a593Smuzhiyun	exceeds a threshold value. The SoC framework implementation might
234*4882a593Smuzhiyun	choose to do something as follows::
235*4882a593Smuzhiyun
236*4882a593Smuzhiyun	 if (cur_temp > temp_high_thresh) {
237*4882a593Smuzhiyun		/* Disable 1GHz if it was enabled */
238*4882a593Smuzhiyun		opp = dev_pm_opp_find_freq_exact(dev, 1000000000, true);
239*4882a593Smuzhiyun		dev_pm_opp_put(opp);
240*4882a593Smuzhiyun		/* just error check */
241*4882a593Smuzhiyun		if (!IS_ERR(opp))
242*4882a593Smuzhiyun			ret = dev_pm_opp_disable(dev, 1000000000);
243*4882a593Smuzhiyun		else
244*4882a593Smuzhiyun			goto try_something_else;
245*4882a593Smuzhiyun	 }
246*4882a593Smuzhiyun
247*4882a593Smuzhiyun5. OPP Data Retrieval Functions
248*4882a593Smuzhiyun===============================
249*4882a593SmuzhiyunSince OPP library abstracts away the OPP information, a set of functions to pull
250*4882a593Smuzhiyuninformation from the OPP structure is necessary. Once an OPP pointer is
251*4882a593Smuzhiyunretrieved using the search functions, the following functions can be used by SoC
252*4882a593Smuzhiyunframework to retrieve the information represented inside the OPP layer.
253*4882a593Smuzhiyun
254*4882a593Smuzhiyundev_pm_opp_get_voltage
255*4882a593Smuzhiyun	Retrieve the voltage represented by the opp pointer.
256*4882a593Smuzhiyun	Example: At a cpufreq transition to a different frequency, SoC
257*4882a593Smuzhiyun	framework requires to set the voltage represented by the OPP using
258*4882a593Smuzhiyun	the regulator framework to the Power Management chip providing the
259*4882a593Smuzhiyun	voltage::
260*4882a593Smuzhiyun
261*4882a593Smuzhiyun	 soc_switch_to_freq_voltage(freq)
262*4882a593Smuzhiyun	 {
263*4882a593Smuzhiyun		/* do things */
264*4882a593Smuzhiyun		opp = dev_pm_opp_find_freq_ceil(dev, &freq);
265*4882a593Smuzhiyun		v = dev_pm_opp_get_voltage(opp);
266*4882a593Smuzhiyun		dev_pm_opp_put(opp);
267*4882a593Smuzhiyun		if (v)
268*4882a593Smuzhiyun			regulator_set_voltage(.., v);
269*4882a593Smuzhiyun		/* do other things */
270*4882a593Smuzhiyun	 }
271*4882a593Smuzhiyun
272*4882a593Smuzhiyundev_pm_opp_get_freq
273*4882a593Smuzhiyun	Retrieve the freq represented by the opp pointer.
274*4882a593Smuzhiyun	Example: Lets say the SoC framework uses a couple of helper functions
275*4882a593Smuzhiyun	we could pass opp pointers instead of doing additional parameters to
276*4882a593Smuzhiyun	handle quiet a bit of data parameters::
277*4882a593Smuzhiyun
278*4882a593Smuzhiyun	 soc_cpufreq_target(..)
279*4882a593Smuzhiyun	 {
280*4882a593Smuzhiyun		/* do things.. */
281*4882a593Smuzhiyun		 max_freq = ULONG_MAX;
282*4882a593Smuzhiyun		 max_opp = dev_pm_opp_find_freq_floor(dev,&max_freq);
283*4882a593Smuzhiyun		 requested_opp = dev_pm_opp_find_freq_ceil(dev,&freq);
284*4882a593Smuzhiyun		 if (!IS_ERR(max_opp) && !IS_ERR(requested_opp))
285*4882a593Smuzhiyun			r = soc_test_validity(max_opp, requested_opp);
286*4882a593Smuzhiyun		 dev_pm_opp_put(max_opp);
287*4882a593Smuzhiyun		 dev_pm_opp_put(requested_opp);
288*4882a593Smuzhiyun		/* do other things */
289*4882a593Smuzhiyun	 }
290*4882a593Smuzhiyun	 soc_test_validity(..)
291*4882a593Smuzhiyun	 {
292*4882a593Smuzhiyun		 if(dev_pm_opp_get_voltage(max_opp) < dev_pm_opp_get_voltage(requested_opp))
293*4882a593Smuzhiyun			 return -EINVAL;
294*4882a593Smuzhiyun		 if(dev_pm_opp_get_freq(max_opp) < dev_pm_opp_get_freq(requested_opp))
295*4882a593Smuzhiyun			 return -EINVAL;
296*4882a593Smuzhiyun		/* do things.. */
297*4882a593Smuzhiyun	 }
298*4882a593Smuzhiyun
299*4882a593Smuzhiyundev_pm_opp_get_opp_count
300*4882a593Smuzhiyun	Retrieve the number of available opps for a device
301*4882a593Smuzhiyun	Example: Lets say a co-processor in the SoC needs to know the available
302*4882a593Smuzhiyun	frequencies in a table, the main processor can notify as following::
303*4882a593Smuzhiyun
304*4882a593Smuzhiyun	 soc_notify_coproc_available_frequencies()
305*4882a593Smuzhiyun	 {
306*4882a593Smuzhiyun		/* Do things */
307*4882a593Smuzhiyun		num_available = dev_pm_opp_get_opp_count(dev);
308*4882a593Smuzhiyun		speeds = kzalloc(sizeof(u32) * num_available, GFP_KERNEL);
309*4882a593Smuzhiyun		/* populate the table in increasing order */
310*4882a593Smuzhiyun		freq = 0;
311*4882a593Smuzhiyun		while (!IS_ERR(opp = dev_pm_opp_find_freq_ceil(dev, &freq))) {
312*4882a593Smuzhiyun			speeds[i] = freq;
313*4882a593Smuzhiyun			freq++;
314*4882a593Smuzhiyun			i++;
315*4882a593Smuzhiyun			dev_pm_opp_put(opp);
316*4882a593Smuzhiyun		}
317*4882a593Smuzhiyun
318*4882a593Smuzhiyun		soc_notify_coproc(AVAILABLE_FREQs, speeds, num_available);
319*4882a593Smuzhiyun		/* Do other things */
320*4882a593Smuzhiyun	 }
321*4882a593Smuzhiyun
322*4882a593Smuzhiyun6. Data Structures
323*4882a593Smuzhiyun==================
324*4882a593SmuzhiyunTypically an SoC contains multiple voltage domains which are variable. Each
325*4882a593Smuzhiyundomain is represented by a device pointer. The relationship to OPP can be
326*4882a593Smuzhiyunrepresented as follows::
327*4882a593Smuzhiyun
328*4882a593Smuzhiyun  SoC
329*4882a593Smuzhiyun   |- device 1
330*4882a593Smuzhiyun   |	|- opp 1 (availability, freq, voltage)
331*4882a593Smuzhiyun   |	|- opp 2 ..
332*4882a593Smuzhiyun   ...	...
333*4882a593Smuzhiyun   |	`- opp n ..
334*4882a593Smuzhiyun   |- device 2
335*4882a593Smuzhiyun   ...
336*4882a593Smuzhiyun   `- device m
337*4882a593Smuzhiyun
338*4882a593SmuzhiyunOPP library maintains a internal list that the SoC framework populates and
339*4882a593Smuzhiyunaccessed by various functions as described above. However, the structures
340*4882a593Smuzhiyunrepresenting the actual OPPs and domains are internal to the OPP library itself
341*4882a593Smuzhiyunto allow for suitable abstraction reusable across systems.
342*4882a593Smuzhiyun
343*4882a593Smuzhiyunstruct dev_pm_opp
344*4882a593Smuzhiyun	The internal data structure of OPP library which is used to
345*4882a593Smuzhiyun	represent an OPP. In addition to the freq, voltage, availability
346*4882a593Smuzhiyun	information, it also contains internal book keeping information required
347*4882a593Smuzhiyun	for the OPP library to operate on.  Pointer to this structure is
348*4882a593Smuzhiyun	provided back to the users such as SoC framework to be used as a
349*4882a593Smuzhiyun	identifier for OPP in the interactions with OPP layer.
350*4882a593Smuzhiyun
351*4882a593Smuzhiyun	WARNING:
352*4882a593Smuzhiyun	  The struct dev_pm_opp pointer should not be parsed or modified by the
353*4882a593Smuzhiyun	  users. The defaults of for an instance is populated by
354*4882a593Smuzhiyun	  dev_pm_opp_add, but the availability of the OPP can be modified
355*4882a593Smuzhiyun	  by dev_pm_opp_enable/disable functions.
356*4882a593Smuzhiyun
357*4882a593Smuzhiyunstruct device
358*4882a593Smuzhiyun	This is used to identify a domain to the OPP layer. The
359*4882a593Smuzhiyun	nature of the device and its implementation is left to the user of
360*4882a593Smuzhiyun	OPP library such as the SoC framework.
361*4882a593Smuzhiyun
362*4882a593SmuzhiyunOverall, in a simplistic view, the data structure operations is represented as
363*4882a593Smuzhiyunfollowing::
364*4882a593Smuzhiyun
365*4882a593Smuzhiyun  Initialization / modification:
366*4882a593Smuzhiyun              +-----+        /- dev_pm_opp_enable
367*4882a593Smuzhiyun  dev_pm_opp_add --> | opp | <-------
368*4882a593Smuzhiyun    |         +-----+        \- dev_pm_opp_disable
369*4882a593Smuzhiyun    \-------> domain_info(device)
370*4882a593Smuzhiyun
371*4882a593Smuzhiyun  Search functions:
372*4882a593Smuzhiyun               /-- dev_pm_opp_find_freq_ceil  ---\   +-----+
373*4882a593Smuzhiyun  domain_info<---- dev_pm_opp_find_freq_exact -----> | opp |
374*4882a593Smuzhiyun               \-- dev_pm_opp_find_freq_floor ---/   +-----+
375*4882a593Smuzhiyun
376*4882a593Smuzhiyun  Retrieval functions:
377*4882a593Smuzhiyun  +-----+     /- dev_pm_opp_get_voltage
378*4882a593Smuzhiyun  | opp | <---
379*4882a593Smuzhiyun  +-----+     \- dev_pm_opp_get_freq
380*4882a593Smuzhiyun
381*4882a593Smuzhiyun  domain_info <- dev_pm_opp_get_opp_count
382