Line 32:
Line 32:
! GpioPadName || GpioPadDescriptor || Tegra (port, pin) || Usage || Direction || Used by
! GpioPadName || GpioPadDescriptor || Tegra (port, pin) || Usage || Direction || Used by
|-
|-
−
| 0x01 || 0xCC || Z, 4 || rt5639 power (CODEC_LDO_EN) || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[Audio services]], [[Fatal services]])
+
| 0x01 || 0xCC || Z, 4 || Audio Codec (ALC5639) Power || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[Audio services]], [[Fatal services]])
|-
|-
| 0x02 || 0x24 || E, 4 || SDCard Power || Out || Icosa, Copper, Hoag, [5.0.0+] Mariko <br>([[Filesystem services]])
| 0x02 || 0x24 || E, 4 || SDCard Power || Out || Icosa, Copper, Hoag, [5.0.0+] Mariko <br>([[Filesystem services]])
Line 50:
Line 50:
| 0x09 || 0x91 || S, 1 || || In || Icosa, Hoag, [5.0.0+] Mariko
| 0x09 || 0x91 || S, 1 || || In || Icosa, Hoag, [5.0.0+] Mariko
|-
|-
−
| 0x0A || 0x96 || S, 6 || bq24192 Charge Enable || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[PTM services]])
+
| 0x0A || 0x96 || S, 6 || Charger IC (BQ24193) Charge Enable || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[PTM services]])
|-
|-
| 0x0B || 0x97 || S, 7 || CPU fan sampling || In || Icosa, Hoag, [5.0.0+] Mariko
| 0x0B || 0x97 || S, 7 || CPU fan sampling || In || Icosa, Hoag, [5.0.0+] Mariko
Line 60:
Line 60:
| 0x0E || 0x78 || P, 0 || SDMMC3_CLK_PP0? || In || Icosa, Hoag, [5.0.0+] Mariko
| 0x0E || 0x78 || P, 0 || SDMMC3_CLK_PP0? || In || Icosa, Hoag, [5.0.0+] Mariko
|-
|-
−
| 0x0F || 0x93 || S, 3 || GcAsic irq || In || Icosa, Copper, Hoag, [5.0.0+] Mariko <br>([[Filesystem services]])
+
| 0x0F || 0x93 || S, 3 || GcAsic IRQ || In || Icosa, Copper, Hoag, [5.0.0+] Mariko <br>([[Filesystem services]])
|-
|-
| 0x10 || 0x7D || P, 5 || SDMMC3_DAT0_PP5? || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
| 0x10 || 0x7D || P, 5 || SDMMC3_DAT0_PP5? || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
Line 70:
Line 70:
| 0x13 || 0x7A || P, 2 || SDMMC3_DAT3_PP2? || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
| 0x13 || 0x7A || P, 2 || SDMMC3_DAT3_PP2? || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
|-
|-
−
| 0x14 || 0xBC || X, 4 || Temperature sensor || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
+
| 0x14 || 0xBC || X, 4 || Temperature Sensor || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
|-
|-
| 0x15 || 0xAE || V, 6 || || In || Icosa, Hoag, [5.0.0+] Mariko <br>([[Audio services]])
| 0x15 || 0xAE || V, 6 || || In || Icosa, Hoag, [5.0.0+] Mariko <br>([[Audio services]])
Line 76:
Line 76:
| 0x16 || 0xBA || X, 2 || MOTION_INT_PX2? || In || Icosa, Hoag, [5.0.0+] Mariko
| 0x16 || 0xBA || X, 2 || MOTION_INT_PX2? || In || Icosa, Hoag, [5.0.0+] Mariko
|-
|-
−
| 0x17 || 0xB9 || X, 1 || Touchscreen IRQ (TOUCH_INT_PX1) (unused - polled instead) || In || Icosa, Hoag, [5.0.0+] Mariko <br>([[HID services]])
+
| 0x17 || 0xB9 || X, 1 || TouchPanel IRQ (TOUCH_INT_PX1) (unused - polled instead) || In || Icosa, Hoag, [5.0.0+] Mariko <br>([[HID services]])
|-
|-
| 0x18 || 0xBD || X, 5 || Power Button (BUTTON_POWER_ON_PX5) || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
| 0x18 || 0xBD || X, 5 || Power Button (BUTTON_POWER_ON_PX5) || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
Line 84:
Line 84:
| 0x1A || 0xBF || X, 7 || Volume Down (BUTTON_VOL_DOWN_PX7) || In || Icosa, Copper, Hoag, [5.0.0+] Mariko <br>([[Boot2]], [[Audio services]])
| 0x1A || 0xBF || X, 7 || Volume Down (BUTTON_VOL_DOWN_PX7) || In || Icosa, Copper, Hoag, [5.0.0+] Mariko <br>([[Boot2]], [[Audio services]])
|-
|-
−
| 0x1B || 0xC0 || Y, 0 || max17050 irq || In || Icosa, Hoag, [5.0.0+] Mariko <br>([[PTM services]])
+
| 0x1B || 0xC0 || Y, 0 || Fuel Gauge IC (MAX17050) IRQ || In || Icosa, Hoag, [5.0.0+] Mariko <br>([[PTM services]])
|-
|-
| 0x1C || 0xC1 || Y, 1 || BUTTON_HOME_PY1 || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
| 0x1C || 0xC1 || Y, 1 || BUTTON_HOME_PY1 || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
|-
|-
−
| 0x1D || 0xA9 || V, 1 || Backlight (LCD_BL_EN_PV1) || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[NV services]], [[Backlight services]])
+
| 0x1D || 0xA9 || V, 1 || Backlight Enable (LCD_BL_EN_PV1) || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[NV services]], [[Backlight services]])
|-
|-
−
| 0x1E || 0xAA || V, 2 || Backlight (LCD_RST_PV2) || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[NV services]])
+
| 0x1E || 0xAA || V, 2 || Backlight Reset (LCD_RST_PV2) || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[NV services]])
|-
|-
−
| 0x1F || 0x55 || K, 5 || bq24192 OTG charge select || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[PTM services]], [[USB services]])
+
| 0x1F || 0x55 || K, 5 || Charger IC (BQ24193) OTG charge select || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[PTM services]], [[USB services]])
|-
|-
−
| 0x20 || 0xAD || V, 5 || PD related || Out || Icosa, Copper, Hoag, [5.0.0+] Mariko <br>([[USB services]])
+
| 0x20 || 0xAD || V, 5 || USB-PD controller (RHOM BM92T30MWV) related || Out || Icosa, Copper, Hoag, [5.0.0+] Mariko <br>([[USB services]])
|-
|-
−
| 0x21 || 0xC8 || Z, 0 || bq24192 irq || In || Icosa, Hoag, [5.0.0+] Mariko <br>([[PTM services]])
+
| 0x21 || 0xC8 || Z, 0 || Charger IC (BQ24193) IRQ || In || Icosa, Hoag, [5.0.0+] Mariko <br>([[PTM services]])
|-
|-
| 0x22 || 0xCA || Z, 2 || || In || Icosa, Hoag, [5.0.0+] Mariko
| 0x22 || 0xCA || Z, 2 || || In || Icosa, Hoag, [5.0.0+] Mariko
Line 102:
Line 102:
| 0x23 || 0xCB || Z, 3 || || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
| 0x23 || 0xCB || Z, 3 || || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
|-
|-
−
| 0x24 || 0x4F || J, 7 || Touchscreen reset || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[HID services]])
+
| 0x24 || 0x4F || J, 7 || TouchPanel reset || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[HID services]])
|-
|-
| 0x25 || 0x50 || K, 0 || || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
| 0x25 || 0x50 || K, 0 || || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
Line 110:
Line 110:
| 0x27 || 0x52 || K, 2 || || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
| 0x27 || 0x52 || K, 2 || || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
|-
|-
−
| 0x28 || 0x54 || K, 4 || bm92t36 irq || In || Icosa, Copper, Hoag, [5.0.0+] Mariko <br>([[USB services]])
+
| 0x28 || 0x54 || K, 4 || USB-PD controller (RHOM BM92T30MWV) IRQ || In || Icosa, Copper, Hoag, [5.0.0+] Mariko <br>([[USB services]])
|-
|-
| 0x29 || 0x56 || K, 6 || || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
| 0x29 || 0x56 || K, 6 || || In || Icosa, Copper, Hoag, [5.0.0+] Mariko
Line 116:
Line 116:
| 0x2A || 0x57 || K, 7 || || In || Icosa, Copper, Hoag
| 0x2A || 0x57 || K, 7 || || In || Icosa, Copper, Hoag
|-
|-
−
| 0x2B || 0x53 || K, 3 || joycon(R) NwcpDriver1.NwcpCharger || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[HID services]])
+
| 0x2B || 0x53 || K, 3 || Joycon(R) NwcpDriver1.NwcpCharger || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[HID services]])
|-
|-
−
| 0x2C || 0xE3 || CC, 3 || joycon(L) NwcpDriver0.NwcpCharger || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[HID services]])
+
| 0x2C || 0xE3 || CC, 3 || Joycon(L) NwcpDriver0.NwcpCharger || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[HID services]])
|-
|-
| 0x2D || 0x38 || H, 0 || WIFI_EN_PH0? || Out || Icosa, Copper, Hoag, [5.0.0+] Mariko
| 0x2D || 0x38 || H, 0 || WIFI_EN_PH0? || Out || Icosa, Copper, Hoag, [5.0.0+] Mariko
Line 144:
Line 144:
| 0x38 || 0xC9 || Z, 1 || SDCard Card Detect || In || Icosa, Copper, Hoag, [5.0.0+] Mariko <br>([[Filesystem services]])
| 0x38 || 0xC9 || Z, 1 || SDCard Card Detect || In || Icosa, Copper, Hoag, [5.0.0+] Mariko <br>([[Filesystem services]])
|-
|-
−
| 0x39 || 0x4D || J, 5 || bq24192 OTG charge select || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[PTM services]], [[USB services]])
+
| 0x39 || 0x4D || J, 5 || Charger IC (BQ24193) OTG charge select || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[PTM services]], [[USB services]])
|-
|-
−
| 0x3A || 0x58 || L, 0 || bq24192 OTG charge select || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[PTM services]], [[USB services]])
+
| 0x3A || 0x58 || L, 0 || Charger IC (BQ24193) OTG charge select || Out || Icosa, Hoag, [5.0.0+] Mariko <br>([[PTM services]], [[USB services]])
|-
|-
−
| 0x3B || 0x3E || H, 6 || joycon(R) NwcpDriver1.GpioMonitorTask0 duplicate? || In || Icosa, Hoag, [5.0.0+] Mariko
+
| 0x3B || 0x3E || H, 6 || Joycon(R) NwcpDriver1.GpioMonitorTask0 duplicate? || In || Icosa, Hoag, [5.0.0+] Mariko
|-
|-
−
| 0x3C || 0x26 || E, 6 || joycon(L) NwcpDriver1.GpioMonitorTask0 duplicate? || In || Icosa, Hoag, [5.0.0+] Mariko
+
| 0x3C || 0x26 || E, 6 || Joycon(L) NwcpDriver1.GpioMonitorTask0 duplicate? || In || Icosa, Hoag, [5.0.0+] Mariko
|-
|-
| 0x3D || -1 || || || ||
| 0x3D || -1 || || || ||
|-
|-
−
| 0x3E || 0x33 || G, 3 || joycon(R) NwcpDriver1.GpioMonitorTask1 (CTS, checked low) || In || None <br>([[HID services]])
+
| 0x3E || 0x33 || G, 3 || Joycon(R) CTS (checked low) || In || None <br>([[HID services]])
|-
|-
−
| 0x3F || 0x1C || D, 4 || joycon(L) NwcpDriver0.GpioMonitorTask1 (CTS, checked low) || In || None <br>([[HID services]])
+
| 0x3F || 0x1C || D, 4 || Joycon(L) CTS (checked low) || In || None <br>([[HID services]])
|-
|-
| 0x40 || 0xD9 || BB, 1 || || Out || [2.0.0+] Copper
| 0x40 || 0xD9 || BB, 1 || || Out || [2.0.0+] Copper
Line 189:
Line 189:
|-
|-
| [5.0.0+] 0x4F || 0x56 || K, 6 || || || None
| [5.0.0+] 0x4F || 0x56 || K, 6 || || || None
+
|-
+
| - || 0x32 || G, 2 || Joycon(R) RTS || || None
+
|-
+
| - || 0x1B || D, 3 || Joycon(L) RTS || || None
|}
|}
Line 264:
Line 268:
! Cmd || Name
! Cmd || Name
|-
|-
−
| 0 || OpenSessionForDev
+
| 0 || [[#OpenSessionForDev_2|OpenSessionForDev]]
|-
|-
−
| 1 || OpenSession
+
| 1 || [[#OpenSession_2|OpenSession]]
|-
|-
−
| 2 || HasDevice
+
| 2 || [[#HasDevice|HasDevice]]
|-
|-
−
| 3 || HasDeviceForDev
+
| 3 || [[#HasDeviceForDev|HasDeviceForDev]]
|}
|}
Line 276:
Line 280:
{| class="wikitable sortable" border="1"
{| class="wikitable sortable" border="1"
|-
|-
−
! Name || Port:Addr || 10bit? || Speed || Max Retries || Retry Delay || Usage || Used by
+
! I2cDevice || Port:Addr || Is10bit || Speed || Max Retries || Retry Delay || Usage || Used by
|-
|-
| 0 || 0:52 || N || 100000 || 0 || 0 || DebugPadDriver || [[HID services]]
| 0 || 0:52 || N || 100000 || 0 || 0 || DebugPadDriver || [[HID services]]
|-
|-
−
| 1 || 2:49 || N || 400000 || 0 || 0 || STM touchscreen || [[HID services]]
+
| 1 || 2:49 || N || 400000 || 0 || 0 || TouchPanel || [[HID services]]
|-
|-
−
| 2 || 0:4c || N || 100000 || 0 || 0 || TI Temperature Sensor (tmp451) || [[PTM services]]
+
| 2 || 0:4c || N || 100000 || 0 || 0 || Temperature Sensor (TMP451 or NCT72) || [[PTM services]]
|-
|-
−
| 3 || 0:4c || N || 100000 || 0 || 0 || duplicate, unused entry? ||
+
| 3 || 0:4c || N || 100000 || 0 || 0 || Temperature Sensor (TMP451 or NCT72) (duplicate) ||
|-
|-
−
| 4 || 0:1c || N || 100000 || 0 || 0 || Audio codec (rt5639) || [[Audio services]], [[Fatal services]]
+
| 4 || 0:1c || N || 100000 || 0 || 0 || Audio Codec (ALC5639) || [[Audio services]], [[Fatal services]]
|-
|-
−
| 5 || 4:68 || N || 400000 || 3 || 5000000 || max77620_rtc0, max77620_irq0 || [[PCV services]]
+
| 5 || 4:68 || N || 400000 || 3 || 5000000 || PMIC RTC (max77620_rtc0), max77620_irq0 || [[PCV services]]
|-
|-
−
| 6 || 4:3c || N || 400000 || 3 || 5000000 || PMIC (max77620), max77620_irq0 || [[PCV services]]
+
| 6 || 4:3c || N || 400000 || 3 || 5000000 || PMIC (MAX77620), max77620_irq0 || [[PCV services]]
|-
|-
−
| 7 || 4:1b || N || 400000 || 3 || 5000000 || max77621_cpu || [[PCV services]]
+
| 7 || 4:1b || N || 400000 || 3 || 5000000 || Sub-PMIC for CPU (max77621_cpu) || [[PCV services]]
|-
|-
−
| 8 || 4:1c || N || 400000 || 3 || 5000000 || max77621_gpu || [[PCV services]]
+
| 8 || 4:1c || N || 400000 || 3 || 5000000 || Sub-PMIC for GPU (max77621_gpu) || [[PCV services]]
|-
|-
−
| 9 || 0:6b || N || 100000 || 3 || 5000000 || TI Charger (bq24192) || [[PTM services]]
+
| 9 || 0:6b || N || 100000 || 3 || 5000000 || Charger IC (BQ24193) || [[PTM services]]
|-
|-
−
| 10 || 0:36 || N || 100000 || 3 || 5000000 || Maxim Fuel Gauge (max17050) || [[PCV services]], [[PTM services]]
+
| 10 || 0:36 || N || 100000 || 3 || 5000000 || Fuel Gauge IC (MAX17050) || [[PCV services]], [[PTM services]]
|-
|-
−
| 11 || 0:18 || N || 100000 || 3 || 5000000 || USB-PD controller (rohm bm92t36) || [[USB services]]
+
| 11 || 0:18 || N || 100000 || 3 || 5000000 || USB-PD controller (RHOM BM92T30MWV) || [[USB services]]
|-
|-
−
| 12 || 1:40 || N || 400000 || 3 || 5000000 || ||
+
| 12 || 1:40 || N || 400000 || 3 || 5000000 || Power Monitor (ina226_V_VDD15V0-HB) || Factory testing
|-
|-
−
| 13 || 1:41 || N || 400000 || 3 || 5000000 || ||
+
| 13 || 1:41 || N || 400000 || 3 || 5000000 || Power Monitor (ina226_V_VSYS-CPU-DS) || Factory testing
|-
|-
−
| 14 || 1:44 || N || 400000 || 3 || 5000000 || ||
+
| 14 || 1:44 || N || 400000 || 3 || 5000000 || Power Monitor (ina226_V_VSYS-GPU-DS) || Factory testing
|-
|-
−
| 15 || 1:45 || N || 400000 || 3 || 5000000 || ||
+
| 15 || 1:45 || N || 400000 || 3 || 5000000 || Power Monitor (ina226_V_VSYS-DDR-DS) || Factory testing
|-
|-
−
| 16 || 1:46 || N || 400000 || 3 || 5000000 || ||
+
| 16 || 1:46 || N || 400000 || 3 || 5000000 || Power Monitor (ina226_V_VSYS-AP) || Factory testing
|-
|-
−
| 17 || 1:47 || N || 400000 || 3 || 5000000 || ||
+
| 17 || 1:47 || N || 400000 || 3 || 5000000 || Power Monitor (ina226_V_VSYS-BL-DS) || Factory testing
|-
|-
−
| 18 || 1:29 || N || 400000 || 3 || 5000000 || rohm ambient light sensor (bh1730fvc) || [[Backlight services]]
+
| 18 || 1:29 || N || 400000 || 3 || 5000000 || Ambient Light Sensor (BH1730) || [[Backlight services]]
|-
|-
−
| 19 || 1:48 || N || 400000 || 3 || 5000000 || ||
+
| 19 || 1:48 || N || 400000 || 3 || 5000000 || Power Monitor (ina226_CORE) || Factory testing
|-
|-
−
| 20 || 1:49 || N || 400000 || 3 || 5000000 || ||
+
| 20 || 1:49 || N || 400000 || 3 || 5000000 || Power Monitor (ina226_Soc-1V8) || Factory testing
|-
|-
−
| 21 || 1:4a || N || 400000 || 3 || 5000000 || ||
+
| 21 || 1:4a || N || 400000 || 3 || 5000000 || Power Monitor (ina226_LPDDR4-1V8) || Factory testing
|-
|-
−
| 22 || 1:4b || N || 400000 || 3 || 5000000 || ||
+
| 22 || 1:4b || N || 400000 || 3 || 5000000 || Power Monitor (ina226_REG1V32) || Factory testing
|-
|-
−
| 23 || 1:4d || N || 400000 || 3 || 5000000 || ||
+
| 23 || 1:4d || N || 400000 || 3 || 5000000 || Power Monitor (ina226_VDD3V3-SYS) || Factory testing
|-
|-
−
| 24 || 3:50 || N || 100000 || 0 || 0 || DisplayHdmiHotplugHandler || [[NV services]]
+
| 24 || 3:50 || N || 100000 || 0 || 0 || HDMI DDC || [[NV services]]
|-
|-
−
| 25 || 3:54 || N || 100000 || 0 || 0 || DisplayHdmiHotplugHandler || [[NV services]]
+
| 25 || 3:54 || N || 100000 || 0 || 0 || HDMI SCDC || [[NV services]]
|-
|-
| 26 || 3:3a || N || 100000 || 0 || 0 || DisplayHdmiHotplugHandler || [[NV services]]
| 26 || 3:3a || N || 100000 || 0 || 0 || DisplayHdmiHotplugHandler || [[NV services]]
|}
|}
−
This table is believed to be complete - entries with empty "Used by" column haven't been seen being used (devices not present on switch?).
+
== OpenSessionForDev ==
+
Takes an u32 '''port''', an u16 '''addr''', an '''AddressingMode''' (1 for 10-bit, 0 otherwise) and a '''SpeedMode''' (400000 or 100000). Returns a [[#II2cSession]] session.
+
+
== OpenSession ==
+
Takes an '''I2cDevice''' and returns a [[#II2cSession]] session for it.
+
+
== HasDevice ==
+
Takes an '''I2cDevice''' and returns true if the device exists or false otherwise.
+
+
== HasDeviceForDev ==
+
Takes an u32 '''port''', an u16 '''addr''', an '''AddressingMode''' (1 for 10-bit, 0 otherwise) and a '''SpeedMode''' (400000 or 100000). Returns true if the device exists or false otherwise.
== II2cSession ==
== II2cSession ==
Line 403:
Line 417:
|-
|-
| 7 ||
| 7 ||
−
|-
|}
|}
Line 420:
Line 433:
|-
|-
| 3 || UART-C || Joycon(L)
| 3 || UART-C || Joycon(L)
−
|-
|}
|}