I2C HID 与 RK3588 设备树
1. 分层
1 | i2c-hid-of / of-elan / of-goodix / acpi |
RK3588 使用 Device Tree,主入口是 CONFIG_I2C_HID_OF;Elan/Goodix 特殊电源时序需要对应 OF glue。
本树 rk3588*.dts(i) 中未检索到标准 compatible = "hid-over-i2c" 节点;tablet 文件出现的 chip_type = <0x01> /* HID IIC */ 属于其它厂商触控驱动属性,不能据此认定它走通用 i2c-hid-of。本章说明的是可用框架和新增标准 HID-I2C 设备时的接入方式。
2. Probe
OF glue 解析:
- HID descriptor register 地址;
- IRQ;
- reset GPIO;
- regulator;
- post-power-on delay;
- wakeup。
随后调用 I2C HID core:
1 | power_up |
3. HID descriptor
I2C HID descriptor给出:
- report descriptor length/register;
- input/output register;
- command/data register;
- max input/output length;
- VID/PID/version。
这些字段来自不可信外设,core 会做长度和寄存器边界检查。
4. 输入中断
1 | GPIO IRQ threaded handler |
I2C transaction 可睡眠,因此使用 threaded IRQ。IRQ polarity/type 由 DT 和 controller 配置。
5. Output/Feature
i2c_hid_set_or_send_report() 根据 report type、ID 和长度生成命令:
- GET_REPORT;
- SET_REPORT;
- RESET;
- SET_POWER;
- 直接 output register 写入。
大 report 需按 descriptor 的 max output length 分配 buffer。
6. Start/open
i2c_hid_start() 根据已解析 report 重新计算最大包并分配 buffers。i2c_hid_open() 清屏蔽状态并允许 IRQ;close 可停止输入,但 wakeup/quirk 可能保留硬件。
7. Reset/PM
i2c_hid_execute_reset();i2c_hid_hwreset();- power sleep/on 命令;
- regulator/GPIO power cycle;
- suspend 时 disable IRQ 或 enable IRQ wake;
- resume 时重新上电、reset、恢复 driver。
触控屏恢复后无响应,常见原因是 reset delay、IRQ 状态、电源时序或 I2C controller runtime PM。
8. DT 示例
1 | touchscreen@xx { |
通用 hid-over-i2c binding 不允许 reset-gpios;需要复位时应使用本树已有的 Elan/Goodix 专用 compatible/binding,或为具体芯片补充合规 binding,不能把任意属性塞进通用节点。属性以本树 binding 为准。
9. RK3588 排查
1 | i2cdetect -y BUS # 对活跃触控设备谨慎 |
不要在驱动已绑定时反复用 i2cget/i2cdump 干扰协议状态。
正在加载留言…