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 #ifndef INCLUDED_nvrm_analog_H |
| 34 #define INCLUDED_nvrm_analog_H |
| 35 |
| 36 |
| 37 #if defined(__cplusplus) |
| 38 extern "C" |
| 39 { |
| 40 #endif |
| 41 |
| 42 #include "nvrm_module.h" |
| 43 #include "nvrm_init.h" |
| 44 |
| 45 #include "nvodm_query.h" |
| 46 |
| 47 /** |
| 48 * List of controllable analog interfaces. Multiple instances of any |
| 49 * particlar interface will be handled by the NVRM_ANALOG_INTERFACE macro |
| 50 * below. |
| 51 */ |
| 52 |
| 53 typedef enum |
| 54 { |
| 55 NvRmAnalogInterface_Dsi, |
| 56 NvRmAnalogInterface_ExternalMemory, |
| 57 NvRmAnalogInterface_Hdmi, |
| 58 NvRmAnalogInterface_Lcd, |
| 59 NvRmAnalogInterface_Uart, |
| 60 NvRmAnalogInterface_Usb, |
| 61 NvRmAnalogInterface_Sdio, |
| 62 NvRmAnalogInterface_Tv, |
| 63 NvRmAnalogInterface_VideoInput, |
| 64 NvRmAnalogInterface_Num, |
| 65 NvRmAnalogInterface_Force32 = 0x7FFFFFFF |
| 66 } NvRmAnalogInterface; |
| 67 |
| 68 /** |
| 69 * Defines the USB Line state |
| 70 */ |
| 71 |
| 72 typedef enum |
| 73 { |
| 74 NvRmUsbLineStateType_SE0 = 0, |
| 75 NvRmUsbLineStateType_SJ = 1, |
| 76 NvRmUsbLineStateType_SK = 2, |
| 77 NvRmUsbLineStateType_SE1 = 3, |
| 78 NvRmUsbLineStateType_Num, |
| 79 NvRmUsbLineStateType_Force32 = 0x7FFFFFFF |
| 80 } NvRmUsbLineStateType; |
| 81 |
| 82 /** |
| 83 * List of analog TV DAC type |
| 84 */ |
| 85 |
| 86 typedef enum |
| 87 { |
| 88 NvRmAnalogTvDacType_CRT, |
| 89 NvRmAnalogTvDacType_SDTV, |
| 90 NvRmAnalogTvDacType_HDTV, |
| 91 NvRmAnalogTvDacType_Num, |
| 92 NvRmAnalogTvDacType_Force32 = 0x7FFFFFFF |
| 93 } NvRmAnalogTvDacType; |
| 94 |
| 95 /** |
| 96 * Create an analog interface id with multiple instances. |
| 97 */ |
| 98 #define NVRM_ANALOG_INTERFACE( id, instance ) \ |
| 99 ((NvRmAnalogInterface)( (instance) << 16 | id )) |
| 100 |
| 101 /** |
| 102 * Get the interface id. |
| 103 */ |
| 104 #define NVRM_ANALOG_INTERFACE_ID( id ) ((id) & 0xFFFF) |
| 105 |
| 106 /** |
| 107 * Get the interface instance. |
| 108 */ |
| 109 #define NVRM_ANALOG_INTERFACE_INSTANCE( id ) (((id) >> 16) & 0xFFFF) |
| 110 |
| 111 /** |
| 112 * Control I/O pads, DACs, or PHYs, either enable or disable, with an optional |
| 113 * configuration structure, which may be defined per module. |
| 114 * |
| 115 * @param hDevice Handle to the RM device |
| 116 * @param Interface The physical interface to configure |
| 117 * @param Enable enable/disable bit |
| 118 * @param Config extra configuration options for each module, if necessary |
| 119 * @param ConfigLength the size in bytes of the configuration structure |
| 120 */ |
| 121 |
| 122 NvError NvRmAnalogInterfaceControl( |
| 123 NvRmDeviceHandle hDevice, |
| 124 NvRmAnalogInterface Interface, |
| 125 NvBool Enable, |
| 126 void* Config, |
| 127 NvU32 ConfigLength ); |
| 128 |
| 129 /** |
| 130 * Get TV DAC Configuration |
| 131 * |
| 132 * @param hDevice Handle to the RM device |
| 133 * @param Type The analog TV DAC type |
| 134 * @return The analog TV DAC Configuration value |
| 135 */ |
| 136 |
| 137 NvU8 NvRmAnalogGetTvDacConfiguration( |
| 138 NvRmDeviceHandle hDevice, |
| 139 NvRmAnalogTvDacType Type ); |
| 140 |
| 141 /** |
| 142 * Detect if USB is connected or not |
| 143 * |
| 144 * @param hDevice Handle to the RM device |
| 145 * @return TRUE means USB is connected |
| 146 */ |
| 147 |
| 148 NvBool NvRmUsbIsConnected( |
| 149 NvRmDeviceHandle hDevice ); |
| 150 |
| 151 /** |
| 152 * Detect charger type |
| 153 * |
| 154 * @param hDevice Handle to the RM device |
| 155 * @param wait Delay time and ready to get the correct charger type |
| 156 * @return USB charger type |
| 157 */ |
| 158 |
| 159 NvU32 NvRmUsbDetectChargerState( |
| 160 NvRmDeviceHandle hDevice, |
| 161 NvU32 wait ); |
| 162 |
| 163 /** |
| 164 * Extended configuration structures for NvRmAnalogInterfaceControl. |
| 165 */ |
| 166 |
| 167 typedef struct NvRmAnalogTvDacConfigRec |
| 168 { |
| 169 |
| 170 /* The DAC input source, may be a Display controller or the TVO engine */ |
| 171 NvRmModuleID Source; |
| 172 |
| 173 /* The DAC output amplitude */ |
| 174 NvU8 DacAmplitude; |
| 175 } NvRmAnalogTvDacConfig; |
| 176 |
| 177 /** |
| 178 * List of USB analog status check parameters |
| 179 */ |
| 180 |
| 181 typedef enum |
| 182 { |
| 183 NvRmAnalogUsbInputParam_CheckCableStatus, |
| 184 NvRmAnalogUsbInputParam_CheckChargerStatus, |
| 185 NvRmAnalogUsbInputParam_CheckIdStatus, |
| 186 NvRmAnalogUsbInputParam_WaitForPhyClock, |
| 187 NvRmAnalogUsbInputParam_ConfigureUsbPhy, |
| 188 NvRmAnalogUsbInputParam_ChargerDetection, |
| 189 NvRmAnalogUsbInputParam_SetUlpiNullTrimmers, |
| 190 NvRmAnalogUsbInputParam_ConfigureUlpiNullClock, |
| 191 NvRmAnalogUsbInputParam_SetNullUlpiPinMux, |
| 192 NvRmAnalogUsbInputParam_SetUlpiLinkTrimmers, |
| 193 NvRmAnalogUsbInputParam_VbusInterrupt, |
| 194 NvRmAnalogUsbInputParam_IdInterrupt, |
| 195 NvRmAnalogUsbInputParam_Num, |
| 196 NvRmAnalogUsbInputParam_Force32 = 0x7FFFFFFF |
| 197 } NvRmAnalogUsbInputParam; |
| 198 |
| 199 /** |
| 200 * Extended configuration structures for NvRmAnalogInterfaceControl for USB. |
| 201 */ |
| 202 |
| 203 typedef struct NvRmAnalogUsbConfigRec |
| 204 { |
| 205 |
| 206 /* The USB Status check parameter */ |
| 207 NvRmAnalogUsbInputParam InParam; |
| 208 NvBool UsbCableDetected; |
| 209 NvBool UsbChargerDetected; |
| 210 NvBool UsbIdDetected; |
| 211 } NvRmAnalogUsbConfig; |
| 212 |
| 213 #if defined(__cplusplus) |
| 214 } |
| 215 #endif |
| 216 |
| 217 #endif |
OLD | NEW |