首页 > 解决方案 > Linux 设备树:触摸控制器未通过 i2c 测试

问题描述

语境

我正在使用带有 Goodix 9271 触摸屏显示器的 i.MX6 ULL 应用处理器。显示器已添加到设备树中并且工作正常。我现在想添加触摸控制器,它通过 I²C 连接到我的应用处理器。因此我补充说

  1. 我的 I²C 节点下的一个新节点将控制器添加为总线上的设备。
  2. 用于应用处理器与触摸控制器接口的新引脚控制组

我在这里列举了它们:

/* #1: Device node on the I2C bus */
&i2c1 {
    clock_frequency = <100000>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_i2c1>;
    status = "okay";

    /* Awesome new touch controller */
    gt9271_ts@5d {
        compatible = "goodix,gt9271";          /* Device tree binding */ 
        reg = <0x5d>;                          /* I2C bus address */
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_gt9271_ts_gpio>; /* Custom pinctrl group node */
        interrupt-parent = <&gpio4>;
        interrupts = <16,0>;                   /* GPIO 4 + pin 16 + active high */       
        reset-gpios = <&gpio4 12 0>;           /* GPIO 4 + Pin 12 + active high */
        touchscreen-size-x = <1200>;
        touchscreen-size-y = <800>;
        touchscreen-inverted-x;
        touchscreen-inverted-y;
    };

    /* ... */
};

/* #2: Pin control group */
&iomuxc {

    pinctrl_gt9271_ts_gpio: gt9271_ts_gpiogrp {
        fsl,pins = <
            MX6UL_PAD_NAND_DQS__GPIO4_IO16        0x80000000 /* Interrupt */
            MX6UL_PAD_NAND_READY_B__GPIO4_IO12    0x80000000 /* Reset */
        >;
    };

    /* ... */
};

解释:总线地址

此处提供的器件数据表表明支持两个从地址:0xBA/0xBB0x28/0x29。设备设置为使用0xBA/0xBB调整后的 7 位寻址,如此绑定中建议的那样,(因此在节点中分配的地址实际上是0x5d)。

说明:控制引脚

I²C 复位和中断(分别)连接到 GPIO 4、引脚 16 和 GPIO 4、引脚 12。这些是为 NAND 保留的,但 NAND 未与该处理器一起使用,因此这些引脚是空闲的。

问题

不幸的是,我添加的触摸屏控制器配置在启动时失败,并显示 I²C 相关消息。我在启动时受到以下欢迎:

[    2.118110] Goodix-TS 0-005d: 0-005d supply AVDD28 not found, using dummy regulator
[    2.126059] Goodix-TS 0-005d: 0-005d supply VDDIO not found, using dummy regulator
[    2.134510] Goodix-TS 0-005d: i2c test failed attempt 1: -6
[    2.177733] Goodix-TS 0-005d: i2c test failed attempt 2: -6
[    2.217377] Goodix-TS 0-005d: I2C communication failure: -6

我试图搜索错误代码 (-6),但在网上发现稀疏到不存在的搜索结果。我已经检查过连接器是否在物理上,并且似乎是。

我可以采取哪些步骤来诊断此类错误代码?

标签: embedded-linuxi2cdevice-tree

解决方案


解决方法如下:

  1. 文档指出我应该在格式中包含该属性irq-gpios。我以前以为我只需要这个interrupts属性。添加后irq-gpios = <&gpio4 16 0>;,设备通过了I2C测试。
  2. 我禁用了touchscreen-inverted-x;, 并touchscreen-inverted-y;删除了这些行。我错误地认为我最初需要这样做。

判决:

尝试准确地遵循文档。


推荐阅读