RK3588 GPIO、中断与 Debounce
1. GPIO banks
| Bank | MMIO | Parent IRQ | Pinctrl offset |
|---|---|---|---|
| GPIO0 | fd8a0000 |
SPI 277 | 0 |
| GPIO1 | fec20000 |
SPI 278 | 32 |
| GPIO2 | fec30000 |
SPI 279 | 64 |
| GPIO3 | fec40000 |
SPI 280 | 96 |
| GPIO4 | fec50000 |
SPI 281 | 128 |
每 bank有 PCLK和 DBCLK。
2. GPIO path
1 | gpiod_get |
Rockchip没有启用 pinmux strict;方向设置若发现非GPIO mux owner会首次 WARN后仍切到 mux 0。
GPIO flags中的 ACTIVE_LOW由 descriptor层转换,不改变 mux。
3. IRQ path
1 | bank parent IRQ |
Bank作为 interrupt-controller,子设备使用 <pin IRQ_TYPE_*>。
4. Trigger
支持level high/low、edge rising/falling和both edge。RK3588使用GPIO V2寄存器并具有原生int_bothedge;旧GPIO版本才通过切换polarity模拟双边沿。
5. Debounce
GPIO V2硬件存在DBCLK、divider和debounce寄存器,但本树 rockchip_gpio_set_config(PIN_CONFIG_INPUT_DEBOUNCE)先关闭该pin debounce,随后明确返回 -ENOTSUPP,理由是硬件不能按单pin独立配置所需参数。因此普通gpiod debounce请求不会启用RK3588硬件滤波,需在consumer中做软件消抖或采用外部电路。
6. Wake
IRQ wake沿 parent hierarchy传播。Suspend保存 mask,wake pins保持输入和正确 pull。
7. Direction与Mux
请求 GPIO前必须保证没有 active peripheral owner。gpio-hog、regulator、reset GPIO、IRQ consumer都可能占 line。
8. Deferred output
Rockchip结构含 deferred output机制,处理 pinctrl先于 GPIO bank probe时的 output配置,待 bank可用后执行。
9. 用户态
1 | gpioinfo |
被 kernel consumer占用的 line不应强抢。
10. IRQ调试
1 | cat /proc/interrupts | grep -i gpio |
中断风暴常由 floating、错误 polarity、未清 pending或 sleep mux改变引起。
正在加载留言…