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

Side by Side Diff: arch/arm/mach-tegra/nv/include/nvodm_pmu.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
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2006-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 /**
34 * @file
35 * <b>NVIDIA Tegra ODM Kit:
36 * Power Management Unit Interface</b>
37 *
38 * @b Description: Defines the ODM interface for NVIDIA PMU devices.
39 *
40 */
41
42 #ifndef INCLUDED_NVODM_PMU_H
43 #define INCLUDED_NVODM_PMU_H
44
45 #include "nvcommon.h"
46 #include "nvodm_query.h"
47
48 #if defined(__cplusplus)
49 extern "C"
50 {
51 #endif
52
53 /**
54 * @defgroup nvodm_pmu Power Management Unit Adaptation Interface
55 *
56 * This is the power management unit (PMU) ODM adaptation interface, which
57 * handles the abstraction of external power management devices.
58 * For NVIDIA&reg; Driver Development Kit (DDK) clients, PMU is a
59 * set of voltages used to provide power to the SoC or to monitor low battery
60 * conditions. The API allows DDK clients to determine whether the
61 * particular voltage is supported by the ODM platform, retrieve the
62 * capabilities of PMU, and get/set voltage levels at runtime.
63 * On systems without power a management device, APIs should be dummy implemente d.
64 *
65 * All voltage rails are referenced using ODM-assigned unsigned integers. ODMs
66 * may select any convention for assigning these values; however, the values
67 * accepted as input parameters by the PMU ODM adaptation interface must
68 * match the values stored in the address field of ::NvOdmIoModule_Vdd buses
69 * defined in the Peripheral Discovery ODM adaptation.
70 *
71 * @ingroup nvodm_adaptation
72 * @{
73 */
74
75
76 /**
77 * Defines an opaque handle that exists for each PMU device in the
78 * system, each of which is defined by the customer implementation.
79 */
80 typedef struct NvOdmPmuDeviceRec *NvOdmPmuDeviceHandle;
81
82 /**
83 * Combines information for the particular PMU Vdd rail.
84 */
85 typedef struct NvOdmPmuVddRailCapabilitiesRec
86 {
87 /// Specifies ODM protection attribute; if \c NV_TRUE PMU hardware
88 /// or ODM Kit would protect this voltage from being changed by NvDdk clien t.
89 NvBool OdmProtected;
90
91 /// Specifies the minimum voltage level in mV.
92 NvU32 MinMilliVolts;
93
94 /// Specifies the step voltage level in mV.
95 NvU32 StepMilliVolts;
96
97 /// Specifies the maximum voltage level in mV.
98 NvU32 MaxMilliVolts;
99
100 /// Specifies the request voltage level in mV.
101 NvU32 requestMilliVolts;
102 } NvOdmPmuVddRailCapabilities;
103
104 /// Special level to indicate voltage plane is turned off.
105 #define ODM_VOLTAGE_OFF (0UL)
106
107 /// Special level to enable voltage plane on/off control
108 /// by the external signal (e.g., low power request from SoC).
109 #define ODM_VOLTAGE_ENABLE_EXT_ONOFF (0xFFFFFFFFUL)
110
111 /// Special level to disable voltage plane on/off control
112 /// by the external signal (e.g., low power request from SoC).
113 #define ODM_VOLTAGE_DISABLE_EXT_ONOFF (0xFFFFFFFEUL)
114
115 /**
116 * Gets capabilities for the specified PMU voltage.
117 *
118 * @param vddId The ODM-defined PMU rail ID.
119 * @param pCapabilities A pointer to the targeted
120 * capabilities returned by the ODM.
121 *
122 */
123 void
124 NvOdmPmuGetCapabilities(
125 NvU32 vddId,
126 NvOdmPmuVddRailCapabilities* pCapabilities);
127
128
129 /**
130 * Gets current voltage level for the specified PMU voltage.
131 *
132 * @param hDevice A handle to the PMU.
133 * @param vddId The ODM-defined PMU rail ID.
134 * @param pMilliVolts A pointer to the voltage level returned
135 * by the ODM.
136 *
137 * @return NV_TRUE if successful, or NV_FALSE otherwise.
138 */
139 NvBool
140 NvOdmPmuGetVoltage(
141 NvOdmPmuDeviceHandle hDevice,
142 NvU32 vddId,
143 NvU32* pMilliVolts);
144
145
146 /**
147 * Sets new voltage level for the specified PMU voltage.
148 *
149 * @param hDevice A handle to the PMU.
150 * @param vddId The ODM-defined PMU rail ID.
151 * @param MilliVolts The new voltage level to be set in millivolts (mV).
152 * - Set to ::ODM_VOLTAGE_OFF to turn off the target voltage.
153 * - Set to ::ODM_VOLTAGE_ENABLE_EXT_ONOFF to enable external control of
154 * target voltage.
155 * - Set to ::ODM_VOLTAGE_DISABLE_EXT_ONOFF to disable external control of
156 * target voltage.
157 * @param pSettleMicroSeconds A pointer to the settling time in microseconds (uS ),
158 * which is the time for supply voltage to settle after this function
159 * returns; this may or may not include PMU control interface transaction time,
160 * depending on the ODM implementation. If NULL this parameter is ignored, and the
161 * function must return only after the supply voltage has settled.
162 *
163 * @return NV_TRUE if successful, or NV_FALSE otherwise.
164 */
165 NvBool
166 NvOdmPmuSetVoltage(
167 NvOdmPmuDeviceHandle hDevice,
168 NvU32 vddId,
169 NvU32 MilliVolts,
170 NvU32* pSettleMicroSeconds);
171
172 /**
173 * Gets a handle to the PMU in the system.
174 *
175 * @param hDevice A pointer to the handle of the PMU.
176 *
177 * @return NV_TRUE if successful, or NV_FALSE otherwise.
178 */
179 NvBool
180 NvOdmPmuDeviceOpen( NvOdmPmuDeviceHandle *hDevice );
181
182
183 /**
184 * Releases the PMU handle.
185 *
186 * @param hDevice The PMU handle to be released. If
187 * NULL, this API has no effect.
188 */
189 void NvOdmPmuDeviceClose(NvOdmPmuDeviceHandle hDevice);
190
191
192 /**
193 * Defines AC status.
194 */
195 typedef enum
196 {
197 /// Specifies AC is offline.
198 NvOdmPmuAcLine_Offline,
199
200 /// Specifies AC is online.
201 NvOdmPmuAcLine_Online,
202
203 /// Specifies backup power.
204 NvOdmPmuAcLine_BackupPower,
205
206 NvOdmPmuAcLine_Num,
207 NvOdmPmuAcLine_Force32 = 0x7FFFFFFF
208 }NvOdmPmuAcLineStatus;
209
210 /** @name Battery Status Defines */
211 /*@{*/
212
213 #define NVODM_BATTERY_STATUS_HIGH 0x01
214 #define NVODM_BATTERY_STATUS_LOW 0x02
215 #define NVODM_BATTERY_STATUS_CRITICAL 0x04
216 #define NVODM_BATTERY_STATUS_CHARGING 0x08
217 #define NVODM_BATTERY_STATUS_NO_BATTERY 0x80
218 #define NVODM_BATTERY_STATUS_UNKNOWN 0xFF
219
220 /*@}*/
221 /** @name Battery Data Defines */
222 /*@{*/
223 #define NVODM_BATTERY_DATA_UNKNOWN 0x7FFFFFFF
224
225 /*@}*/
226 /**
227 * Defines battery instances.
228 */
229 typedef enum
230 {
231 /// Specifies main battery.
232 NvOdmPmuBatteryInst_Main,
233
234 /// Specifies backup battery.
235 NvOdmPmuBatteryInst_Backup,
236
237 NvOdmPmuBatteryInst_Num,
238 NvOdmPmuBatteryInst_Force32 = 0x7FFFFFFF
239
240 }NvOdmPmuBatteryInstance;
241
242 /**
243 * Defines battery data.
244 */
245 typedef struct NvOdmPmuBatteryDataRec
246 {
247 /// Specifies battery life percent.
248 NvU32 batteryLifePercent;
249
250 /// Specifies battery life time.
251 NvU32 batteryLifeTime;
252
253 /// Specifies voltage.
254 NvU32 batteryVoltage;
255
256 /// Specifies battery current.
257 NvS32 batteryCurrent;
258
259 /// Specifies battery average current.
260 NvS32 batteryAverageCurrent;
261
262 /// Specifies battery interval.
263 NvU32 batteryAverageInterval;
264
265 /// Specifies the mAH consumed.
266 NvU32 batteryMahConsumed;
267
268 /// Specifies battery temperature.
269 NvU32 batteryTemperature;
270
271 }NvOdmPmuBatteryData;
272
273 /**
274 * Defines battery chemistry.
275 */
276 typedef enum
277 {
278 /// Specifies an alkaline battery.
279 NvOdmPmuBatteryChemistry_Alkaline,
280
281 /// Specifies a nickel-cadmium (NiCd) battery.
282 NvOdmPmuBatteryChemistry_NICD,
283
284 /// Specifies a nickel-metal hydride (NiMH) battery.
285 NvOdmPmuBatteryChemistry_NIMH,
286
287 /// Specifies a lithium-ion (Li-ion) battery.
288 NvOdmPmuBatteryChemistry_LION,
289
290 /// Specifies a lithium-ion polymer (Li-poly) battery.
291 NvOdmPmuBatteryChemistry_LIPOLY,
292
293 /// Specifies a zinc-air battery.
294 NvOdmPmuBatteryChemistry_XINCAIR,
295
296 NvOdmPmuBatteryChemistry_Num,
297 NvOdmPmuBatteryChemistry_Force32 = 0x7FFFFFFF
298 }NvOdmPmuBatteryChemistry;
299
300 /**
301 * Gets the AC line status.
302 *
303 * @param hDevice A handle to the PMU.
304 * @param pStatus A pointer to the AC line
305 * status returned by the ODM.
306 *
307 * @return NV_TRUE if successful, or NV_FALSE otherwise.
308 */
309 NvBool
310 NvOdmPmuGetAcLineStatus(
311 NvOdmPmuDeviceHandle hDevice,
312 NvOdmPmuAcLineStatus *pStatus);
313
314
315 /**
316 * Gets the battery status.
317 *
318 * @param hDevice A handle to the PMU.
319 * @param batteryInst The battery type.
320 * @param pStatus A pointer to the battery
321 * status returned by the ODM.
322 *
323 * @return NV_TRUE if successful, or NV_FALSE otherwise.
324 */
325 NvBool
326 NvOdmPmuGetBatteryStatus(
327 NvOdmPmuDeviceHandle hDevice,
328 NvOdmPmuBatteryInstance batteryInst,
329 NvU8 *pStatus);
330
331 /**
332 * Gets the battery data.
333 *
334 * @param hDevice A handle to the PMU.
335 * @param batteryInst The battery type.
336 * @param pData A pointer to the battery
337 * data returned by the ODM.
338 *
339 * @return NV_TRUE if successful, or NV_FALSE otherwise.
340 */
341 NvBool
342 NvOdmPmuGetBatteryData(
343 NvOdmPmuDeviceHandle hDevice,
344 NvOdmPmuBatteryInstance batteryInst,
345 NvOdmPmuBatteryData *pData);
346
347
348 /**
349 * Gets the battery full life time.
350 *
351 * @param hDevice A handle to the PMU.
352 * @param batteryInst The battery type.
353 * @param pLifeTime A pointer to the battery
354 * full life time returned by the ODM.
355 *
356 */
357 void
358 NvOdmPmuGetBatteryFullLifeTime(
359 NvOdmPmuDeviceHandle hDevice,
360 NvOdmPmuBatteryInstance batteryInst,
361 NvU32 *pLifeTime);
362
363
364 /**
365 * Gets the battery chemistry.
366 *
367 * @param hDevice A handle to the PMU.
368 * @param batteryInst The battery type.
369 * @param pChemistry A pointer to the battery
370 * chemistry returned by the ODM.
371 *
372 */
373 void
374 NvOdmPmuGetBatteryChemistry(
375 NvOdmPmuDeviceHandle hDevice,
376 NvOdmPmuBatteryInstance batteryInst,
377 NvOdmPmuBatteryChemistry *pChemistry);
378
379
380 /**
381 * Defines the charging path.
382 */
383 typedef enum
384 {
385 /// Specifies external wall plug charger.
386 NvOdmPmuChargingPath_MainPlug,
387
388 /// Specifies external USB bus charger.
389 NvOdmPmuChargingPath_UsbBus,
390
391 NvOdmPmuChargingPath_Num,
392 /// Ignore. Forces compilers to make 32-bit enums.
393 NvOdmPmuChargingPath_Force32 = 0x7FFFFFFF
394
395 }NvOdmPmuChargingPath;
396
397 /// Special level to indicate dumb charger current limit.
398 #define NVODM_DUMB_CHARGER_LIMIT (0xFFFFFFFFUL)
399
400 /// Special level to indicate USB Host mode current limit.
401 #define NVODM_USB_HOST_MODE_LIMIT (0x80000000UL)
402
403 /**
404 * Sets the charging current limit.
405 *
406 * @param hDevice A handle to the PMU.
407 * @param chargingPath The charging path.
408 * @param chargingCurrentLimitMa The charging current limit in mA.
409 * @param ChargerType The charger type.
410 * @return NV_TRUE if successful, or NV_FALSE otherwise.
411 */
412 NvBool
413 NvOdmPmuSetChargingCurrent(
414 NvOdmPmuDeviceHandle hDevice,
415 NvOdmPmuChargingPath chargingPath,
416 NvU32 chargingCurrentLimitMa,
417 NvOdmUsbChargerType ChargerType);
418
419
420 /**
421 * Handles the PMU interrupt.
422 *
423 * @param hDevice A handle to the PMU.
424 */
425 void NvOdmPmuInterruptHandler( NvOdmPmuDeviceHandle hDevice);
426
427 /**
428 * Gets the count in seconds of the current external RTC (in PMU).
429 *
430 * @param hDevice A handle to the PMU.
431 * @param Count A pointer to where to return the current counter in sec.
432 * @return NV_TRUE if successful, or NV_FALSE otherwise.
433 */
434 NvBool
435 NvOdmPmuReadRtc(
436 NvOdmPmuDeviceHandle hDevice,
437 NvU32* Count);
438
439 /**
440 * Updates current RTC value.
441 *
442 * @param hDevice A handle to the PMU.
443 * @param Count data with which to update the current counter in sec.
444 * @return NV_TRUE if successful, or NV_FALSE otherwise.
445 */
446 NvBool
447 NvOdmPmuWriteRtc(
448 NvOdmPmuDeviceHandle hDevice,
449 NvU32 Count);
450
451 /**
452 * Returns whether or not the RTC is initialized.
453 *
454 * @param hDevice A handle to the PMU.
455 * @return NV_TRUE if initialized, or NV_FALSE otherwise.
456 */
457 NvBool
458 NvOdmPmuIsRtcInitialized(
459 NvOdmPmuDeviceHandle hDevice);
460
461
462 #if defined(__cplusplus)
463 }
464 #endif
465
466 /** @} */
467
468 #endif // INCLUDED_NVODM_PMU_H
OLDNEW
« no previous file with comments | « arch/arm/mach-tegra/nv/include/nvodm_mouse.h ('k') | arch/arm/mach-tegra/nv/include/nvodm_query.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698