# GPIO 功能 - 顶层模式复用器 (TLMM)

硬件通过顶层模式复用器 (TLMM) 控制通用输入/输出 (GPIO) 和备用功能的复用。您可以使用 TLMM 的 DT 属性在引导过程中配置 GPIO。

您可以编辑以下文件路径来更新 Linux 主机 PC 上的属性：

- `/boot_images/boot/Settings/Soc/<Chipset>/Core/SocInfra/TLMM/<Chipset>-pinctrl.dtsi`
- `/boot_images/boot/Settings/Soc/<Chipset>/Core/SocInfra/TLMM/tlmm.dtsi`

下表列出了如何根据 Qualcomm 参考设备要求配置 GPIO 默认值的属性。

表：TLMM DT 属性

| 属性名称 | 属性描述 | 数据类型 | 可能的值/取值范围 | 设备行为 |
| --- | --- | --- | --- | --- |
| QCOM, sleep-config | `<Chipset>-pinctrl.dtsi` 中定义了 GPIO 的配置设置。这些配置将在设备启动时应用。 | UINT32 | 引脚方向：<br><br><br><br>> <br>> <br>> <ul class="simple"><br>> <li><p><code class="docutils literal notranslate"><span class="pre">GPIO_INPUT</span></code> – 0x1</p></li><br>> <li><p><code class="docutils literal notranslate"><span class="pre">GPIO_OUTPUT</span></code> – 0x2</p></li><br>> </ul><br><br><br><br>引脚上下拉配置：<br><br><br><br>> <br>> <br>> <ul class="simple"><br>> <li><p><code class="docutils literal notranslate"><span class="pre">GPIO_PULL_DOWN</span></code> – 0x4</p></li><br>> <li><p><code class="docutils literal notranslate"><span class="pre">GPIO_PULL_UP</span></code> – 0x8</p></li><br>> <li><p><code class="docutils literal notranslate"><span class="pre">GPIO_NO_PULL</span></code> – 0x10</p></li><br>> <li><p><code class="docutils literal notranslate"><span class="pre">GPIO_KEEPER</span></code> – 0x20</p></li><br>> </ul><br><br><br><br>引脚输出：<br><br><br><br>> <br>> <br>> <ul class="simple"><br>> <li><p><code class="docutils literal notranslate"><span class="pre">GPIO_OUT_LOW</span></code> – 0x40</p></li><br>> <li><p><code class="docutils literal notranslate"><span class="pre">GPIO_OUT_HIGH</span></code> – 0x80</p></li><br>> <li><p><code class="docutils literal notranslate"><span class="pre">GPIO_PRG_YES</span></code> – 0x100</p></li><br>> <li><p><code class="docutils literal notranslate"><span class="pre">GPIO_PRG_NO</span></code> – 0x000</p></li><br>> </ul> | <ul><br><li><p>默认值为 <code class="docutils literal notranslate"><span class="pre">GPIO_INPUT</span></code>。</p><ul class="simple"><br><li><p>GPIO_INPUT：允许读取输入引脚的状态。</p></li><br><li><p>GPIO_输出：控制输出引脚的状态。</p></li><br></ul><br></li><br><li><p>默认值为 <code class="docutils literal notranslate"><span class="pre">GPIO_PULL_DOWN</span></code>。</p><ul class="simple"><br><li><p>GPIO_PULL_DOWN：逻辑 0，视为接地。</p></li><br><li><p>GPIO_PULL_UP：逻辑 1，连接到 Vdd 电源。</p></li><br><li><p>GPIO_NO_PULL：Float/高阻状态。</p></li><br><li><p>GPIO_保持器：保持 GPIO 之前的状态。当 SoC 进入最深度省电模式时，将应用此配置。</p></li><br></ul><br></li><br><li><p>默认值为 <code class="docutils literal notranslate"><span class="pre">GPIO_OUT_LOW</span></code>。</p><br><p><code class="docutils literal notranslate"><span class="pre">GPIO_OUT_HIGH</span></code>：逻辑高电平，视为连接到 <code class="docutils literal notranslate"><span class="pre">Vdd</span></code>。</p><br></li><br><li><p>默认值为 <code class="docutils literal notranslate"><span class="pre">GPIO_PRG_NO</span></code>。</p><br><p>GPIO_PRG_YES：确保任何未使用的 GPIO 在启动后保持低功耗状态。</p><br></li><br></ul><br><br>例如，`(GPIO_INPUT | GPIO_PULL_DOWN | GPIO_OUT_LOW | GPIO_PRG_NO) /* PIN 10 */`。 |
| Compatible | 兼容属性包含一个指向兼容芯片组的只读字符串。 | 字符串 | – | 例如，`compatible = "qcom,<chipset>-pinctrl"`。 |
| reg | 表示只读 GPIO 基址和大小。 | UINT32 | \_ | 在 `reg` 属性元组中，第一个索引包含基址，第二个索引包含大小。例如，`reg = <0xf100000 0x100000>;`。 |
| ngpios | 芯片组中只读 GPIO 引脚的数量。 | UINT32 | – | 例如，`ngpios = <175>;`。 |
| width | 每个 GPIO 引脚均有自己的一组只读控制寄存器。宽度表示引脚到引脚的寄存器偏移量。 | – | – | 例如，`width = <0x1000>;`。 |
| id | 只读 GPIO 接插口 ID 的硬件实例。 | UINT32 | – | 例如，`id = <0x0>;`。 |
| version | GPIO 只读驱动程序版本。驱动程序 1.0 记为 0x1。 | UINT32 | – | 例如，`version = <0x1>;`。 |
| gpio-controller | 标识符用于将只读连接设备表示为 GPIO 设备。 | 字符串 | – | – |
| phandles | 用于配置 GPIO 备选功能的多路复用配置。如需了解更多信息，请参阅[引脚说明](https://docs.qualcomm.com/bundle/80-23889-1/resource/80-23889-1_REV_AM_QCS6490_QCS5430_Data_Sheet.pdf)。 | – | `sdc4_data_1: sdc4_data_1 { mux = <13 3>; };` | 启动时，GPIO 配置为 GPIO 的备用功能。<br><br><br>例如，`sdc4_data_1: sdc4_data_1 { mux = <13 3> };`。<br><br><br>在此示例中，13 指的是 GPIO 编号，3 表示备选功能选择。 |

Last Published: Dec 07, 2025

[Previous Topic
PMIC](https://docs.qualcomm.com/bundle/publicresource/80-70022-4SC/topics/pmic-developer-touchpoints.md) [Next Topic
总线](https://docs.qualcomm.com/bundle/publicresource/80-70022-4SC/topics/buses.md)