OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 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 * Temperature Monitor Interface</b> |
| 37 * |
| 38 * @b Description: Defines the ODM interface for Temperature Monitor (TMON). |
| 39 * |
| 40 */ |
| 41 |
| 42 #ifndef INCLUDED_NVODM_TMON_H |
| 43 #define INCLUDED_NVODM_TMON_H |
| 44 |
| 45 #include "nvcommon.h" |
| 46 #include "nvodm_services.h" |
| 47 |
| 48 #if defined(__cplusplus) |
| 49 extern "C" |
| 50 { |
| 51 #endif |
| 52 |
| 53 /** |
| 54 * @defgroup nvodm_tmon Temperature Monitor Adaptation Interface |
| 55 * |
| 56 * This is the temperature monitor (TMON) ODM adaptation interface, which |
| 57 * handles the abstraction of external devices monitoring temperature zones |
| 58 * on NVIDIA SoC based platforms. For the clients of this API, each zone has |
| 59 * its own monitoring device. Dependencies introduced by multi-channel devices |
| 60 * capable of monitoring several zones are resolved inside the implementation |
| 61 * layer. |
| 62 * |
| 63 * @ingroup nvodm_adaptation |
| 64 * @{ |
| 65 */ |
| 66 |
| 67 /** |
| 68 * Defines an opaque handle for TMON device. |
| 69 */ |
| 70 typedef struct NvOdmTmonDeviceRec *NvOdmTmonDeviceHandle; |
| 71 |
| 72 /** |
| 73 * Defines an opaque handle to the TMON interrupt interface. |
| 74 */ |
| 75 typedef struct NvOdmTmonIntrRec *NvOdmTmonIntrHandle; |
| 76 |
| 77 /** |
| 78 * Defines temperature zones. |
| 79 */ |
| 80 typedef enum |
| 81 { |
| 82 /// Specifies ambient temperature zone. |
| 83 NvOdmTmonZoneID_Ambient = 1, |
| 84 |
| 85 /// Specifies SoC core temperature zone. |
| 86 NvOdmTmonZoneID_Core, |
| 87 |
| 88 NvOdmTmonZoneID_Num, |
| 89 /// Ignore -- Forces compilers to make 32-bit enums. |
| 90 NvOdmTmonZoneID_Force32 = 0x7FFFFFFFUL |
| 91 } NvOdmTmonZoneID; |
| 92 |
| 93 /** |
| 94 * Defines temperature monitoring configuration parameters. |
| 95 */ |
| 96 typedef enum |
| 97 { |
| 98 /// Identifies temperature sampling interval in ms. |
| 99 NvOdmTmonConfigParam_SampleMs = 1, |
| 100 |
| 101 /// Identifies High temperature boundary for TMON out of limit |
| 102 /// interrupt (in degrees C). |
| 103 NvOdmTmonConfigParam_IntrLimitHigh, |
| 104 |
| 105 /// Identifies Low temperature boundary for TMON out of limit |
| 106 /// interrupt (in degrees C). |
| 107 NvOdmTmonConfigParam_IntrLimitLow, |
| 108 |
| 109 /// Identifies temperature threshold for TMON comparator that |
| 110 /// controls h/w critical shutdown mechanism (in degrees C). |
| 111 NvOdmTmonConfigParam_HwLimitCrit, |
| 112 |
| 113 NvOdmTmonConfigParam_Num, |
| 114 /// Ignore -- Forces compilers to make 32-bit enums. |
| 115 NvOdmTmonConfigParam_Force32 = 0x7FFFFFFFUL |
| 116 } NvOdmTmonConfigParam; |
| 117 |
| 118 /// Special value for configuration parameters. |
| 119 #define ODM_TMON_PARAMETER_UNSPECIFIED (0x7FFFFFFF) |
| 120 |
| 121 /** |
| 122 * Holds configuration parameter capabilities. |
| 123 */ |
| 124 typedef struct NvOdmTmonParameterCapsRec |
| 125 { |
| 126 /// Specifies maximum parameter value (units depend on the parameter). |
| 127 NvS32 MaxValue; |
| 128 |
| 129 /// Specifies minimum parameter value (units depend on the parameter). |
| 130 NvS32 MinValue; |
| 131 |
| 132 /// Specifies ODM protection attribute; if \c NV_TRUE TMON ODM Kit would |
| 133 /// not allow to change the parameter. |
| 134 NvBool OdmProtected; |
| 135 } NvOdmTmonParameterCaps; |
| 136 |
| 137 /** |
| 138 * Holds temperature monitoring device capabilities. |
| 139 */ |
| 140 typedef struct NvOdmTmonCapabilitiesRec |
| 141 { |
| 142 /// Specifies maximum temperature limit for TMON operations (in degrees C). |
| 143 NvS32 Tmax; |
| 144 |
| 145 /// Specifies minimum temperature limit for TMON operations (in degrees C). |
| 146 NvS32 Tmin; |
| 147 |
| 148 /// Specifies support for TMON out of limit interrupt. |
| 149 NvBool IntrSupported; |
| 150 |
| 151 /// Specifies support for TMON hardware critical shutdown mechanism. |
| 152 NvBool HwCriticalSupported; |
| 153 |
| 154 /// Specifies support for TMON hardware auto-cooling mechanism (e.g., fan). |
| 155 NvBool HwCoolingSupported; |
| 156 } NvOdmTmonCapabilities; |
| 157 |
| 158 |
| 159 /** |
| 160 * Gets a handle to the TMON in the specified zone. |
| 161 * |
| 162 * @param ZoneId The targeted temperature zone. |
| 163 * |
| 164 * @return TMON handle, NULL if zone is not monitored. |
| 165 */ |
| 166 NvOdmTmonDeviceHandle |
| 167 NvOdmTmonDeviceOpen(NvOdmTmonZoneID ZoneId); |
| 168 |
| 169 /** |
| 170 * Closes the TMON handle. |
| 171 * |
| 172 * @param hTmon The TMON handle to be closed. |
| 173 * If NULL, this API has no effect. |
| 174 */ |
| 175 void NvOdmTmonDeviceClose(NvOdmTmonDeviceHandle hTmon); |
| 176 |
| 177 /** |
| 178 * Gets TMON device capabilities. |
| 179 * |
| 180 * @param hTmon A handle to the TMON device. |
| 181 * @param pCaps A pointer to the TMON device capabilities returned by the ODM. |
| 182 */ |
| 183 void |
| 184 NvOdmTmonCapabilitiesGet( |
| 185 NvOdmTmonDeviceHandle hTmon, |
| 186 NvOdmTmonCapabilities* pCaps); |
| 187 |
| 188 /** |
| 189 * Gets TMON configuration parameter capabilities. |
| 190 * |
| 191 * @param hTmon A handle to the TMON device. |
| 192 * @param ParamId The targeted parameter. |
| 193 * @param pCaps A pointer to the targeted parameter capabilities |
| 194 * returned by the ODM. |
| 195 * |
| 196 * Special value ::ODM_TMON_PARAMETER_UNSPECIFIED is returned as maximum and |
| 197 * minimum value in capabilities structure if the targeted parameter is not |
| 198 * supported. |
| 199 */ |
| 200 void |
| 201 NvOdmTmonParameterCapsGet( |
| 202 NvOdmTmonDeviceHandle hTmon, |
| 203 NvOdmTmonConfigParam ParamId, |
| 204 NvOdmTmonParameterCaps* pCaps); |
| 205 |
| 206 /** |
| 207 * Gets current zone temperature. |
| 208 * |
| 209 * @param hTmon A handle to the TMON device. |
| 210 * @param pDegreesC A pointer to the zone temperature (in degrees C) |
| 211 * returned by the ODM. |
| 212 * |
| 213 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 214 */ |
| 215 NvBool |
| 216 NvOdmTmonTemperatureGet( |
| 217 NvOdmTmonDeviceHandle hTmon, |
| 218 NvS32* pDegreesC); |
| 219 |
| 220 /** |
| 221 * Configures specified TMON parameter for the temperature zone. |
| 222 * |
| 223 * @param hTmon A handle to the TMON device. |
| 224 * @param ParamId The targeted parameter to be updated. |
| 225 * @param pSetting A pointer to a variable with parameter settings. |
| 226 * On entry, specifies new requested settings, on exit, actually configured |
| 227 * settings as the best approximation of the request. |
| 228 * |
| 229 * The requested setting is clipped to the maximum/minimum values for the |
| 230 * respective parameter. If special value ::ODM_TMON_PARAMETER_UNSPECIFIED is |
| 231 * specified on entry, current parameter value is preserved and retrieved on |
| 232 * exit. If special value \c ODM_TMON_PARAMETER_UNSPECIFIED is returned on exit
, |
| 233 * the targeted parameter is not supported for the given zone. |
| 234 * |
| 235 * @return NV_TRUE if successful, or NV_FALSE otherwise |
| 236 */ |
| 237 NvBool |
| 238 NvOdmTmonParameterConfig( |
| 239 NvOdmTmonDeviceHandle hTmon, |
| 240 NvOdmTmonConfigParam ParamId, |
| 241 NvS32* pSetting); |
| 242 |
| 243 /** |
| 244 * Suspends temperature zone monitoring. |
| 245 * |
| 246 * @param hTmon A handle to the TMON device. |
| 247 * |
| 248 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 249 */ |
| 250 NvBool NvOdmTmonSuspend(NvOdmTmonDeviceHandle hTmon); |
| 251 |
| 252 /** |
| 253 * Resumes temperature zone monitoring. |
| 254 * |
| 255 * @param hTmon A handle to the TMON device. |
| 256 * |
| 257 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 258 */ |
| 259 NvBool NvOdmTmonResume(NvOdmTmonDeviceHandle hTmon); |
| 260 |
| 261 /** |
| 262 * Registers for TMON out of limit interrupt. |
| 263 * |
| 264 * @param hTmon A handle to the TMON device. |
| 265 * @param Callback The callback function that is called when TMON |
| 266 * interrupt triggers. |
| 267 * @param arg The argument passed to the callback when it is |
| 268 * invoked by TMON IST. |
| 269 * |
| 270 * @return TMON interrupt handle, NULL if failed to register. |
| 271 */ |
| 272 NvOdmTmonIntrHandle |
| 273 NvOdmTmonIntrRegister( |
| 274 NvOdmTmonDeviceHandle hTmon, |
| 275 NvOdmInterruptHandler Callback, |
| 276 void* arg); |
| 277 |
| 278 /** |
| 279 * Unregisters TMON interrupt. |
| 280 * |
| 281 * @param hTmon A handle to the TMON device. |
| 282 * @param hIntr A TMON interrupt handle. |
| 283 * If NULL, this API has no effect. |
| 284 */ |
| 285 void |
| 286 NvOdmTmonIntrUnregister( |
| 287 NvOdmTmonDeviceHandle hTmon, |
| 288 NvOdmTmonIntrHandle hIntr); |
| 289 |
| 290 #if defined(__cplusplus) |
| 291 } |
| 292 #endif |
| 293 |
| 294 /** @} */ |
| 295 |
| 296 #endif // INCLUDED_NVODM_TMON_H |
OLD | NEW |