# GPIO registers configuration

Source: [https://docs.qualcomm.com/doc/80-88500-4/topic/20_GPIO_registers_configuration.html](https://docs.qualcomm.com/doc/80-88500-4/topic/20_GPIO_registers_configuration.html)

The GPIO control registers are part of the top-level mode multiplexer (TLMM) controller
    in the SOC architecture. The TLMM\_GPIO\_CFGn registers control the configuration of
    GPIOs.

The table lists the bitfields of the TLMM\_GPIO\_CFGn registers.

Table : TLMM_GPIO_CFGn register bitfield

| Bit | Name | Description |
| --- | --- | --- |
| 31:11 | Reserved | Reserved field |
| 10 | GPIO\_HIHYS\_EN | Controls the hihys\_en for GPIO[n]<br><br><ul class="ul"><li class="li">0 – Disable</li><br><li class="li">1 – Enable</li><br></ul> |
| 9 | GPIO\_OE | Controls the output enable (OE) for GPIO[n] when GPIO[n] is in GPIO mode<br><br><ul class="ul"><li class="li">0 – Input  </li><br><li class="li">1 – Output</li><br></ul> |
| 8:6 | DRV\_STRENGTH | Controls the GPIO pad drive strength; the drive strength applies regardless of the FUNC\_SEL field selection.<br><br><ul class="ul"><li class="li">000 – 2 mA</li><br><li class="li">001 – 4 mA</li><br><li class="li">010 – 6 mA</li><br><li class="li">011 – 8 mA</li><br><li class="li">100 – 10 mA</li><br><li class="li">101 – 12 mA</li><br><li class="li">110 – 14 mA</li><br><li class="li">111 – 16 mA</li><br></ul> |
| 5:2 | FUNC\_SEL | Controls the function of the GPIO pad (many GPIO pads have one or more functional hardware interfaces behind them).<br><br><br>Set this field to the appropriate value for the required function. When this field is set to 0, the pad is in GPIO mode.<br><br><br>For a list of alternate functions, see <cite class="cite">QRB5165 Pin Assignment and GPIO<br>                  Configuration Spreadsheet</cite>(80-PV086-1A). |
| 1:0 | GPIO\_PULL | Controls the pull of a GPIO pad. GPIO pads can be configured to employ an internal weak pull up, pull down, keeper, or no-pull function. The pull applies regardless of the FUNC\_SEL field selection.<br><br><ul class="ul"><li class="li">00 – No pull</li><br><li class="li" id="GPIO_registers_configuration_20__li__Hlk129776323">01 – Pull down (PD)</li><br><li class="li">10 – Keeper</li><br><li class="li">11 – Pull up (PU)</li><br></ul> |

Table : TLMM_GPIO_LP_CFGn bitfield. The TLMM_GPIO_LP_CFGn registers are used to store the low-power configuration of GPIOs.
        These registers are initialized during boot. When the driver invokes the TLMM API to place a
        GPIO into an inactive state, the configuration data stored in this register is retrieved and
        written to the TLMM_GPIO_CFGn register.

| Bits | Name | Description |
| --- | --- | --- |
| 31:12 | Reserved | Reserved field |
| 11:0 | GPIO\_LP\_CFG | Stores the low-power configuration of GPIO n. |

## Input and output

When the FUNC\_SEL bit of a GPIO is set to 0, the GPIO is used as a general-purpose pin, and it can be used as input or output.

The GPIO\_OE bit of the TLMM\_GPIO\_CFGn register controls the direction.

- When this bit is set to 1, the pin is used as an output pin. If the bit is set to 0, the pin is used as an input pin.
- When a GPIO is set as output, bit 1 of the TLMM\_GPIO\_IN\_OUTn register controls its state. When set as input, the state of a GPIO can be read from bit 0 in the same register.

The table lists the bitfields of the TLMM\_GPIO\_IN\_OUTn register.

Table : TLMM_GPIO_IN_OUTn register bitfield

| Bit | Name | Description |
| --- | --- | --- |
| 31:2 | Reserved | Reserved field |
| 1 | GPIO\_OUT | Controls the output state of an output pin<br><ul class="ul"><li class="li">0 – Low </li><br><li class="li">1 – High</li><br></ul> |
| 0 | GPIO\_IN | Reads the state of an input pin |

## Interrupt

All GPIOs can be set up as interrupt sources. The registers TLMM\_GPIO\_INTR\_CFGn, 
n = 0…179 control the GPIO interrupt functionality.

Table :  TLMM_GPIO_INTR_CFGn register bitfield

| Bit | Name | Description |
| --- | --- | --- |
| 31:9 | Reserved | Reserved field |
| 8 | DIR\_CONN\_EN | Determines the TLMM that GPIO[n] uses as a direct connect interrupt. The values are:<br><ul class="ul"><li class="li">0 – Disable; disables the GPIO as a direct connect interrupt</li><br><li class="li">1 – Enable; enables the GPIO as a direct connect interrupt</li><br></ul> |
| 7:5 | TARGET\_PROC | Determines to which processor a summary interrupt from GPIO[n] is routed<br><ul class="ul"><li class="li">0x0 – SENSORS; routes the GPIO signal to the SENSORS summary interrupt </li><br><li class="li">0x1 – LPA_DSP; routes the GPIO signal to the LPASS summary interrupt</li><br><li class="li">0x2 – RPM; routes the GPIO signal to the RPM summary interrupt</li><br><li class="li">0x3 – HMSS; routes the GPIO signal to the HMSS summary interrupt</li><br><li class="li">0x4 – GSS; routes the GPIO signal to the GSS summary interrupt</li><br><li class="li">0x5 – TZ; routes the GPIO signal to the TrustZone summary interrupt</li><br><li class="li">0x7 – None; does not route the GPIO signal to any processor subsystem (default)</li><br></ul> |
| 4 | INTR\_RAW\_STATUS\_EN | Enables the RAW status for the summary interrupt on GPIO[n]. This field is a power-saving mechanism. Leave this bit disabled unless it is required. The values are:<br><ul class="ul"><li class="li">0 – Disable</li><br><li class="li">1 – Enable</li><br></ul> |
| 3:2 | INTR\_DECT\_CTL | Controls the edge or level detection of the interrupt controller.<br><br><br>The values are:<br><ul class="ul"><li class="li">00 – Level</li><br><li class="li">01 – Positive edge</li><br><li class="li">10 – Negative edge</li><br><li class="li">11 – Dual edge</li><br></ul> |
| 1 | INTR\_POL\_CTL | Controls the polarity detection of the interrupt controller.<br><br><br>The values are:<br><ul class="ul"><li class="li">0 – Polarity 0; active low</li><br><li class="li">1 – Polarity 1; active high</li><br></ul> |
| 0 | INTR\_ENABLE | Controls whether GPIO[n] generates a summary interrupt. The values are:<br><ul class="ul"><li class="li">0 – Disable</li><br><li class="li">1 – Enable</li><br></ul> |

The INTR\_POL\_CTL and INTR\_DETC\_CTL bitfields control the trigger type of an interrupt. Setting or clearing the INTR\_ENABLE field enables or disables the corresponding GPIO interrupt.

The interrupt status is recorded in the TLMM\_GPIO\_INTR\_STATUSn, n = 0…179 registers.

Table : TLMM_GPIO_INTR_STATUS n register bitfield

| Bit | Name | Description |
| --- | --- | --- |
| 31:1 | Reserved | Reserved field |
| 0 | INTR\_STATUS | When read, returns the interrupt status of GPIO[n]<br><ul class="ul"><li class="li">0 – The interrupt is not active</li><br><li class="li">1 – The interrupt is active</li><br></ul><br><br>When written, clears or sets the interrupt for GPIO[n]<br><ul class="ul"><li class="li">0 – Clear the interrupt</li><br><li class="li">1 – Set the interrupt</li><br></ul> |

**Parent Topic:** [GPIO pad configuration](https://docs.qualcomm.com/doc/80-88500-4/topic/19_Hardware_overview.html)

Last Published: Aug 18, 2023

[Previous Topic
GPIO pad configuration](https://docs.qualcomm.com/bundle/publicresource/80-88500-4/topics/19_Hardware_overview.md) [Next Topic
GPIO software driver code overview](https://docs.qualcomm.com/bundle/publicresource/80-88500-4/topics/21_Software_overview.md)