tsc2046 (/ads7846) on imx6 "no irq" problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

tsc2046 (/ads7846) on imx6 "no irq" problem

3,555 Views
kartiknatarajan
Contributor II

I have some trouble in getting the spi tsc2046 (ads7846 based) touchscreen(TS) controller up.

Here are the details:

I have added the TS to my ecspi2 (and not spi?) . This is how the dts code looks.

                                ecspi2: ecspi@0200c000 {

                                         #address-cells = <1>;

                                         #size-cells = <0>;

                                         compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";

                                        reg = <0x0200c000 0x4000>;

                                         interrupts = <0 32 0x04>;

                                        clocks = <&clks 113>, <&clks 113>;

                                        clock-names = "ipg", "per";

                                        status = "disabled";

                                       /*added for touchscreen on SPI2*/

                                              ads7846@0 {

                                              compatible = "ti,ads7846";

                                              spi-max-frequency = <1000000>;

                                              reg = <0>;

                                              /* interrupt in round 2, first just check if ts gets identified */

                                              pendown-gpio = <&gpio3 19 0>;

                                              //interrupt-parent = <&gpio2>;

                                              interrupts = <83 0>;

                                        };

                                };

..

..

..

&ecspi2 {

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_ecspi2_1>;

fsl,spi-num-chipselects = <1>;

        cs-gpios = <&gpio2 26 0>;

        status = "okay";

};

..

..

..

        ecspi2 {

pinctrl_ecspi2_1: ecspi2grp-1 {

fsl,pins = <

MX6QDL_PAD_EIM_OE__ECSPI2_MISO 0x100b1

MX6QDL_PAD_EIM_CS1__ECSPI2_MOSI 0x100b1

                                MX6QDL_PAD_EIM_CS0__ECSPI2_SCLK 0x100b1

MX6QDL_PAD_EIM_RW__GPIO2_IO26 0x1b0b0            //added the chip select as an gpio pin.

                                MX6QDL_PAD_EIM_A25__ECSPI2_RDY  0x100b1

>;

                };

        };

But the touchscreen won't get probed so I added debugs to the touchscreen driver - drivers/input/touchscreen/ads7846.c only to find that the spi struct passed does not have sufficient information.

static int ads7846_probe(struct spi_device *spi)

{

                struct ads7846 *ts;

                struct ads7846_packet *packet;

                struct input_dev *input_dev;

                struct ads7846_platform_data *pdata = spi->dev.platform_data;

                unsigned long irq_flags;

                int err;

                if (!spi->irq) {

                                dev_dbg(&spi->dev, "no IRQ?\n");

                                return -ENODEV;              // code returns from here

                }

                ..

                ..

                ..

}

Isn't the driver (or in this case the kernel invoking the probe) supposed to get all the information from the dtb file?

Are the ecspi and spi considered as separate interfaces?

Labels (2)
0 Kudos
3 Replies

1,523 Views
ossian
Contributor III

Hello Kartik,

I don't know if you ever got your touch screen working, but I thought I would provide a little information on getting the ads7846 (TSC2046) driver up and running under yocto 1.6 (Daisy).

The first thing that I noticed is that in the Linux 3.10.17 distribution that is packaged with yocto 1.6 (first distribution that Freescale switched to the device tree configuration) does not appear to support device tree configuration hooks.

So, if using the ads7846 driver with yocto 1.6 and device tree you will need to patch the driver to support dt. Attached is a patch file that patches the ads7846 driver. Another addition that I included in the driver patch is the support for configurations without vcc-supply support. Under the default configuration it appears that a hook to a regulator was required.

https://community.freescale.com/docs/DOC-102802

Your dtsi file settings look similar to the settings I used,the following are the dtsi settings that worked for me to get things started:

Place the following in imx6qdl.dtsi (in the same location as the other ecspi settings):

ecspi2 {
pinctrl_ecspi2_1: ecspi2grp-1 {
fsl,pins = <
MX6QDL_PAD_EIM_OE__ECSPI2_MISO 0x100b1
MX6QDL_PAD_EIM_CS1__ECSPI2_MOSI 0x100b1

                                                                  MX6QDL_PAD_EIM_CS0__ECSPI2_SCLK 0x100b1

MX6QDL_PAD_EIM_RW__GPIO2_IO26 0x80000000         //added the chip select as a gpio pin.
>;

                };

};

Place the following sections in your specific board device configuration file, your GPIO values will be different depending on how your hardware is wired:

&ecspi2 {

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_ecspi2_1>;

  fsl,spi-num-chipselects = <1>;

        cs-gpios = <&gpio2 26 0>;

        status = "okay";

        /* added for touchscreen on SPI2 */

      ads7846@0 {

        compatible = "ti,tsc2046";

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_touch>;

              spi-max-frequency = <1000000>;

  /* vcc-supply = <0>; */

            reg = <0>; /* CS0 */

  interrupt-parent = <&gpio4>;

  interrupts = <5 0>;

        pendown-gpio = <&gpio4 5 0>;

    };

};

&iomuxc {

...

...

pinctrl_touch: touchgrp {

  fsl,pins = <

          MX6QDL_PAD_GPIO_19__GPIO4_IO05    0x0 /* IRQ */

      >;

  };

};

If things are working properly you should see something like the following in your system startup output:

ads7846 spi32766.0: touchscreen, irq 261

input: ADS7846 Touchscreen as /devices/soc0/soc.1/2000000.aips-bus/2000000.spba-bus/200c000.ecspi/spi_master/spi32766/spi32766.0/input/input0

Hopefully this helps get things up and running.

Ossian

0 Kudos

1,523 Views
fabio_estevam
NXP Employee
NXP Employee

You need to pass the GPIO that is connected to the ads7846 irq pin.

This mx27 board has a an example:

arch/arm/boot/dts/imx27-eukrea-mbimxsd27-baseboard.dts

0 Kudos

1,523 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

I have never used that driver, but after checking some examples I believe you are missing the interrupt-parent field in the dts.

For other devices for example with I2c other signal is used for wake up and it is configured as interrupt.

interrupt-parent = <&gpio2>;

You may want to try something similar either pointing to the intc, or ecspi2.

Please let me know how it goes.

Regards,

Alejandro

0 Kudos