Lines Matching +full:opp +full:- +full:1

2 Operating Performance Points (OPP) Library
5 (C) 2009-2010 Nishanth Menon <nm@ti.com>, Texas Instruments Incorporated
9 1. Introduction
10 2. Initial OPP List Registration
11 3. OPP Search Functions
12 4. OPP Availability Control Functions
13 5. OPP Data Retrieval Functions
16 1. Introduction
19 1.1 What is an Operating Performance Point (OPP)?
20 -------------------------------------------------
22 Complex SoCs of today consists of a multiple sub-modules working in conjunction.
25 facilitate this, sub-modules in a SoC are grouped into domains, allowing some
36 {300MHz at minimum voltage of 1V}, {800MHz at minimum voltage of 1.2V},
37 {1GHz at minimum voltage of 1.3V}
41 - {300000000, 1000000}
42 - {800000000, 1200000}
43 - {1000000000, 1300000}
46 ----------------------------------------
48 OPP library provides a set of helper functions to organize and query the OPP
49 information. The library is located in drivers/opp/ directory and the header
50 is located in include/linux/pm_opp.h. OPP library can be enabled by enabling
52 Instrument's OMAP framework allows to optionally boot at a certain OPP without
55 Typical usage of the OPP library is as follows::
57 (users) -> registers a set of default OPPs -> (library)
58 SoC framework -> modifies on required cases certain OPPs -> OPP layer
59 -> queries to search/retrieve information ->
61 OPP layer expects each domain to be represented by a unique device pointer. SoC
62 framework registers a set of initial OPPs per device with the OPP layer. This
67 Note on OPP Availability
73 SoC framework might choose to disable a higher frequency OPP to safely continue
74 operations until that OPP could be re-enabled if possible.
76 OPP library facilitates this concept in its implementation. The following
81 dev_pm_opp_find_freq_exact is meant to be used to find the opp pointer
83 opp available as required.
85 WARNING: Users of OPP library should refresh their availability count using
89 the SoC specific framework which uses the OPP library. Similar care needs
92 2. Initial OPP List Registration
95 device. It is expected that the SoC framework will register the OPP entries
96 optimally- typical numbers range to be less than 5. The list generated by
97 registering the OPPs is maintained by OPP library throughout the device
102 Add a new OPP for a specific domain represented by the device pointer.
103 The OPP is defined using the frequency and voltage. Once added, the OPP
105 with the dev_pm_opp_enable/disable functions. OPP library
120 pr_err("%s: unable to register mpu opp(%d)\n", r);
128 3. OPP Search Functions
131 frequency back to the corresponding OPP, OPP library provides handy functions
132 to search the OPP list that OPP library internally manages. These search
133 functions return the matching pointer representing the opp if a match is
138 OPP. Otherwise the memory for the OPP will never get freed and result in
142 Search for an OPP based on an *exact* frequency and
143 availability. This function is especially useful to enable an OPP which
147 find the OPP prior to call the dev_pm_opp_enable to actually make
150 opp = dev_pm_opp_find_freq_exact(dev, 1000000000, false);
151 dev_pm_opp_put(opp);
153 if (IS_ERR(opp)) {
165 Search for an available OPP which is *at most* the
167 match OR operating on OPP information in the order of decreasing
169 Example: To find the highest opp for a device::
172 opp = dev_pm_opp_find_freq_floor(dev, &freq);
173 dev_pm_opp_put(opp);
176 Search for an available OPP which is *at least* the
178 higher match OR operating on OPP information in the order of increasing
180 Example 1: To find the lowest opp for a device::
183 opp = dev_pm_opp_find_freq_ceil(dev, &freq);
184 dev_pm_opp_put(opp);
186 Example 2: A simplified implementation of a SoC cpufreq_driver->target::
192 opp = dev_pm_opp_find_freq_ceil(dev, &freq);
193 dev_pm_opp_put(opp);
194 if (!IS_ERR(opp))
201 4. OPP Availability Control Functions
203 A default OPP list registered with the OPP library may not cater to all possible
204 situation. The OPP library provides a set of functions to modify the
205 availability of a OPP within the OPP list. This allows SoC frameworks to have
207 These functions are intended to *temporarily* remove an OPP in conditions such
214 Make a OPP available for operation.
215 Example: Lets say that 1GHz OPP is to be made available only if the
220 /* Enable 1GHz if it was disabled */
221 opp = dev_pm_opp_find_freq_exact(dev, 1000000000, false);
222 dev_pm_opp_put(opp);
224 if (!IS_ERR(opp))
231 Make an OPP to be not available for operation
232 Example: Lets say that 1GHz OPP is to be disabled if the temperature
237 /* Disable 1GHz if it was enabled */
238 opp = dev_pm_opp_find_freq_exact(dev, 1000000000, true);
239 dev_pm_opp_put(opp);
241 if (!IS_ERR(opp))
247 5. OPP Data Retrieval Functions
249 Since OPP library abstracts away the OPP information, a set of functions to pull
250 information from the dev_pm_opp structure is necessary. Once an OPP pointer is
252 framework to retrieve the information represented inside the OPP layer.
255 Retrieve the voltage represented by the opp pointer.
257 framework requires to set the voltage represented by the OPP using
264 opp = dev_pm_opp_find_freq_ceil(dev, &freq);
265 v = dev_pm_opp_get_voltage(opp);
266 dev_pm_opp_put(opp);
273 Retrieve the freq represented by the opp pointer.
275 we could pass opp pointers instead of doing additional parameters to
293 return -EINVAL;
295 return -EINVAL;
301 Example: Lets say a co-processor in the SoC needs to know the available
311 while (!IS_ERR(opp = dev_pm_opp_find_freq_ceil(dev, &freq))) {
315 dev_pm_opp_put(opp);
325 domain is represented by a device pointer. The relationship to OPP can be
329 |- device 1
330 | |- opp 1 (availability, freq, voltage)
331 | |- opp 2 ..
333 | `- opp n ..
334 |- device 2
336 `- device m
338 OPP library maintains a internal list that the SoC framework populates and
340 representing the actual OPPs and domains are internal to the OPP library itself
344 The internal data structure of OPP library which is used to
345 represent an OPP. In addition to the freq, voltage, availability
347 for the OPP library to operate on. Pointer to this structure is
349 identifier for OPP in the interactions with OPP layer.
354 dev_pm_opp_add, but the availability of the OPP can be modified
358 This is used to identify a domain to the OPP layer. The
360 OPP library such as the SoC framework.
366 +-----+ /- dev_pm_opp_enable
367 dev_pm_opp_add --> | opp | <-------
368 | +-----+ \- dev_pm_opp_disable
369 \-------> domain_info(device)
372 /-- dev_pm_opp_find_freq_ceil ---\ +-----+
373 domain_info<---- dev_pm_opp_find_freq_exact -----> | opp |
374 \-- dev_pm_opp_find_freq_floor ---/ +-----+
377 +-----+ /- dev_pm_opp_get_voltage
378 | opp | <---
379 +-----+ \- dev_pm_opp_get_freq
381 domain_info <- dev_pm_opp_get_opp_count