Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1187)

Side by Side Diff: arch/arm/mach-tegra/nv/include/nvrm_power_private.h

Issue 3256004: [ARM] tegra: add nvos/nvrm/nvmap drivers (Closed) Base URL: ssh://git@gitrw.chromium.org/kernel.git
Patch Set: remove ap15 headers Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « arch/arm/mach-tegra/nv/include/nvrm_power.h ('k') | arch/arm/mach-tegra/nv/include/nvrm_pwm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2007-2009 NVIDIA Corporation.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * Neither the name of the NVIDIA Corporation nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33 #ifndef INCLUDED_NVRM_POWER_PRIVATE_H
34 #define INCLUDED_NVRM_POWER_PRIVATE_H
35
36 #include "nvrm_power.h"
37 #include "nvodm_query.h"
38
39 #ifdef __cplusplus
40 extern "C"
41 {
42 #endif /* __cplusplus */
43
44 // Power detect cell stabilization delay
45 #define NVRM_PWR_DET_DELAY_US (3)
46
47 // Minimum DFS clock domain busy time and busy hints list purge time
48 #define NVRM_DFS_BUSY_MIN_MS (10)
49 #define NVRM_DFS_BUSY_PURGE_MS (500)
50
51 // Temporary definitions for AP20 bring up
52 #define NVRM_POWER_AP20_BRINGUP_RETURN(hRm, cond) \
53 if (((hRm)->ChipId.Id == 0x20) && ((cond))) \
54 return
55
56 /**
57 * Defines the DFS status flags used by OS kernel to configure SoC for
58 * low power state (multiple flags can be OR'ed).
59 */
60 typedef enum
61 {
62 // Pause DFS during low power state
63 NvRmDfsStatusFlags_Pause = 0x01,
64
65 // Stop PLL during low power state
66 NvRmDfsStatusFlags_StopPllM0 = 0x02,
67 NvRmDfsStatusFlags_StopPllC0 = 0x04,
68 NvRmDfsStatusFlags_StopPllP0 = 0x08,
69 NvRmDfsStatusFlags_StopPllA0 = 0x10,
70 NvRmDfsStatusFlags_StopPllD0 = 0x20,
71 NvRmDfsStatusFlags_StopPllU0 = 0x40,
72 NvRmDfsStatusFlags_StopPllX0 = 0x80,
73
74 NvRmDfsStatusFlags_Force32 = 0x7FFFFFFF
75 } NvRmDfsStatusFlags;
76
77 // Defines maximum number of CPUs (must be power of 2)
78 #define NVRM_MAX_NUM_CPU_LOG2 (8)
79
80 /**
81 * Defines RM power manager requests to OS kernel
82 */
83 typedef enum
84 {
85 NvRmPmRequest_None = 0,
86
87 // The CPU number is interpreted based on the request flag it is
88 // combined (ORed) with
89 NvRmPmRequest_CpuNumMask = (0x1 << NVRM_MAX_NUM_CPU_LOG2) - 1,
90
91 // Request to abort RM power manager (CPU number is ignored)
92 NvRmPmRequest_ExitFlag,
93
94 // Request to turn On/Off CPU (CPU number specifies target
95 // CPU within current CPU cluster)
96 NvRmPmRequest_CpuOnFlag = NvRmPmRequest_ExitFlag << 1,
97 NvRmPmRequest_CpuOffFlag = NvRmPmRequest_CpuOnFlag << 1,
98
99 // Request to switch between CPU clusters (CPU number specifies target
100 // CPU cluster)
101 NvRmPmRequest_CpuClusterSwitchFlag = NvRmPmRequest_CpuOffFlag << 1,
102
103 NvRmPmRequest_Force32 = 0x7FFFFFFF
104 } NvRmPmRequest;
105
106 /**
107 * NVRM PM function called within OS shim high priority thread
108 */
109 NvRmPmRequest NvRmPrivPmThread(void);
110
111 /**
112 * Sets combined RM clients power state in the storage shared with OS
113 * adaptation layer (OAL). While the system is running RM power manger
114 * calls this function to specify idle or active state based on client
115 * requests. On entry to system low power state OAL calls this function
116 * to store the respective LPx id.
117 *
118 * @param hRmDeviceHandle The RM device handle
119 * @param RmState The overall power state to be set
120 */
121 void
122 NvRmPrivPowerSetState(
123 NvRmDeviceHandle hRmDeviceHandle,
124 NvRmPowerState RmState);
125
126 /**
127 * Reads combined RM clients power state from the storage shared with OS
128 * adaptation layer (OAL). While the system is running both RM and OAL may
129 * call this function to read the power state. On exit from the system low
130 * power state OAL uses this function to find out which LPx state is exited.
131 *
132 * @param hRmDeviceHandle The RM device handle
133 *
134 * @return RM power state
135 */
136 NvRmPowerState
137 NvRmPrivPowerGetState(NvRmDeviceHandle hRmDeviceHandle);
138
139 /**
140 * Updates DFS pause flag in the storage shared by RM and NV boot loader
141 *
142 * @param hRmDeviceHandle The RM device handle
143 * @param Pause If NV_TRUE, set DFS pause flag,
144 * if NV_FALSE, clear DFS pause flag
145 *
146 */
147 void
148 NvRmPrivUpdateDfsPauseFlag(
149 NvRmDeviceHandle hRmDeviceHandle,
150 NvBool Pause);
151
152 /**
153 * Reads DFS status flags from the storage shared by RM and NV boot loader.
154 *
155 * @param hRmDeviceHandle The RM device handle
156 *
157 * @return DFS status flags as defined @NvRmDfsStatusFlags
158 */
159 NvU32
160 NvRmPrivGetDfsFlags(NvRmDeviceHandle hRmDeviceHandle);
161
162 /**
163 * Sets download transport in the storage shared by RM and NV boot loader
164 *
165 * @param hRmDeviceHandle The RM device handle
166 * @param Transport current download transport (NvOdmDownloadTransport_None
167 * if no transport or it is not active)
168 */
169 void
170 NvRmPrivSetDownloadTransport(
171 NvRmDeviceHandle hRmDeviceHandle,
172 NvOdmDownloadTransport Transport);
173
174 /**
175 * Reads download transport from the storage shared by RM and NV boot loader.
176 *
177 * @param hRmDeviceHandle The RM device handle
178 *
179 * @return current download transport (NvOdmDownloadTransport_None
180 * if no transport or it is not active)
181 */
182 NvOdmDownloadTransport
183 NvRmPrivGetDownloadTransport(NvRmDeviceHandle hRmDeviceHandle);
184
185 /**
186 * Save LP2 time in the storage shared by RM and NV boot loader.
187 *
188 * @param hRmDeviceHandle The RM device handle
189 * @param TimeUS Time in microseconds CPU was in LP2 state (power gated)
190 */
191 void
192 NvRmPrivSetLp2TimeUS(
193 NvRmDeviceHandle hRmDeviceHandle,
194 NvU32 TimeUS);
195
196 /**
197 * Reads LP2 time from the storage shared by RM and NV boot loader.
198 *
199 * @param hRmDeviceHandle The RM device handle
200 *
201 * @return Time in microseconds CPU was in LP2 state (power gated)
202 */
203 NvU32
204 NvRmPrivGetLp2TimeUS(NvRmDeviceHandle hRmDeviceHandle);
205
206 /**
207 * Initializes RM access to the storage shared by RM and NV boot loader
208 *
209 * @param hRmDeviceHandle The RM device handle
210 *
211 * @return NvSuccess if initialization completed successfully
212 * or one of common error codes on failure
213 */
214 NvError NvRmPrivOalIntfInit(NvRmDeviceHandle hRmDeviceHandle);
215
216 /**
217 * Deinitializes RM access to the storage shared by RM and NV boot loader
218 *
219 * @param hRmDeviceHandle The RM device handle
220 */
221 void NvRmPrivOalIntfDeinit(NvRmDeviceHandle hRmDeviceHandle);
222
223 /**
224 * Initializes RM DFS manager
225 *
226 * @param hRmDeviceHandle The RM device handle
227 *
228 * @return NvSuccess if initialization completed successfully
229 * or one of common error codes on failure
230 */
231 NvError NvRmPrivDfsInit(NvRmDeviceHandle hRmDeviceHandle);
232
233 /**
234 * Deinitializes RM DFS manager
235 *
236 * @param hRmDeviceHandle The RM device handle
237 */
238 void NvRmPrivDfsDeinit(NvRmDeviceHandle hRmDeviceHandle);
239
240 /**
241 * Initializes RM DTT manager
242 *
243 * @param hRmDeviceHandle The RM device handle
244 */
245 void NvRmPrivDttInit(NvRmDeviceHandle hRmDeviceHandle);
246
247 /**
248 * Deinitializes RM DTT manager
249 */
250 void NvRmPrivDttDeinit(void);
251
252 /**
253 * Initializes RM power manager
254 *
255 * @param hRmDeviceHandle The RM device handle
256 *
257 * @return NvSuccess if initialization completed successfully
258 * or one of common error codes on failure
259 */
260 NvError
261 NvRmPrivPowerInit(NvRmDeviceHandle hRmDeviceHandle);
262
263 /**
264 * Deinitializes RM power manager
265 *
266 * @param hRmDeviceHandle The RM device handle
267 */
268 void
269 NvRmPrivPowerDeinit(NvRmDeviceHandle hRmDeviceHandle);
270
271 /**
272 * Initializes IO power rails control
273 *
274 * @param hRmDeviceHandle The RM device handle
275 */
276 void NvRmPrivIoPowerControlInit(NvRmDeviceHandle hRmDeviceHandle);
277
278 /**
279 * Starts IO power rails level detection
280 *
281 * @param hRmDeviceHandle The RM device handle
282 * @param PwrDetMask The bit mask of power detection cells to be activated
283 */
284 void NvRmPrivIoPowerDetectStart(
285 NvRmDeviceHandle hRmDeviceHandle,
286 NvU32 PwrDetMask);
287
288 /**
289 * Resets enabled power detect cells (chip-specific).
290 *
291 * @param hRmDeviceHandle The RM device handle
292 */
293 void NvRmPrivAp15IoPowerDetectReset(NvRmDeviceHandle hRmDeviceHandle);
294 void NvRmPrivAp20IoPowerDetectReset(NvRmDeviceHandle hRmDeviceHandle);
295
296 /**
297 * Latches the results of IO power rails level detection
298 *
299 * @param hRmDeviceHandle The RM device handle
300 */
301 void NvRmPrivIoPowerDetectLatch(NvRmDeviceHandle hRmDeviceHandle);
302
303 /**
304 * Enables/Disables IO pads on specified power rails
305 *
306 * @param hRmDeviceHandle The RM device handle
307 * @param NoIoPwrMask Bit mask of affected power rails
308 * @param Enable Set NV_TRUE to enable IO pads, or NV_FALSE to disable.
309 */
310 void NvRmPrivIoPowerControl(
311 NvRmDeviceHandle hRmDeviceHandle,
312 NvU32 NoIoPwrMask,
313 NvBool Enable);
314
315 /**
316 * Configures SoC power rail controls for the upcoming PMU voltage transition.
317 *
318 * @note Should be called just before PMU rail On/Off, or Off/On transition.
319 * Should not be called if rail voltage level is changing within On range.
320 *
321 * @param hDevice The Rm device handle.
322 * @param PmuRailAddress PMU address (id) for targeted power rail.
323 * @param Enable Set NV_TRUE if target voltage is about to be turned On, or
324 * NV_FALSE if target voltage is about to be turned Off.
325 * @param pIoPwrDetectMask A pointer to a variable filled with the bit mask
326 * of activated IO power detection cells to be latched by the caller after
327 * Off/On transition (set to 0 for On/Off transition).
328 * @param pNoIoPwrMask A pointer to a variable filled with the bit mask of IO
329 * power pads to be enabled by the caller after Off/On transition (set to 0
330 * for On/Off transition).
331 */
332 void
333 NvRmPrivSetSocRailPowerState(
334 NvRmDeviceHandle hRmDeviceHandle,
335 NvU32 PmuRailAddress,
336 NvBool Enable,
337 NvU32* pIoPwrDetectMask,
338 NvU32* pNoIoPwrMask);
339
340 /**
341 * Initializes core SoC power rail.
342 *
343 * @param hDevice The Rm device handle.
344 */
345 void NvRmPrivCoreVoltageInit(NvRmDeviceHandle hRmDevice);
346
347 /**
348 * Request nominal core (and rtc) voltage.
349 *
350 * @param hRmDeviceHandle The RM device handle
351 */
352 void
353 NvRmPrivSetNominalCoreVoltage(NvRmDeviceHandle hRmDevice);
354
355 /**
356 * Initializes power group control table (chip-specific)
357 *
358 * @param pPowerGroupIdsTable
359 * @param pPowerGroupIdsTable A pointer to a pointer which this function sets
360 * to the chip specific map between power group number and power gate ID.
361 * @param pPowerGroupIdsTableSize A pointer to a variable which this function
362 * sets to the power group IDs table size.
363 *
364 */
365 void
366 NvRmPrivAp15PowerGroupTableInit(
367 const NvU32** pPowerGroupIdsTable,
368 NvU32* pPowerGroupIdsTableSize);
369
370 void
371 NvRmPrivAp20PowerGroupTableInit(
372 const NvU32** pPowerGroupIdsTable,
373 NvU32* pPowerGroupIdsTableSize);
374
375 /**
376 * Initializes power group control.
377 *
378 * @param hRmDeviceHandle The RM device handle
379 */
380 void NvRmPrivPowerGroupControlInit(NvRmDeviceHandle hRmDeviceHandle);
381
382 /**
383 * Enables/disables power for the specified power group
384 *
385 * @param hRmDeviceHandle The RM device handle
386 * @param PowerGroup targeted power group
387 * @param Enable If NV_TRUE, enable power to the specified power group,
388 * if NV_FALSE, disable power (power gate) the specified power group
389 */
390 void
391 NvRmPrivPowerGroupControl(
392 NvRmDeviceHandle hRmDeviceHandle,
393 NvU32 PowerGroup,
394 NvBool Enable);
395
396 /**
397 * Retrieves given power group voltage
398 *
399 * @param hRmDeviceHandle The RM device handle
400 * @param PowerGroup targeted power group
401 *
402 * @return NvRmVoltsUnspecified if power group is On,
403 * and NvRmVoltsOff if it is power gated
404 */
405 NvRmMilliVolts
406 NvRmPrivPowerGroupGetVoltage(
407 NvRmDeviceHandle hRmDeviceHandle,
408 NvU32 PowerGroup);
409
410 /**
411 * Controls power state and clamping for PCIEXCLK/PLLE (chip-specific).
412 *
413 * @param hRmDevice The RM device handle.
414 * @param Enable If NV_TRUE, power up PCIEXCLK and remove clamps,
415 * if NV_FALSE, power down PCIEXCLK and set clamps.
416 */
417 void
418 NvRmPrivAp20PowerPcieXclkControl(
419 NvRmDeviceHandle hRmDevice,
420 NvBool Enable);
421
422 /**
423 * Verifies if the specified DFS clock domain is starving.
424 *
425 * @param ClockId The DFS ID of the clock domain to be checked.
426 *
427 * @retval NV_TRUE if domain is starving
428 * @retval NV_FALSE if domain is not starving
429 */
430 NvBool NvRmPrivDfsIsStarving(NvRmDfsClockId ClockId);
431
432 /**
433 * Gets current busy boost frequency and pulse mode requested for the
434 * specified DFS clock domain.
435 *
436 * @param ClockId The DFS ID of the targeted clock domain.
437 * @param pBusyKHz A pointer to a variable filled with boost frequency in kHz.
438 * @param pBusyKHz A pointer to a variable filled with pulse mode indicator.
439 * @param pBusyExpireMs A pointer to a variable filled with busy boost
440 * expiration interval in ms.
441 */
442 void NvRmPrivDfsGetBusyHint(
443 NvRmDfsClockId ClockId,
444 NvRmFreqKHz* pBusyKHz,
445 NvBool* pBusyPulseMode,
446 NvU32* pBusyExpireMs);
447
448 /**
449 * Gets maximum frequency for the specified DFS clock domain.
450 *
451 * @param ClockId The DFS ID of the targeted clock domain.
452 *
453 * @return Maximum domain frequency in kHz
454 */
455 NvRmFreqKHz NvRmPrivDfsGetMaxKHz(NvRmDfsClockId ClockId);
456
457 /**
458 * Gets minimum frequency for the specified DFS clock domain.
459 *
460 * @param ClockId The DFS ID of the targeted clock domain.
461 *
462 * @return Minimum domain frequency in kHz
463 */
464 NvRmFreqKHz NvRmPrivDfsGetMinKHz(NvRmDfsClockId ClockId);
465
466 /**
467 * Gets current frequency for the specified DFS clock domain.
468 *
469 * @param ClockId The DFS ID of the targeted clock domain.
470 *
471 * @return Current domain frequency in kHz
472 */
473 NvRmFreqKHz NvRmPrivDfsGetCurrentKHz(NvRmDfsClockId ClockId);
474
475 /**
476 * Signals DFS clock control thread
477 *
478 * @param Mode Synchronization mode. In synchronous mode this function returns
479 * to the caller after DFS clock control procedure is executed (blocking call).
480 * In asynchronous mode returns immediately after control thread is signaled.
481 */
482 void NvRmPrivDfsSignal(NvRmDfsBusyHintSyncMode Mode);
483
484 /**
485 * Synchronize DFS samplers with current clock frequencies
486 */
487 void NvRmPrivDfsResync(void);
488
489 /**
490 * Gets DFS ready for low power state entry.
491 *
492 * @param state Target low power state.
493 *
494 */
495 void NvRmPrivDfsSuspend(NvOdmSocPowerState state);
496
497 /**
498 * Restore clock sources after exit from low power state.
499 *
500 * @param hRmDevice The RM device handle.
501 */
502 void
503 NvRmPrivClocksResume(NvRmDeviceHandle hRmDevice);
504
505
506 /**
507 * Initializes DVS settings
508 */
509 void NvRmPrivDvsInit(void);
510
511 /**
512 * Scales core voltage according to DFS controlled clock frequencies.
513 *
514 * @param BeforeFreqChange Indicates whether this function is called
515 * before (NV_TRUE) or after (NV_FALSE) frequency change.
516 * @param CpuMv Core voltage in mV required to run CPU at clock source
517 * frequency selected by DFS.
518 * @param SystemMv Core voltage in mV required to run AVP/System at clock
519 * source frequency selected by DFS.
520 * @param EmcMv Core voltage in mV required to run EMC/DDR at clock source
521 * frequency selected by DFS.
522 */
523 void NvRmPrivVoltageScale(
524 NvBool BeforeFreqChange,
525 NvRmMilliVolts CpuMv,
526 NvRmMilliVolts SystemMv,
527 NvRmMilliVolts EmcMv);
528
529 /**
530 * Requests core voltage update.
531 *
532 * @param TargetMv Requested core voltage level in mV.
533 */
534 void NvRmPrivDvsRequest(NvRmMilliVolts TargetMv);
535
536 /**
537 * Gets low threshold and present voltage on the given rail.
538 *
539 * @param RailId The targeted voltage rail ID.
540 * @param pLowMv Output storage pointer for low voltage threshold (in
541 * millivolt).
542 * @param pPresentMv Output storage pointer for present rail voltage (in
543 * millivolt). This parameter is optional, set to NULL if only low
544 * threshold is to be retrieved.
545 *
546 * NvRmVoltsUnspecified is returned if targeted rail does not exist on SoC.
547 */
548 void
549 NvRmPrivGetLowVoltageThreshold(
550 NvRmDfsVoltageRailId RailId,
551 NvRmMilliVolts* pLowMv,
552 NvRmMilliVolts* pPresentMv);
553
554 /**
555 * Outputs debug messages for starvation hints sent by the specified client.
556 *
557 * @param ClientId The client ID assigned by the RM power manager.
558 * @param ClientTag The client tag reported to the RM power manager.
559 * @param pMultiHint Pointer to a list of starvation hints sent by the client.
560 * @param NumHints Number of entries in the pMultiHint list.
561 *
562 */
563 void NvRmPrivStarvationHintPrintf(
564 NvU32 ClientId,
565 NvU32 ClientTag,
566 const NvRmDfsStarvationHint* pMultiHint,
567 NvU32 NumHints);
568
569 /**
570 * Outputs debug messages for busy hints sent by the specified client.
571 *
572 * @param ClientId The client ID assigned by the RM power manager.
573 * @param ClientTag The client tag reported to the RM power manager.
574 * @param pMultiHint Pointer to a list of busy hints sent by the client.
575 * @param NumHints Number of entries in the pMultiHint list.
576 *
577 */
578 void NvRmPrivBusyHintPrintf(
579 NvU32 ClientId,
580 NvU32 ClientTag,
581 const NvRmDfsBusyHint* pMultiHint,
582 NvU32 NumHints);
583
584 #ifdef __cplusplus
585 }
586 #endif /* __cplusplus */
587
588 #endif // INCLUDED_NVRM_POWER_PRIVATE_H
OLDNEW
« no previous file with comments | « arch/arm/mach-tegra/nv/include/nvrm_power.h ('k') | arch/arm/mach-tegra/nv/include/nvrm_pwm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698