Linux 设备树:触摸控制器未通过 i2c 测试

Linux Device Tree: Touch controller failing i2c test

上下文

我正在使用带有 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 */
        >;
    };

    /* ... */
};

解释:总线地址

设备数据sheet,可用here, indicates that two slave addresses are supported: 0xBA/0xBB and 0x28/0x29. The device is set to use 0xBA/0xBB adjusted for 7-bit addressing as recommended in this binding,(所以节点中分配的地址实际上是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),但在网上找到的搜索结果很少甚至不存在。我已经检查过连接器确实存在,而且看起来确实存在。

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

解决方法如下:

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

判决:

尽量严格按照文档进行操作。