OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2007-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 * GPIO Query Interface</b> |
| 37 * |
| 38 * @b Description: Defines the ODM query interface for GPIO pins. |
| 39 */ |
| 40 |
| 41 #ifndef INCLUDED_NVODM_QUERY_GPIO_H |
| 42 #define INCLUDED_NVODM_QUERY_GPIO_H |
| 43 /** |
| 44 * @defgroup nvodm_gpio GPIO Query Interface |
| 45 * This is the ODM query interface for GPIO configurations. |
| 46 * @ingroup nvodm_query |
| 47 * @{ |
| 48 */ |
| 49 #include "nvcommon.h" |
| 50 |
| 51 #if defined(__cplusplus) |
| 52 extern "C" |
| 53 { |
| 54 #endif |
| 55 |
| 56 /** |
| 57 * Defines GPIO pin groups. |
| 58 */ |
| 59 typedef enum |
| 60 { |
| 61 /// Specifies a NULL display group. |
| 62 NvOdmGpioPinGroup_None = 0, |
| 63 |
| 64 /// Specifies a display pin group. |
| 65 NvOdmGpioPinGroup_Display, |
| 66 |
| 67 /// Specifies a keypad column pin group--used only if the system uses |
| 68 /// GPIO-based keypad. |
| 69 NvOdmGpioPinGroup_keypadColumns, |
| 70 |
| 71 /// Specifies a keypad rows pin group--used only if the system uses |
| 72 /// GPIO-based keypad. |
| 73 NvOdmGpioPinGroup_keypadRows, |
| 74 |
| 75 /// Specifies a special key for a keypad--This is used in both KBC based |
| 76 /// keypad and GPIO-based keypad. |
| 77 NvOdmGpioPinGroup_keypadSpecialKeys, |
| 78 |
| 79 /// Specifies a pin group representing all the other keypad GPIOs. |
| 80 NvOdmGpioPinGroup_keypadMisc, |
| 81 |
| 82 /// Specifies an SDIO pin group. This pin group has 2 instances. |
| 83 /// @note If this value is set, NvOdmQuerySdioInterfaceProperty::IsCardRemov
able |
| 84 /// is ignored. |
| 85 NvOdmGpioPinGroup_Sdio, |
| 86 |
| 87 /// Specifies an HSMMC pin group. |
| 88 /// @note If this value is set, NvOdmQueryHsmmcInterfaceProperty::IsCardRemo
vable |
| 89 /// is ignored. |
| 90 NvOdmGpioPinGroup_Hsmmc, |
| 91 |
| 92 /// Specifies a USB pin group. |
| 93 NvOdmGpioPinGroup_Usb, |
| 94 |
| 95 /// Specifies an IDE function pin group. |
| 96 NvOdmGpioPinGroup_Ide, |
| 97 |
| 98 /// Specifies an OEM pin group. |
| 99 NvOdmGpioPinGroup_OEM, |
| 100 |
| 101 /// Specifies a test pin group used by the internal tests. |
| 102 NvOdmGpioPinGroup_Test, |
| 103 |
| 104 /// Specifies a group used by the external MIO Ethernet adapter. |
| 105 NvOdmGpioPinGroup_MioEthernet, |
| 106 |
| 107 /// Deprecated name -- retained for backward compatibility. |
| 108 NvOdmGpioPinGroup_Ethernet = NvOdmGpioPinGroup_MioEthernet, |
| 109 |
| 110 /// Specifies a group used for NAND flash write protect. |
| 111 NvOdmGpioPinGroup_NandFlash, |
| 112 |
| 113 /// Specifies a group used for scroll wheel pins. |
| 114 NvOdmGpioPinGroup_ScrollWheel, |
| 115 |
| 116 /// Specifies a group used for MIO bus control signals. |
| 117 NvOdmGpioPinGroup_Mio, |
| 118 |
| 119 /// Specifies a group used for bluetooth control signals. |
| 120 NvOdmGpioPinGroup_Bluetooth, |
| 121 |
| 122 /// Specifies a group used for WLAN control signals. |
| 123 NvOdmGpioPinGroup_Wlan, |
| 124 |
| 125 /// Specifies a group for HDMI. |
| 126 NvOdmGpioPinGroup_Hdmi, |
| 127 |
| 128 /// Specifies a group for CRT. |
| 129 NvOdmGpioPinGroup_Crt, |
| 130 |
| 131 /// Specifies a group for SPI. |
| 132 NvOdmGpioPinGroup_SpiEthernet, |
| 133 |
| 134 /// Deprecated name -- retained for backward compatibility. |
| 135 NvOdmGpioPinGroup_Spi = NvOdmGpioPinGroup_SpiEthernet, |
| 136 |
| 137 /// Specifies a group for Vi. |
| 138 NvOdmGpioPinGroup_Vi, |
| 139 |
| 140 /// Specifies a group for DSI. |
| 141 NvOdmGpioPinGroup_Dsi, |
| 142 |
| 143 |
| 144 /// Specifies a group for keys used to suspend/resume/shutdown. |
| 145 NvOdmGpioPinGroup_Power, |
| 146 |
| 147 /// Specifies a group for keys used to resume from EC keyboard. |
| 148 NvOdmGpioPinGroup_WakeFromECKeyboard, |
| 149 |
| 150 /// Specifies the total number of pin groups. |
| 151 NvOdmGpioPinGroup_Num, |
| 152 NvOdmGpioPinGroup_Force32 = 0x7FFFFFFF, |
| 153 } NvOdmGpioPinGroup; |
| 154 |
| 155 /** @name Display GPIO Pins |
| 156 * Each panel uses some number of GPIO pins for configuring the panel. The |
| 157 * usage and the number of pins vary from panel to panel. One main board can |
| 158 * support multiple panels. In such cases, GPIOs used by all the panels must |
| 159 * be reserved. GPIO pin table exported by display pin group is a set of all |
| 160 * the panels it supports--one set for each panel. The client of this API is |
| 161 * the display ODM adaptation. Display ODM adaptation is written once for a |
| 162 * panel and all the board-specific changes are abstratced in this API. |
| 163 * |
| 164 * If the ODM implements its own display adaptation, rather than the using the |
| 165 * display adaptation provided by NVIDIA, there is no need to implement |
| 166 * display virtual pin map. |
| 167 * |
| 168 * Please refer to the documentation for the mapping between physical panel |
| 169 * and panel index used here. |
| 170 */ |
| 171 /*@{*/ |
| 172 #define NvOdmGpioPin_DisplayPanel0Pincount (6) |
| 173 #define NvOdmGpioPin_DisplayPanel0Start (0) |
| 174 #define NvOdmGpioPin_DisplayPanel0End (NvOdmGpioPin_DisplayPanel0Start +
NvOdmGpioPin_DisplayPanel0Pincount - 1) |
| 175 |
| 176 #define NvOdmGpioPin_DisplayPanel1Pincount (4) |
| 177 #define NvOdmGpioPin_DisplayPanel1Start (NvOdmGpioPin_DisplayPanel0End + 1) |
| 178 #define NvOdmGpioPin_DisplayPanel1End (NvOdmGpioPin_DisplayPanel1Start +
NvOdmGpioPin_DisplayPanel1Pincount - 1) |
| 179 |
| 180 #define NvOdmGpioPin_DisplayPanel2Pincount (1) |
| 181 #define NvOdmGpioPin_DisplayPanel2Start (NvOdmGpioPin_DisplayPanel1End + 1) |
| 182 #define NvOdmGpioPin_DisplayPanel2End (NvOdmGpioPin_DisplayPanel2Start +
NvOdmGpioPin_DisplayPanel2Pincount - 1) |
| 183 |
| 184 #define NvOdmGpioPin_DisplayPanel3Pincount (21) |
| 185 #define NvOdmGpioPin_DisplayPanel3Start (NvOdmGpioPin_DisplayPanel2End + 1) |
| 186 #define NvOdmGpioPin_DisplayPanel3End (NvOdmGpioPin_DisplayPanel3Start +
NvOdmGpioPin_DisplayPanel3Pincount - 1) |
| 187 |
| 188 #define NvOdmGpioPin_DisplayPanel4Pincount (1) |
| 189 #define NvOdmGpioPin_DisplayPanel4Start (NvOdmGpioPin_DisplayPanel3End + 1) |
| 190 |
| 191 #define NvOdmGpioPin_DisplayPanel4End (NvOdmGpioPin_DisplayPanel4Start +
NvOdmGpioPin_DisplayPanel4Pincount - 1) |
| 192 |
| 193 #define NvOdmGpioPin_DisplayPanel5Pincount (4) |
| 194 #define NvOdmGpioPin_DisplayPanel5Start (NvOdmGpioPin_DisplayPanel4End + 1) |
| 195 |
| 196 #define NvOdmGpioPin_DisplayPanel5End (NvOdmGpioPin_DisplayPanel5Start +
NvOdmGpioPin_DisplayPanel5Pincount - 1) |
| 197 |
| 198 #define NvOdmGpioPin_DisplayPinCount (NvOdmGpioPin_DisplayPanel5End + 1) |
| 199 |
| 200 /*@}*/ |
| 201 /**@name Keypad Virtual Pins */ |
| 202 /*@{*/ |
| 203 /** Max GPIOs that can be used for as rows in GPIO-based keypad. For chips |
| 204 * later than AP15, silicon supports a dedicated KBC controller. |
| 205 * If using GPIO-based keypad driver, it has the upper limit on the number of |
| 206 * the rows defined by this macro. |
| 207 * When the NvOdmQueryGpioPinMap() is called with virtual pin group of |
| 208 * ::NvOdmGpioPinGroup_keypadColumns, ODM should return an array |
| 209 * of GPIOs mapped for column keys. Array size should not be more than 32. This |
| 210 * upper limit is just for saftey checks and in no sense inidicates the |
| 211 * limitations of the NVIDIA driver. */ |
| 212 #define NvOdmGpioPin_keypadColumnsPinCountMax (32) |
| 213 |
| 214 /** Max GPIOs that can be used for as rows in GPIO based keypad. For chips |
| 215 * later than AP15, silicon supports a dedicated KBC controller. |
| 216 * If using GPIO-based keypad driver, it has the upper limit on the number of |
| 217 * the rows defined by this macro. |
| 218 * When NvOdmQueryGpioPinMap() is called with virtual pin group of |
| 219 * ::NvOdmGpioPinGroup_keypadRows, ODM should return a array |
| 220 * of GPIOs mapped for row keys. Array size should not be more than |
| 221 * ::NvOdmGpioPin_keypadRowsPinCountMax. |
| 222 * This upper limit is just for saftey checks and does not inidicate the |
| 223 * limitations of the NVIDIA driver. */ |
| 224 #define NvOdmGpioPin_keypadRowsPinCountMax (32) |
| 225 |
| 226 /** Max GPIOs that can be used for the special keys. Driver is limited by this |
| 227 * number of special keys. When NvOdmQueryGpioPinMap() is called with virtual |
| 228 * pin group of ::NvOdmGpioPinGroup_keypadSpecialKeys, ODM should return an arra
y |
| 229 * of GPIOs mapped for special keys. Array size should not be more than 32. This |
| 230 * upper limit is just for saftey checks and in no sense inidicates the |
| 231 * limitations of the NVIDIA driver. */ |
| 232 #define NvOdmGpioPin_keypadSpecialKeysCountMax (32) |
| 233 |
| 234 /*@}*/ |
| 235 /** @name Misc Keypad GPIOs */ |
| 236 /*@{*/ |
| 237 /** GPIO used to control illuminating the keypad. This GPIO line is set to |
| 238 * active state when a key is pressed. */ |
| 239 #define NvOdmGpioPin_keypadMiscBackLight (0) |
| 240 /** When this key is in pressed state all the inputs are disabled. */ |
| 241 #define NvOdmGpioPin_keypadMiscHoldKey (NvOdmGpioPin_keypadMiscBackLig
ht + 1) |
| 242 /** Total count pin count for keypad pin group */ |
| 243 #define NvOdmGpioPin_keypadMiscPinCount (NvOdmGpioPin_keypadMiscHoldKey
+ 1) |
| 244 |
| 245 /*@}*/ |
| 246 /** @name HSMMC Virtual Pins */ |
| 247 /*@{*/ |
| 248 #define NvOdmGpioPin_HsmmcCardDetect (0) |
| 249 #define NvOdmGpioPin_HsmmcWriteProtect (NvOdmGpioPin_HsmmcCardDetect + 1) |
| 250 #define NvOdmGpioPin_HsmmcPinCount (NvOdmGpioPin_HsmmcWriteProtect + 1) |
| 251 |
| 252 /*@}*/ |
| 253 /** @name SDIO Virtual Pins */ |
| 254 /*@{*/ |
| 255 #define NvOdmGpioPin_SdioCardDetect (0) |
| 256 #define NvOdmGpioPin_SdioWriteProtect (NvOdmGpioPin_SdioCardDetect +1) |
| 257 #define NvOdmGpioPin_SdioPinCount (NvOdmGpioPin_SdioWriteProtect + 1) |
| 258 |
| 259 /*@}*/ |
| 260 /** @name USB GPIO Pins */ |
| 261 /*@{*/ |
| 262 #define NvOdmGpioPin_UsbCableId (0) |
| 263 #define NvOdmGpioPin_UsbPinCount (NvOdmGpioPin_UsbCableId + 1) |
| 264 |
| 265 /*@}*/ |
| 266 /** @name IDE Function GPIO Pins */ |
| 267 /*@{*/ |
| 268 #define NvOdmGpioPin_IdePowerEnable (0) |
| 269 #define NvOdmGpioPin_IdePinCount (NvOdmGpioPin_IdePowerEnable + 1) |
| 270 |
| 271 /*@}*/ |
| 272 /** @name Test Pin Groups */ |
| 273 /*@{*/ |
| 274 #define NvOdmGpioPin_Test1 (0) |
| 275 #define NvOdmGpioPin_Test2 (1) |
| 276 #define NvOdmGpioPin_TestPinCount (NvOdmGpioPin_Test2 + 1) |
| 277 |
| 278 /*@}*/ |
| 279 /** @name External Ethernet Adapter Pin Groups */ |
| 280 /*@{*/ |
| 281 #define NvOdmGpioPin_Ethernet (0) |
| 282 #define NvOdmGpioPin_EthernetCount (NvOdmGpioPin_Ethernet + 1) |
| 283 |
| 284 /*@}*/ |
| 285 /** @name NAND Flash WP Pin Groups */ |
| 286 /*@{*/ |
| 287 #define NvOdmGpioPin_NandFlash (0) |
| 288 #define NvOdmGpioPin_NandFlashCount (NvOdmGpioPin_NandFlash + 1) |
| 289 |
| 290 /*@}*/ |
| 291 /** @name Scroll Wheel Pin Groups */ |
| 292 /*@{*/ |
| 293 #define NvOdmGpioPin_ScrollWheelInputPin1 (0) |
| 294 #define NvOdmGpioPin_ScrollWheelOnOff (NvOdmGpioPin_ScrollWheelInputPin1 +
1) |
| 295 #define NvOdmGpioPin_ScrollWheelSelectPin (NvOdmGpioPin_ScrollWheelOnOff + 1) |
| 296 #define NvOdmGpioPin_ScrollWheelInputPin2 (NvOdmGpioPin_ScrollWheelSelectPin +
1) |
| 297 /*@}*/ |
| 298 /** @name Bluetooth Control Pin Groups */ |
| 299 /*@{*/ |
| 300 #define NvOdmGpioPin_Bluetooth (0) |
| 301 #define NvOdmGpioPin_BluetoothReset (NvOdmGpioPin_Bluetooth + 1) |
| 302 |
| 303 /*@}*/ |
| 304 /** @name WLAN Control Pin Groups */ |
| 305 /*@{*/ |
| 306 #define NvOdmGpioPin_Wlan (0) |
| 307 #define NvOdmGpioPin_WlanPower (NvOdmGpioPin_Wlan + 1) |
| 308 #define NvOdmGpioPin_WlanReset (NvOdmGpioPin_WlanPower + 1) |
| 309 |
| 310 /*@}*/ |
| 311 /** @name DSI Pin Groups */ |
| 312 /*@{*/ |
| 313 #define NvOdmGpioPin_DsiLcdResetId (0) |
| 314 #define NvOdmGpioPin_DsiLcdTeId (NvOdmGpioPin_DsiLcdResetId + 1) |
| 315 #define NvOdmGpioPin_DsiLcdHsIntId (NvOdmGpioPin_DsiLcdTeId + 1) |
| 316 /*@}*/ |
| 317 |
| 318 /** |
| 319 * Defines the active state of the pin. For example, a USB cable connect pin |
| 320 * might be configured to have a active state of low when the cable is |
| 321 * connetced. On some boards the same pin can be configured as active high. |
| 322 * This enum abstracts this information. |
| 323 */ |
| 324 typedef enum |
| 325 { |
| 326 NvOdmGpioPinActiveState_Low = 0, |
| 327 NvOdmGpioPinActiveState_High, |
| 328 NvOdmGpioPinActiveState_Force32 = 0x7FFFFFFF, |
| 329 } NvOdmGpioPinActiveState; |
| 330 |
| 331 /** |
| 332 * Holds the GPIO pin information. |
| 333 */ |
| 334 typedef struct NvOdmGpioPinInfo_t { |
| 335 /// Holds the physical port mapped to the virtual pin group \c vGroup/virtua
l pin \c vPin. |
| 336 NvU32 Port; |
| 337 /// Holds the physical pin mapped to the virtual pin group \c vGroup/virtual
pin \c vPin. |
| 338 NvU32 Pin; |
| 339 /// Holds the active state of the pin. This is valid only for the input pins
. Active |
| 340 /// state is defined by each pin. For example, for a USB cable connect virtu
al pin, |
| 341 /// the active state is when the cable is connected. |
| 342 NvOdmGpioPinActiveState activeState; |
| 343 } NvOdmGpioPinInfo; |
| 344 |
| 345 #define NVODM_GPIO_INVALID_PORT 0xFF |
| 346 #define NVODM_GPIO_INVALID_PIN 0xFF |
| 347 |
| 348 /// Connected imager devices use the camera reserved GPIOs. |
| 349 /// Valid GPIO pins are between 0 and 6, and map to the external |
| 350 /// pins referred to as VGP0 thru VGP6, with the exception of 1 and 2. |
| 351 /// VGP1 and VGP2 are used for the camera I2C, so the VD10 and VD11 pins |
| 352 /// are substituted, via this interface, so as to avoid accidental use. |
| 353 #define NVODM_GPIO_CAMERA_PORT 0xFE |
| 354 |
| 355 /** |
| 356 * Gets the pin mappings for a virtual group. For optimal access the table shoul
d be |
| 357 * sorted using the vPin value. |
| 358 * |
| 359 * @see NvOdmGpioPinGroup |
| 360 * |
| 361 * @param Group The pin group for which the query is being made. |
| 362 * @param instance The instance of the pin group. For example, there are 2 insta
nces |
| 363 * of the SDIO pin group. |
| 364 * @param count A pointer to the count of entires in the ::NvOdmGpioPinInfo. |
| 365 * |
| 366 * @return A const pointer to the pin info table if the pin group |
| 367 * has valid GPIO configuration. |
| 368 */ |
| 369 const NvOdmGpioPinInfo *NvOdmQueryGpioPinMap(NvOdmGpioPinGroup Group, NvU32 inst
ance, NvU32 *count); |
| 370 |
| 371 #if defined(__cplusplus) |
| 372 } |
| 373 #endif |
| 374 |
| 375 /** @} */ |
| 376 |
| 377 #endif // INCLUDED_NVODM_QUERY_GPIO_H |
OLD | NEW |