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 #define NV_IDL_IS_DISPATCH |
| 34 |
| 35 #include "nvcommon.h" |
| 36 #include "nvos.h" |
| 37 #include "nvassert.h" |
| 38 #include "nvreftrack.h" |
| 39 #include "nvidlcmd.h" |
| 40 #include "nvrm_pmu.h" |
| 41 |
| 42 #define OFFSET( s, e ) (NvU32)(void *)(&(((s*)0)->e)) |
| 43 |
| 44 |
| 45 typedef struct NvRmPmuIsRtcInitialized_in_t |
| 46 { |
| 47 NvU32 package_; |
| 48 NvU32 function_; |
| 49 NvRmDeviceHandle hRmDevice; |
| 50 } NV_ALIGN(4) NvRmPmuIsRtcInitialized_in; |
| 51 |
| 52 typedef struct NvRmPmuIsRtcInitialized_inout_t |
| 53 { |
| 54 NvU32 dummy_; |
| 55 } NV_ALIGN(4) NvRmPmuIsRtcInitialized_inout; |
| 56 |
| 57 typedef struct NvRmPmuIsRtcInitialized_out_t |
| 58 { |
| 59 NvBool ret_; |
| 60 } NV_ALIGN(4) NvRmPmuIsRtcInitialized_out; |
| 61 |
| 62 typedef struct NvRmPmuIsRtcInitialized_params_t |
| 63 { |
| 64 NvRmPmuIsRtcInitialized_in in; |
| 65 NvRmPmuIsRtcInitialized_inout inout; |
| 66 NvRmPmuIsRtcInitialized_out out; |
| 67 } NvRmPmuIsRtcInitialized_params; |
| 68 |
| 69 typedef struct NvRmPmuWriteRtc_in_t |
| 70 { |
| 71 NvU32 package_; |
| 72 NvU32 function_; |
| 73 NvRmDeviceHandle hRmDevice; |
| 74 NvU32 Count; |
| 75 } NV_ALIGN(4) NvRmPmuWriteRtc_in; |
| 76 |
| 77 typedef struct NvRmPmuWriteRtc_inout_t |
| 78 { |
| 79 NvU32 dummy_; |
| 80 } NV_ALIGN(4) NvRmPmuWriteRtc_inout; |
| 81 |
| 82 typedef struct NvRmPmuWriteRtc_out_t |
| 83 { |
| 84 NvBool ret_; |
| 85 } NV_ALIGN(4) NvRmPmuWriteRtc_out; |
| 86 |
| 87 typedef struct NvRmPmuWriteRtc_params_t |
| 88 { |
| 89 NvRmPmuWriteRtc_in in; |
| 90 NvRmPmuWriteRtc_inout inout; |
| 91 NvRmPmuWriteRtc_out out; |
| 92 } NvRmPmuWriteRtc_params; |
| 93 |
| 94 typedef struct NvRmPmuReadRtc_in_t |
| 95 { |
| 96 NvU32 package_; |
| 97 NvU32 function_; |
| 98 NvRmDeviceHandle hRmDevice; |
| 99 } NV_ALIGN(4) NvRmPmuReadRtc_in; |
| 100 |
| 101 typedef struct NvRmPmuReadRtc_inout_t |
| 102 { |
| 103 NvU32 dummy_; |
| 104 } NV_ALIGN(4) NvRmPmuReadRtc_inout; |
| 105 |
| 106 typedef struct NvRmPmuReadRtc_out_t |
| 107 { |
| 108 NvBool ret_; |
| 109 NvU32 pCount; |
| 110 } NV_ALIGN(4) NvRmPmuReadRtc_out; |
| 111 |
| 112 typedef struct NvRmPmuReadRtc_params_t |
| 113 { |
| 114 NvRmPmuReadRtc_in in; |
| 115 NvRmPmuReadRtc_inout inout; |
| 116 NvRmPmuReadRtc_out out; |
| 117 } NvRmPmuReadRtc_params; |
| 118 |
| 119 typedef struct NvRmPmuGetBatteryChemistry_in_t |
| 120 { |
| 121 NvU32 package_; |
| 122 NvU32 function_; |
| 123 NvRmDeviceHandle hRmDevice; |
| 124 NvRmPmuBatteryInstance batteryInst; |
| 125 } NV_ALIGN(4) NvRmPmuGetBatteryChemistry_in; |
| 126 |
| 127 typedef struct NvRmPmuGetBatteryChemistry_inout_t |
| 128 { |
| 129 NvU32 dummy_; |
| 130 } NV_ALIGN(4) NvRmPmuGetBatteryChemistry_inout; |
| 131 |
| 132 typedef struct NvRmPmuGetBatteryChemistry_out_t |
| 133 { |
| 134 NvRmPmuBatteryChemistry pChemistry; |
| 135 } NV_ALIGN(4) NvRmPmuGetBatteryChemistry_out; |
| 136 |
| 137 typedef struct NvRmPmuGetBatteryChemistry_params_t |
| 138 { |
| 139 NvRmPmuGetBatteryChemistry_in in; |
| 140 NvRmPmuGetBatteryChemistry_inout inout; |
| 141 NvRmPmuGetBatteryChemistry_out out; |
| 142 } NvRmPmuGetBatteryChemistry_params; |
| 143 |
| 144 typedef struct NvRmPmuGetBatteryFullLifeTime_in_t |
| 145 { |
| 146 NvU32 package_; |
| 147 NvU32 function_; |
| 148 NvRmDeviceHandle hRmDevice; |
| 149 NvRmPmuBatteryInstance batteryInst; |
| 150 } NV_ALIGN(4) NvRmPmuGetBatteryFullLifeTime_in; |
| 151 |
| 152 typedef struct NvRmPmuGetBatteryFullLifeTime_inout_t |
| 153 { |
| 154 NvU32 dummy_; |
| 155 } NV_ALIGN(4) NvRmPmuGetBatteryFullLifeTime_inout; |
| 156 |
| 157 typedef struct NvRmPmuGetBatteryFullLifeTime_out_t |
| 158 { |
| 159 NvU32 pLifeTime; |
| 160 } NV_ALIGN(4) NvRmPmuGetBatteryFullLifeTime_out; |
| 161 |
| 162 typedef struct NvRmPmuGetBatteryFullLifeTime_params_t |
| 163 { |
| 164 NvRmPmuGetBatteryFullLifeTime_in in; |
| 165 NvRmPmuGetBatteryFullLifeTime_inout inout; |
| 166 NvRmPmuGetBatteryFullLifeTime_out out; |
| 167 } NvRmPmuGetBatteryFullLifeTime_params; |
| 168 |
| 169 typedef struct NvRmPmuGetBatteryData_in_t |
| 170 { |
| 171 NvU32 package_; |
| 172 NvU32 function_; |
| 173 NvRmDeviceHandle hRmDevice; |
| 174 NvRmPmuBatteryInstance batteryInst; |
| 175 } NV_ALIGN(4) NvRmPmuGetBatteryData_in; |
| 176 |
| 177 typedef struct NvRmPmuGetBatteryData_inout_t |
| 178 { |
| 179 NvU32 dummy_; |
| 180 } NV_ALIGN(4) NvRmPmuGetBatteryData_inout; |
| 181 |
| 182 typedef struct NvRmPmuGetBatteryData_out_t |
| 183 { |
| 184 NvBool ret_; |
| 185 NvRmPmuBatteryData pData; |
| 186 } NV_ALIGN(4) NvRmPmuGetBatteryData_out; |
| 187 |
| 188 typedef struct NvRmPmuGetBatteryData_params_t |
| 189 { |
| 190 NvRmPmuGetBatteryData_in in; |
| 191 NvRmPmuGetBatteryData_inout inout; |
| 192 NvRmPmuGetBatteryData_out out; |
| 193 } NvRmPmuGetBatteryData_params; |
| 194 |
| 195 typedef struct NvRmPmuGetBatteryStatus_in_t |
| 196 { |
| 197 NvU32 package_; |
| 198 NvU32 function_; |
| 199 NvRmDeviceHandle hRmDevice; |
| 200 NvRmPmuBatteryInstance batteryInst; |
| 201 } NV_ALIGN(4) NvRmPmuGetBatteryStatus_in; |
| 202 |
| 203 typedef struct NvRmPmuGetBatteryStatus_inout_t |
| 204 { |
| 205 NvU32 dummy_; |
| 206 } NV_ALIGN(4) NvRmPmuGetBatteryStatus_inout; |
| 207 |
| 208 typedef struct NvRmPmuGetBatteryStatus_out_t |
| 209 { |
| 210 NvBool ret_; |
| 211 NvU8 pStatus; |
| 212 } NV_ALIGN(4) NvRmPmuGetBatteryStatus_out; |
| 213 |
| 214 typedef struct NvRmPmuGetBatteryStatus_params_t |
| 215 { |
| 216 NvRmPmuGetBatteryStatus_in in; |
| 217 NvRmPmuGetBatteryStatus_inout inout; |
| 218 NvRmPmuGetBatteryStatus_out out; |
| 219 } NvRmPmuGetBatteryStatus_params; |
| 220 |
| 221 typedef struct NvRmPmuGetAcLineStatus_in_t |
| 222 { |
| 223 NvU32 package_; |
| 224 NvU32 function_; |
| 225 NvRmDeviceHandle hRmDevice; |
| 226 } NV_ALIGN(4) NvRmPmuGetAcLineStatus_in; |
| 227 |
| 228 typedef struct NvRmPmuGetAcLineStatus_inout_t |
| 229 { |
| 230 NvU32 dummy_; |
| 231 } NV_ALIGN(4) NvRmPmuGetAcLineStatus_inout; |
| 232 |
| 233 typedef struct NvRmPmuGetAcLineStatus_out_t |
| 234 { |
| 235 NvBool ret_; |
| 236 NvRmPmuAcLineStatus pStatus; |
| 237 } NV_ALIGN(4) NvRmPmuGetAcLineStatus_out; |
| 238 |
| 239 typedef struct NvRmPmuGetAcLineStatus_params_t |
| 240 { |
| 241 NvRmPmuGetAcLineStatus_in in; |
| 242 NvRmPmuGetAcLineStatus_inout inout; |
| 243 NvRmPmuGetAcLineStatus_out out; |
| 244 } NvRmPmuGetAcLineStatus_params; |
| 245 |
| 246 typedef struct NvRmPmuSetChargingCurrentLimit_in_t |
| 247 { |
| 248 NvU32 package_; |
| 249 NvU32 function_; |
| 250 NvRmDeviceHandle hRmDevice; |
| 251 NvRmPmuChargingPath ChargingPath; |
| 252 NvU32 ChargingCurrentLimitMa; |
| 253 NvU32 ChargerType; |
| 254 } NV_ALIGN(4) NvRmPmuSetChargingCurrentLimit_in; |
| 255 |
| 256 typedef struct NvRmPmuSetChargingCurrentLimit_inout_t |
| 257 { |
| 258 NvU32 dummy_; |
| 259 } NV_ALIGN(4) NvRmPmuSetChargingCurrentLimit_inout; |
| 260 |
| 261 typedef struct NvRmPmuSetChargingCurrentLimit_out_t |
| 262 { |
| 263 NvU32 dummy_; |
| 264 } NV_ALIGN(4) NvRmPmuSetChargingCurrentLimit_out; |
| 265 |
| 266 typedef struct NvRmPmuSetChargingCurrentLimit_params_t |
| 267 { |
| 268 NvRmPmuSetChargingCurrentLimit_in in; |
| 269 NvRmPmuSetChargingCurrentLimit_inout inout; |
| 270 NvRmPmuSetChargingCurrentLimit_out out; |
| 271 } NvRmPmuSetChargingCurrentLimit_params; |
| 272 |
| 273 typedef struct NvRmPmuSetSocRailPowerState_in_t |
| 274 { |
| 275 NvU32 package_; |
| 276 NvU32 function_; |
| 277 NvRmDeviceHandle hDevice; |
| 278 NvU32 vddId; |
| 279 NvBool Enable; |
| 280 } NV_ALIGN(4) NvRmPmuSetSocRailPowerState_in; |
| 281 |
| 282 typedef struct NvRmPmuSetSocRailPowerState_inout_t |
| 283 { |
| 284 NvU32 dummy_; |
| 285 } NV_ALIGN(4) NvRmPmuSetSocRailPowerState_inout; |
| 286 |
| 287 typedef struct NvRmPmuSetSocRailPowerState_out_t |
| 288 { |
| 289 NvU32 dummy_; |
| 290 } NV_ALIGN(4) NvRmPmuSetSocRailPowerState_out; |
| 291 |
| 292 typedef struct NvRmPmuSetSocRailPowerState_params_t |
| 293 { |
| 294 NvRmPmuSetSocRailPowerState_in in; |
| 295 NvRmPmuSetSocRailPowerState_inout inout; |
| 296 NvRmPmuSetSocRailPowerState_out out; |
| 297 } NvRmPmuSetSocRailPowerState_params; |
| 298 |
| 299 typedef struct NvRmPmuSetVoltage_in_t |
| 300 { |
| 301 NvU32 package_; |
| 302 NvU32 function_; |
| 303 NvRmDeviceHandle hDevice; |
| 304 NvU32 vddId; |
| 305 NvU32 MilliVolts; |
| 306 } NV_ALIGN(4) NvRmPmuSetVoltage_in; |
| 307 |
| 308 typedef struct NvRmPmuSetVoltage_inout_t |
| 309 { |
| 310 NvU32 dummy_; |
| 311 } NV_ALIGN(4) NvRmPmuSetVoltage_inout; |
| 312 |
| 313 typedef struct NvRmPmuSetVoltage_out_t |
| 314 { |
| 315 NvU32 pSettleMicroSeconds; |
| 316 } NV_ALIGN(4) NvRmPmuSetVoltage_out; |
| 317 |
| 318 typedef struct NvRmPmuSetVoltage_params_t |
| 319 { |
| 320 NvRmPmuSetVoltage_in in; |
| 321 NvRmPmuSetVoltage_inout inout; |
| 322 NvRmPmuSetVoltage_out out; |
| 323 } NvRmPmuSetVoltage_params; |
| 324 |
| 325 typedef struct NvRmPmuGetVoltage_in_t |
| 326 { |
| 327 NvU32 package_; |
| 328 NvU32 function_; |
| 329 NvRmDeviceHandle hDevice; |
| 330 NvU32 vddId; |
| 331 } NV_ALIGN(4) NvRmPmuGetVoltage_in; |
| 332 |
| 333 typedef struct NvRmPmuGetVoltage_inout_t |
| 334 { |
| 335 NvU32 dummy_; |
| 336 } NV_ALIGN(4) NvRmPmuGetVoltage_inout; |
| 337 |
| 338 typedef struct NvRmPmuGetVoltage_out_t |
| 339 { |
| 340 NvU32 pMilliVolts; |
| 341 } NV_ALIGN(4) NvRmPmuGetVoltage_out; |
| 342 |
| 343 typedef struct NvRmPmuGetVoltage_params_t |
| 344 { |
| 345 NvRmPmuGetVoltage_in in; |
| 346 NvRmPmuGetVoltage_inout inout; |
| 347 NvRmPmuGetVoltage_out out; |
| 348 } NvRmPmuGetVoltage_params; |
| 349 |
| 350 typedef struct NvRmPmuGetCapabilities_in_t |
| 351 { |
| 352 NvU32 package_; |
| 353 NvU32 function_; |
| 354 NvRmDeviceHandle hDevice; |
| 355 NvU32 vddId; |
| 356 } NV_ALIGN(4) NvRmPmuGetCapabilities_in; |
| 357 |
| 358 typedef struct NvRmPmuGetCapabilities_inout_t |
| 359 { |
| 360 NvU32 dummy_; |
| 361 } NV_ALIGN(4) NvRmPmuGetCapabilities_inout; |
| 362 |
| 363 typedef struct NvRmPmuGetCapabilities_out_t |
| 364 { |
| 365 NvRmPmuVddRailCapabilities pCapabilities; |
| 366 } NV_ALIGN(4) NvRmPmuGetCapabilities_out; |
| 367 |
| 368 typedef struct NvRmPmuGetCapabilities_params_t |
| 369 { |
| 370 NvRmPmuGetCapabilities_in in; |
| 371 NvRmPmuGetCapabilities_inout inout; |
| 372 NvRmPmuGetCapabilities_out out; |
| 373 } NvRmPmuGetCapabilities_params; |
| 374 |
| 375 static NvError NvRmPmuIsRtcInitialized_dispatch_( void *InBuffer, NvU32 InSize,
void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 376 { |
| 377 NvError err_ = NvSuccess; |
| 378 NvRmPmuIsRtcInitialized_in *p_in; |
| 379 NvRmPmuIsRtcInitialized_out *p_out; |
| 380 |
| 381 p_in = (NvRmPmuIsRtcInitialized_in *)InBuffer; |
| 382 p_out = (NvRmPmuIsRtcInitialized_out *)((NvU8 *)OutBuffer + OFFSET(NvRmPmuIs
RtcInitialized_params, out) - OFFSET(NvRmPmuIsRtcInitialized_params, inout)); |
| 383 |
| 384 |
| 385 p_out->ret_ = NvRmPmuIsRtcInitialized( p_in->hRmDevice ); |
| 386 |
| 387 return err_; |
| 388 } |
| 389 |
| 390 static NvError NvRmPmuWriteRtc_dispatch_( void *InBuffer, NvU32 InSize, void *Ou
tBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 391 { |
| 392 NvError err_ = NvSuccess; |
| 393 NvRmPmuWriteRtc_in *p_in; |
| 394 NvRmPmuWriteRtc_out *p_out; |
| 395 |
| 396 p_in = (NvRmPmuWriteRtc_in *)InBuffer; |
| 397 p_out = (NvRmPmuWriteRtc_out *)((NvU8 *)OutBuffer + OFFSET(NvRmPmuWriteRtc_p
arams, out) - OFFSET(NvRmPmuWriteRtc_params, inout)); |
| 398 |
| 399 |
| 400 p_out->ret_ = NvRmPmuWriteRtc( p_in->hRmDevice, p_in->Count ); |
| 401 |
| 402 return err_; |
| 403 } |
| 404 |
| 405 static NvError NvRmPmuReadRtc_dispatch_( void *InBuffer, NvU32 InSize, void *Out
Buffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 406 { |
| 407 NvError err_ = NvSuccess; |
| 408 NvRmPmuReadRtc_in *p_in; |
| 409 NvRmPmuReadRtc_out *p_out; |
| 410 |
| 411 p_in = (NvRmPmuReadRtc_in *)InBuffer; |
| 412 p_out = (NvRmPmuReadRtc_out *)((NvU8 *)OutBuffer + OFFSET(NvRmPmuReadRtc_par
ams, out) - OFFSET(NvRmPmuReadRtc_params, inout)); |
| 413 |
| 414 |
| 415 p_out->ret_ = NvRmPmuReadRtc( p_in->hRmDevice, &p_out->pCount ); |
| 416 |
| 417 return err_; |
| 418 } |
| 419 |
| 420 static NvError NvRmPmuGetBatteryChemistry_dispatch_( void *InBuffer, NvU32 InSiz
e, void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 421 { |
| 422 NvError err_ = NvSuccess; |
| 423 NvRmPmuGetBatteryChemistry_in *p_in; |
| 424 NvRmPmuGetBatteryChemistry_out *p_out; |
| 425 |
| 426 p_in = (NvRmPmuGetBatteryChemistry_in *)InBuffer; |
| 427 p_out = (NvRmPmuGetBatteryChemistry_out *)((NvU8 *)OutBuffer + OFFSET(NvRmPm
uGetBatteryChemistry_params, out) - OFFSET(NvRmPmuGetBatteryChemistry_params, in
out)); |
| 428 |
| 429 |
| 430 NvRmPmuGetBatteryChemistry( p_in->hRmDevice, p_in->batteryInst, &p_out->pChe
mistry ); |
| 431 |
| 432 return err_; |
| 433 } |
| 434 |
| 435 static NvError NvRmPmuGetBatteryFullLifeTime_dispatch_( void *InBuffer, NvU32 In
Size, void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 436 { |
| 437 NvError err_ = NvSuccess; |
| 438 NvRmPmuGetBatteryFullLifeTime_in *p_in; |
| 439 NvRmPmuGetBatteryFullLifeTime_out *p_out; |
| 440 |
| 441 p_in = (NvRmPmuGetBatteryFullLifeTime_in *)InBuffer; |
| 442 p_out = (NvRmPmuGetBatteryFullLifeTime_out *)((NvU8 *)OutBuffer + OFFSET(NvR
mPmuGetBatteryFullLifeTime_params, out) - OFFSET(NvRmPmuGetBatteryFullLifeTime_p
arams, inout)); |
| 443 |
| 444 |
| 445 NvRmPmuGetBatteryFullLifeTime( p_in->hRmDevice, p_in->batteryInst, &p_out->p
LifeTime ); |
| 446 |
| 447 return err_; |
| 448 } |
| 449 |
| 450 static NvError NvRmPmuGetBatteryData_dispatch_( void *InBuffer, NvU32 InSize, vo
id *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 451 { |
| 452 NvError err_ = NvSuccess; |
| 453 NvRmPmuGetBatteryData_in *p_in; |
| 454 NvRmPmuGetBatteryData_out *p_out; |
| 455 |
| 456 p_in = (NvRmPmuGetBatteryData_in *)InBuffer; |
| 457 p_out = (NvRmPmuGetBatteryData_out *)((NvU8 *)OutBuffer + OFFSET(NvRmPmuGetB
atteryData_params, out) - OFFSET(NvRmPmuGetBatteryData_params, inout)); |
| 458 |
| 459 |
| 460 p_out->ret_ = NvRmPmuGetBatteryData( p_in->hRmDevice, p_in->batteryInst, &p_
out->pData ); |
| 461 |
| 462 return err_; |
| 463 } |
| 464 |
| 465 static NvError NvRmPmuGetBatteryStatus_dispatch_( void *InBuffer, NvU32 InSize,
void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 466 { |
| 467 NvError err_ = NvSuccess; |
| 468 NvRmPmuGetBatteryStatus_in *p_in; |
| 469 NvRmPmuGetBatteryStatus_out *p_out; |
| 470 |
| 471 p_in = (NvRmPmuGetBatteryStatus_in *)InBuffer; |
| 472 p_out = (NvRmPmuGetBatteryStatus_out *)((NvU8 *)OutBuffer + OFFSET(NvRmPmuGe
tBatteryStatus_params, out) - OFFSET(NvRmPmuGetBatteryStatus_params, inout)); |
| 473 |
| 474 |
| 475 p_out->ret_ = NvRmPmuGetBatteryStatus( p_in->hRmDevice, p_in->batteryInst, &
p_out->pStatus ); |
| 476 |
| 477 return err_; |
| 478 } |
| 479 |
| 480 static NvError NvRmPmuGetAcLineStatus_dispatch_( void *InBuffer, NvU32 InSize, v
oid *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 481 { |
| 482 NvError err_ = NvSuccess; |
| 483 NvRmPmuGetAcLineStatus_in *p_in; |
| 484 NvRmPmuGetAcLineStatus_out *p_out; |
| 485 |
| 486 p_in = (NvRmPmuGetAcLineStatus_in *)InBuffer; |
| 487 p_out = (NvRmPmuGetAcLineStatus_out *)((NvU8 *)OutBuffer + OFFSET(NvRmPmuGet
AcLineStatus_params, out) - OFFSET(NvRmPmuGetAcLineStatus_params, inout)); |
| 488 |
| 489 |
| 490 p_out->ret_ = NvRmPmuGetAcLineStatus( p_in->hRmDevice, &p_out->pStatus ); |
| 491 |
| 492 return err_; |
| 493 } |
| 494 |
| 495 static NvError NvRmPmuSetChargingCurrentLimit_dispatch_( void *InBuffer, NvU32 I
nSize, void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 496 { |
| 497 NvError err_ = NvSuccess; |
| 498 NvRmPmuSetChargingCurrentLimit_in *p_in; |
| 499 |
| 500 p_in = (NvRmPmuSetChargingCurrentLimit_in *)InBuffer; |
| 501 |
| 502 |
| 503 NvRmPmuSetChargingCurrentLimit( p_in->hRmDevice, p_in->ChargingPath, p_in->C
hargingCurrentLimitMa, p_in->ChargerType ); |
| 504 |
| 505 return err_; |
| 506 } |
| 507 |
| 508 static NvError NvRmPmuSetSocRailPowerState_dispatch_( void *InBuffer, NvU32 InSi
ze, void *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 509 { |
| 510 NvError err_ = NvSuccess; |
| 511 NvRmPmuSetSocRailPowerState_in *p_in; |
| 512 |
| 513 p_in = (NvRmPmuSetSocRailPowerState_in *)InBuffer; |
| 514 |
| 515 |
| 516 NvRmPmuSetSocRailPowerState( p_in->hDevice, p_in->vddId, p_in->Enable ); |
| 517 |
| 518 return err_; |
| 519 } |
| 520 |
| 521 static NvError NvRmPmuSetVoltage_dispatch_( void *InBuffer, NvU32 InSize, void *
OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 522 { |
| 523 NvError err_ = NvSuccess; |
| 524 NvRmPmuSetVoltage_in *p_in; |
| 525 NvRmPmuSetVoltage_out *p_out; |
| 526 |
| 527 p_in = (NvRmPmuSetVoltage_in *)InBuffer; |
| 528 p_out = (NvRmPmuSetVoltage_out *)((NvU8 *)OutBuffer + OFFSET(NvRmPmuSetVolta
ge_params, out) - OFFSET(NvRmPmuSetVoltage_params, inout)); |
| 529 |
| 530 |
| 531 NvRmPmuSetVoltage( p_in->hDevice, p_in->vddId, p_in->MilliVolts, &p_out->pSe
ttleMicroSeconds ); |
| 532 |
| 533 return err_; |
| 534 } |
| 535 |
| 536 static NvError NvRmPmuGetVoltage_dispatch_( void *InBuffer, NvU32 InSize, void *
OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 537 { |
| 538 NvError err_ = NvSuccess; |
| 539 NvRmPmuGetVoltage_in *p_in; |
| 540 NvRmPmuGetVoltage_out *p_out; |
| 541 |
| 542 p_in = (NvRmPmuGetVoltage_in *)InBuffer; |
| 543 p_out = (NvRmPmuGetVoltage_out *)((NvU8 *)OutBuffer + OFFSET(NvRmPmuGetVolta
ge_params, out) - OFFSET(NvRmPmuGetVoltage_params, inout)); |
| 544 |
| 545 |
| 546 NvRmPmuGetVoltage( p_in->hDevice, p_in->vddId, &p_out->pMilliVolts ); |
| 547 |
| 548 return err_; |
| 549 } |
| 550 |
| 551 static NvError NvRmPmuGetCapabilities_dispatch_( void *InBuffer, NvU32 InSize, v
oid *OutBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 552 { |
| 553 NvError err_ = NvSuccess; |
| 554 NvRmPmuGetCapabilities_in *p_in; |
| 555 NvRmPmuGetCapabilities_out *p_out; |
| 556 |
| 557 p_in = (NvRmPmuGetCapabilities_in *)InBuffer; |
| 558 p_out = (NvRmPmuGetCapabilities_out *)((NvU8 *)OutBuffer + OFFSET(NvRmPmuGet
Capabilities_params, out) - OFFSET(NvRmPmuGetCapabilities_params, inout)); |
| 559 |
| 560 |
| 561 NvRmPmuGetCapabilities( p_in->hDevice, p_in->vddId, &p_out->pCapabilities ); |
| 562 |
| 563 return err_; |
| 564 } |
| 565 |
| 566 NvError nvrm_pmu_Dispatch( NvU32 function, void *InBuffer, NvU32 InSize, void *O
utBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ); |
| 567 NvError nvrm_pmu_Dispatch( NvU32 function, void *InBuffer, NvU32 InSize, void *O
utBuffer, NvU32 OutSize, NvDispatchCtx* Ctx ) |
| 568 { |
| 569 NvError err_ = NvSuccess; |
| 570 |
| 571 switch( function ) { |
| 572 case 12: |
| 573 err_ = NvRmPmuIsRtcInitialized_dispatch_( InBuffer, InSize, OutBuffer, O
utSize, Ctx ); |
| 574 break; |
| 575 case 11: |
| 576 err_ = NvRmPmuWriteRtc_dispatch_( InBuffer, InSize, OutBuffer, OutSize,
Ctx ); |
| 577 break; |
| 578 case 10: |
| 579 err_ = NvRmPmuReadRtc_dispatch_( InBuffer, InSize, OutBuffer, OutSize, C
tx ); |
| 580 break; |
| 581 case 9: |
| 582 err_ = NvRmPmuGetBatteryChemistry_dispatch_( InBuffer, InSize, OutBuffer
, OutSize, Ctx ); |
| 583 break; |
| 584 case 8: |
| 585 err_ = NvRmPmuGetBatteryFullLifeTime_dispatch_( InBuffer, InSize, OutBuf
fer, OutSize, Ctx ); |
| 586 break; |
| 587 case 7: |
| 588 err_ = NvRmPmuGetBatteryData_dispatch_( InBuffer, InSize, OutBuffer, Out
Size, Ctx ); |
| 589 break; |
| 590 case 6: |
| 591 err_ = NvRmPmuGetBatteryStatus_dispatch_( InBuffer, InSize, OutBuffer, O
utSize, Ctx ); |
| 592 break; |
| 593 case 5: |
| 594 err_ = NvRmPmuGetAcLineStatus_dispatch_( InBuffer, InSize, OutBuffer, Ou
tSize, Ctx ); |
| 595 break; |
| 596 case 4: |
| 597 err_ = NvRmPmuSetChargingCurrentLimit_dispatch_( InBuffer, InSize, OutBu
ffer, OutSize, Ctx ); |
| 598 break; |
| 599 case 3: |
| 600 err_ = NvRmPmuSetSocRailPowerState_dispatch_( InBuffer, InSize, OutBuffe
r, OutSize, Ctx ); |
| 601 break; |
| 602 case 2: |
| 603 err_ = NvRmPmuSetVoltage_dispatch_( InBuffer, InSize, OutBuffer, OutSize
, Ctx ); |
| 604 break; |
| 605 case 1: |
| 606 err_ = NvRmPmuGetVoltage_dispatch_( InBuffer, InSize, OutBuffer, OutSize
, Ctx ); |
| 607 break; |
| 608 case 0: |
| 609 err_ = NvRmPmuGetCapabilities_dispatch_( InBuffer, InSize, OutBuffer, Ou
tSize, Ctx ); |
| 610 break; |
| 611 default: |
| 612 err_ = NvError_BadParameter; |
| 613 break; |
| 614 } |
| 615 |
| 616 return err_; |
| 617 } |
OLD | NEW |