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 * @brief <b>NVIDIA Driver Development Kit: |
| 36 * NvDDK USB PHY functions</b> |
| 37 * |
| 38 * @b Description: Defines USB PHY private functions |
| 39 * |
| 40 */ |
| 41 |
| 42 #ifndef INCLUDED_NVDDK_USBPHY_H |
| 43 #define INCLUDED_NVDDK_USBPHY_H |
| 44 |
| 45 #include "nvcommon.h" |
| 46 #include "nvrm_init.h" |
| 47 #include "nvos.h" |
| 48 |
| 49 |
| 50 #if defined(__cplusplus) |
| 51 extern "C" |
| 52 { |
| 53 #endif |
| 54 |
| 55 |
| 56 /** |
| 57 * Opaque handle to a Usb phy device. |
| 58 */ |
| 59 typedef struct NvDdkUsbPhyRec *NvDdkUsbPhyHandle; |
| 60 |
| 61 |
| 62 /** |
| 63 * Enum defining USB Phy-specific IOCTL types. |
| 64 */ |
| 65 typedef enum |
| 66 { |
| 67 /** |
| 68 * Gets the USB VBUS status. |
| 69 * |
| 70 * @par Inputs: |
| 71 * None. |
| 72 * |
| 73 * @par Outputs: |
| 74 * ::NvDdkUsbPhyIoctl_VBusStatusOutputArgs. |
| 75 * |
| 76 * @retval NvError_Success |
| 77 * @retval NvError_BadParameter Output Argument is invalid. |
| 78 */ |
| 79 NvDdkUsbPhyIoctlType_VBusStatus, |
| 80 |
| 81 /** |
| 82 * Configures the VBUS Interrupt. |
| 83 * |
| 84 * @par Inputs: |
| 85 * ::NvDdkUsbPhyIoctl_VBusInterruptInputArgs. |
| 86 * |
| 87 * @par Outputs: |
| 88 * None. |
| 89 * |
| 90 * @retval NvError_Success |
| 91 * @retval NvError_BadParameter Input Argument is invalid. |
| 92 */ |
| 93 NvDdkUsbPhyIoctlType_VBusInterrupt, |
| 94 |
| 95 /** |
| 96 * Gets the USB ID pin status. |
| 97 * |
| 98 * @par Inputs: |
| 99 * None. |
| 100 * |
| 101 * @par Outputs: |
| 102 * ::NvDdkUsbPhyIoctl_IdPinStatusOutputArgs. |
| 103 * |
| 104 * @retval NvError_Success |
| 105 * @retval NvError_BadParameter Output Argument is invalid. |
| 106 */ |
| 107 NvDdkUsbPhyIoctlType_IdPinStatus, |
| 108 |
| 109 /** |
| 110 * Configures the USB Id pin Interrupt. |
| 111 * |
| 112 * @par Inputs: |
| 113 * ::NvDdkUsbPhyIoctl_IdPinInterruptInputArgs. |
| 114 * |
| 115 * @par Outputs: |
| 116 * None. |
| 117 * |
| 118 * @retval NvError_Success |
| 119 * @retval NvError_BadParameter Input Argument is invalid. |
| 120 */ |
| 121 NvDdkUsbPhyIoctlType_IdPinInterrupt, |
| 122 |
| 123 /** |
| 124 * Gets the USB Dedicated charger status. |
| 125 * |
| 126 * @par Inputs: |
| 127 * None. |
| 128 * |
| 129 * @par Outputs: |
| 130 * ::NvDdkUsbPhyIoctl_DedicatedChargerStatusOutputArgs. |
| 131 * |
| 132 * @retval NvError_Success |
| 133 * @retval NvError_BadParameter Output Argument is invalid. |
| 134 */ |
| 135 NvDdkUsbPhyIoctlType_DedicatedChargerStatus, |
| 136 |
| 137 /** |
| 138 * Configures the USB dedicated charger detection. |
| 139 * |
| 140 * @par Inputs: |
| 141 * ::NvDdkUsbPhyIoctl_DedicatedChargerDetectionInputArgs. |
| 142 * |
| 143 * @par Outputs: |
| 144 * None. |
| 145 * |
| 146 * @retval NvError_Success |
| 147 * @retval NvError_BadParameter Input Argument is invalid. |
| 148 */ |
| 149 NvDdkUsbPhyIoctlType_DedicatedChargerDetection, |
| 150 |
| 151 /** |
| 152 * Configures the Busy hints for the USB controller |
| 153 * |
| 154 * @par Inputs: |
| 155 * ::NvDdkUsbPhyIoctl_UsbBusyHintsOnOffInputArgs. |
| 156 * |
| 157 * @par Outputs: |
| 158 * None. |
| 159 * |
| 160 * @retval NvError_Success |
| 161 * @retval NvError_BadParameter Input Argument is invalid. |
| 162 */ |
| 163 NvDdkUsbPhyIoctlType_UsbBusyHintsOnOff, |
| 164 |
| 165 |
| 166 NvDdkUsbPhyIoctlType_Num, |
| 167 /** |
| 168 * Ignore -- Forces compilers to make 32-bit enums. |
| 169 */ |
| 170 NvDdkUsbPhyIoctlType_Force32 = 0x7FFFFFFF |
| 171 } NvDdkUsbPhyIoctlType; |
| 172 |
| 173 /** |
| 174 * VBUS status IOCTL output arguments. |
| 175 */ |
| 176 typedef struct NvDdkUsbPhyIoctl_VBusStatusOutputArgsRec |
| 177 { |
| 178 // VBUS status: If Set to NV_TRUE VBUS is detected else VBUS is not detected
. |
| 179 NvBool VBusDetected; |
| 180 } NvDdkUsbPhyIoctl_VBusStatusOutputArgs; |
| 181 |
| 182 /** |
| 183 * VBUS Interrupt configuration IOCTL input arguments. |
| 184 */ |
| 185 typedef struct NvDdkUsbPhyIoctl_VBusInterruptInputArgsRec |
| 186 { |
| 187 // VBUS Interrupt: If Set to NV_TRUE VBUS interrupt is enabled else disabled
. |
| 188 NvBool EnableVBusInterrupt; |
| 189 } NvDdkUsbPhyIoctl_VBusInterruptInputArgs; |
| 190 |
| 191 /** |
| 192 * USB Id pin status IOCTL output arguments. |
| 193 */ |
| 194 typedef struct NvDdkUsbPhyIoctl_IdPinStatusOutputArgsRec |
| 195 { |
| 196 // VBUS status: If Set to NV_TRUE Id pin is low else Id pin is high. |
| 197 NvBool IdPinSetToLow; |
| 198 } NvDdkUsbPhyIoctl_IdPinStatusOutputArgs; |
| 199 |
| 200 /* |
| 201 * USB Id pin Interrupt configuration IOCTL input arguments. |
| 202 */ |
| 203 typedef struct NvDdkUsbPhyIoctl_IdPinInterruptInputArgsRec |
| 204 { |
| 205 // VBUS Interrupt: If Set to NV_TRUE Id pin interrupt is enabled else disabl
ed. |
| 206 NvBool EnableIdPinInterrupt; |
| 207 } NvDdkUsbPhyIoctl_IdPinInterruptInputArgs; |
| 208 |
| 209 |
| 210 /** |
| 211 * USB dedicated charger status IOCTL output arguments. |
| 212 */ |
| 213 typedef struct NvDdkUsbPhyIoctl_DedicatedChargerStatusOutputArgsRec |
| 214 { |
| 215 // Dedicated Charger status: If Set to NV_TRUE charger is detected else Id n
ot detected. |
| 216 NvBool ChargerDetected; |
| 217 } NvDdkUsbPhyIoctl_DedicatedChargerStatusOutputArgs; |
| 218 |
| 219 /* |
| 220 * USB dedicated charger configuration IOCTL input arguments. |
| 221 */ |
| 222 typedef struct NvDdkUsbPhyIoctl_DedicatedChargerDetectionInputArgsRec |
| 223 { |
| 224 // Charger Interrupt: If Set to NV_TRUE charger interrupt is enabled else di
sabled. |
| 225 NvBool EnableChargerInterrupt; |
| 226 // Charger detection: If set to NV_TRUE enables the charger detection else d
isables. |
| 227 NvBool EnableChargerDetection; |
| 228 } NvDdkUsbPhyIoctl_DedicatedChargerDetectionInputArgs; |
| 229 |
| 230 |
| 231 |
| 232 /** |
| 233 * USB busy hints configuration IOCTL input arguments. |
| 234 */ |
| 235 typedef struct NvDdkUsbPhyIoctl_UsbBusyHintsOnOffInputArgsRec |
| 236 { |
| 237 // Busy hints on/off: If set to NV_TRUE enables the busy hintson else disabl
es. |
| 238 NvBool OnOff; |
| 239 // Requested boost duration in milliseconds. |
| 240 // if BoostDurationMs = NV_WAIT_INFINITE, then busy hints will be on untill |
| 241 // busy hints are off. This is valid only if OnOff = NV_TRUE |
| 242 NvU32 BoostDurationMs; |
| 243 } NvDdkUsbPhyIoctl_UsbBusyHintsOnOffInputArgs; |
| 244 |
| 245 |
| 246 /** |
| 247 * Opens the Usb Phy, allocates the resources and initializes the phy. |
| 248 * |
| 249 * @param hRmDevice Handle to the Rm device, which is required to |
| 250 * acquire the resources from RM. |
| 251 * @param Instance Instance of specific device. |
| 252 * @param hUsbPhy returns the USB phy handle. |
| 253 * |
| 254 * @retval NvSuccess |
| 255 * @retval NvError_Timeout If phy clock is not stable in expected time. |
| 256 */ |
| 257 NvError NvDdkUsbPhyOpen( |
| 258 NvRmDeviceHandle hRm, |
| 259 NvU32 Instance, |
| 260 NvDdkUsbPhyHandle *hUsbPhy); |
| 261 |
| 262 /** |
| 263 * Power down the Phy safely and release all the resources allocated. |
| 264 * |
| 265 * @param hUsbPhy Handle acquired during the NvDdkUsbPhyOpen() call. |
| 266 * |
| 267 */ |
| 268 void NvDdkUsbPhyClose(NvDdkUsbPhyHandle hUsbPhy); |
| 269 |
| 270 /** |
| 271 * Powers up the device. It could be taking out of low power mode or |
| 272 * reinitializing. |
| 273 * |
| 274 * @param hUsbPhy Handle acquired during the NvDdkUsbPhyOpen() call. |
| 275 * @param IsHostMode indicates the host mode or not. |
| 276 * @param IsDpd Deep sleep power up or not . |
| 277 * |
| 278 * @retval NvSuccess |
| 279 * @retval NvError_Timeout If phy clock is not stable in expected time. |
| 280 */ |
| 281 NvError NvDdkUsbPhyPowerUp(NvDdkUsbPhyHandle hUsbPhy, NvBool IsHostMode, NvBool
IsDpd); |
| 282 |
| 283 /** |
| 284 * Powers down the PHY. It could be low power mode or shutdown. |
| 285 * |
| 286 * @param hUsbPhy Handle acquired during the NvDdkUsbPhyOpen() call. |
| 287 * @param IsHostMode indicates the host mode or not. |
| 288 * @param IsDpd Handle Deep sleep power down or not . |
| 289 * |
| 290 * @retval NvSuccess |
| 291 */ |
| 292 NvError NvDdkUsbPhyPowerDown(NvDdkUsbPhyHandle hUsbPhy, NvBool IsHostMode, NvBoo
l IsDpd); |
| 293 |
| 294 /** |
| 295 * Perform an I/O control operation on the device. |
| 296 * |
| 297 * @param hBlockDev Handle acquired during the NvDdkXxxBlockDevOpen() call. |
| 298 * @param IoctlType Type of control operation to perform. |
| 299 * @param InputArgs A pointer to input arguments buffer. |
| 300 * @param OutputArgs A pointer to output arguments buffer. |
| 301 * |
| 302 * @retval NvError_Success IOCTL is successful. |
| 303 * @retval NvError_NotSupported \a Opcode is not recognized. |
| 304 * @retval NvError_InvalidParameter \a InputArgs or \a OutputArgs is |
| 305 * incorrect. |
| 306 */ |
| 307 NvError NvDdkUsbPhyIoctl( |
| 308 NvDdkUsbPhyHandle hUsbPhy, |
| 309 NvDdkUsbPhyIoctlType IoctlType, |
| 310 const void *InputArgs, |
| 311 void *OutputArgs); |
| 312 |
| 313 /** |
| 314 * Waits until Phy clock is stable. |
| 315 * |
| 316 * @param hUsbPhy Handle acquired during the NvDdkUsbPhyOpen() call. |
| 317 * |
| 318 * @retval NvSuccess If phy clock is stable. |
| 319 * @retval NvError_Timeout If phy clock is not stable in expected time. |
| 320 */ |
| 321 NvError NvDdkUsbPhyWaitForStableClock(NvDdkUsbPhyHandle hUsbPhy); |
| 322 |
| 323 |
| 324 #if defined(__cplusplus) |
| 325 } |
| 326 #endif |
| 327 |
| 328 /** @}*/ |
| 329 #endif // INCLUDED_NVDDK_USBPHY_H |
| 330 |
OLD | NEW |