0

I have a touchscreen that the touch pad doesn't work. It uses i2c.

This is the driver: goodix.c.

This is how I should add the node to the device tree: goodix.txt

This is the device tree: imx6qdl-sb-fx6.dtsi

And this is the node that I put as child of /i2cmux/i2c@0:

            gt9271@XX {
                compatible = "goodix,gt9271";
#if GOODIX_5D
                reg = <0x5d>;
#else
                reg = <0x14>;
#endif
                interrupt-parent = <&gpio1>;
                interrupts = <4 0>;
                irq-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
                reset = <&pca9555 11 GPIO_ACTIVE_LOW>; 
            };

The driver loads correctly:

root@cm-fx6:~# dmesg | grep Goodix
[    4.811992] Goodix-TS 3-0014: ID 9271, version: 1020
[    4.828035] Goodix-TS 3-0014: Invalid config, using defaults
[    4.832665] input: Goodix Capacitive TouchScreen as /devices/soc0/soc/2100000.aips-bus/21a0000.i2c/i2c-0/i2c-3/3-0014/input/input0

But there are no interrupts generation when I touch. The initialization phase (check goodix_reset function) is neither performed as it should. This is what I should see (with an oscilloscope) during power on: https://i.stack.imgur.com/Tpp2f.jpg. But INT and RESET pins remain HIGH at all time.

I've wrote reset instead of reset-gpios as described on the documentation because otherwise I get error trying to get the pin. The error is -16 which means the resource is busy, because pca9555 11 is being used by another device too (check mipi-dsi-reset node). Btw, pca9555 is an auxiliary gpio controller.

Any clue on what is happening and why the pins don't act like the driver dictates? It has been already discarded to be a connection problem: if I don't load the driver and try to set gpio4 to 1 or 0 I see it reflected on the pin (both sides).

anat0lius
  • 59
  • 2
  • so you connected two devices to one GPIO? – user3528438 Jan 28 '17 at 12:28
  • 1
    After just the first 4 lines, it's clear this is a software problem, not about electrical engineering. This question should be closed, but the system won't allow that while there is a open bounty. – Olin Lathrop Jan 30 '17 at 11:58
  • @OlinLathrop Fantastic. Got the same response on stackoverflow.com – anat0lius Jan 30 '17 at 12:02
  • Then you need to write a better question. If there is some electronics you want to ask about here, then loose all the software blah blah. Like I said, I tuned out after the first 4 lines. – Olin Lathrop Jan 30 '17 at 12:12
  • 1
    I agree that is about software. I don't understand why from stackoverflow wanted me to move the question here. – anat0lius Jan 30 '17 at 12:15
  • 2
    @LiLou_ You should speak to SO moderators about this, I think they made a mistake migrating your question here. You don't see anything on the scope, which means electrical issues with the touchscreen are ruled out. What remains is software and hardware on your host, which you didn't even describe (is it a Colibri iMX6? one of the Freescale boards? Nobody knows) Freescale questions might even be on topic here, but then the question should read "i2c bus on my board won't work", not "touch screen not responding" – Dmitry Grigoryev Jan 30 '17 at 13:10

2 Answers2

0

If the GPIO pin is used by another device, you will get such device busy error. Check whether any other device is using it.

You can try either of the following :

Do not load the other driver that uses the GPIO that you are currently trying to use in your touchscreen driver by either not including the other driver at all or remove the other driver related information from device tree (dtsi) or Use an alternate GPIO pin for your touchscreen that is not used for other purposes while you use the touchscreen.

  • If I try to comment out mipi-dsi-reset node then I provoke i2c failure. So I need it. But anyway, why I'm not seeing INT pin responding to my touches? gpio1 4 is not being used by nobody. – anat0lius Jan 29 '17 at 12:16
0

Got it with a workaround.

With this device tree node:

    gt9271@XX {
        compatible = "goodix,gt9271";
        reg = <0x14>;
        interrupt-parent = <&gpio1>;
        interrupts = <4 0>;
        irq-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
        resets = <&lcd_reset>; 
    };

    //...

    lcd_reset: mipi_dsi_reset: mipi-dsi-reset {
        compatible = "gpio-reset";
        reset-gpios = <&pca9555 11 GPIO_ACTIVE_LOW>;
        reset-delay-us = <10000>;  //I've increased it from 100 to 10000us
        gpio-can-sleep;
        #reset-cells = <0>;
   };

On the driver use device_reset() from reset.h instead of manually controlling the reset pin.

/**
 * goodix_reset - Reset device during power on
 *
 * @ts: goodix_ts_data pointer
 */
static int goodix_reset(struct goodix_ts_data *ts)
{
    int error;

    /* begin select I2C slave addr */
    // error = gpiod_direction_output(ts->gpiod_rst, 0);
    error = device_reset(&ts->client->dev);

This means to comment out the part where it tries to get reset-gpios from the device tree (see goodix_get_gpio_config() and all the ts->gpiod_rst references too.

anat0lius
  • 59
  • 2