AnsweredAssumed Answered

Add ad7879 touch screen support in imx6dl

Question asked by emmanuel perea on May 17, 2018
Latest reply on May 20, 2018 by igorpadykov

Hello,
I am working with a imx6 dual light digi board. I want to add Ad7879 touch support. I 've been followed the next steps:

 

-First I changed the kernel config file adding support fo touchscreen and ad7879. In kernel config file I 've made the following changes:

 

CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_AD7879=y
CONFIG_TOUCHSCREEN_AD7879_I2C=y

 

At the first I configured ad7879 as module doing:

 

CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_AD7879=m
CONFIG_TOUCHSCREEN_AD7879_I2C=m

 

After that I made the device initialization in the device tree.

 

In imx6qdl-ccimx6sbc.dtsi file I put the next:

 

&i2c3 {
    ...

 


    ad7879@2c {
         compatible = "adi,ad7879-1";
         reg = <0x2c>;
         interrupt-parent = <&gpio6>;
         interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
         touchscreen-max-pressure = <4096>;
         adi,resistance-plate-x = <120>;
        adi,first-conversion-delay = /bits/ 8 <3>;
         adi,acquisition-time = /bits/ 8 <1>;
        adi,median-filter-size = /bits/ 8 <2>;
         adi,averaging = /bits/ 8 <1>;
         adi,conversion-interval = /bits/ 8 <255>;

 

    ...
    
};

 

The ad7879 interrupt controller is conected to the imx6 in EXP_I2C_IRQ_N pin that is the GPIO_6_15, for that reason I put interrupt-parent = <&gpio6> and interrupts = <15 IRQ_TYPE_EDGE_FALLING>;.

 

In imx6qdl-ccimx6sbc.dts file I put:

 

&i2c3 {
    ...

 

    ad7879@2c {
        status ="okay";
    };
    ...
};

 

Then I followed with compile the linux image and device tree.
In the imx6 with the linux image that I configures the ad7879 as module I loaded the ad7879 modules doing this:
root:~> modprobe ad7879
root:~> modprobe ad7879-i2c
but there is not log messages abaout the ad7879 and there is no ad7879 node asociated.

 

If I check the device node to chek the device node:
root@ccimx6sbc: ls -la /dev/input/
drwxr-xr-x    4 root     root           180 Jan  1  2000 .
drwxr-xr-x   14 root     root          3480 May 16 14:49 ..
drwxr-xr-x    2 root     root            80 Jan  1  2000 by-id
drwxr-xr-x    2 root     root           120 Jan  1  2000 by-path
crw-rw----    1 root     input      13,  64 Jan  1  2000 event0
crw-rw----    1 root     input      13,  65 Jan  1  2000 event1
crw-rw----    1 root     input      13,  66 Jan  1  2000 event2
crw-rw----    1 root     input      13,  63 Jan  1  2000 mice
crw-rw----    1 root     input      13,  32 Jan  1  2000 mouse0

 

root@ccimx6sbc:# cat /sys/class/input/input0/name
da9063-onkey
root@ccimx6sbc:# cat /sys/class/input/input1/name
Genius 4D Scroll Mouse
root@ccimx6sbc:# cat /sys/class/input/input2/name
sgtl5000-audio Headphone Jack

 

You can see that there is no node asociated.

 

root@ccimx6sbc:# cat /proc/interrupts
           CPU0       CPU1       
 29:     140884      13795       GIC  29  twd
 34:        406          0       GIC  34  sdma
 35:          0          0       GIC  35  VPU_JPG_IRQ
 37:          1          0       GIC  37  2400000.ipu
 38:         12          0       GIC  38  2400000.ipu
 42:         28          0       GIC  42
 44:          0          0       GIC  44  VPU_CODEC_IRQ
 50:          0          0       GIC  50  vdoa
 51:          0          0       GIC  51  rtc alarm
 54:         52          0       GIC  54  mmc3
 55:         52          0       GIC  55  mmc1
 57:       3580          0       GIC  57  mmc0
 61:        353          0       GIC  61  21f0000.serial
 63:          0          0       GIC  63  2008000.ecspi
 69:        472          0       GIC  69  21a4000.i2c
 70:       1367          0       GIC  70  21a8000.i2c
 72:        109          0       GIC  72  2184200.usb
 75:          0          0       GIC  75  2184000.usb
 79:          0          0       GIC  79  202c000.ssi
 81:          0          0       GIC  81  imx_thermal
 87:        167          0       GIC  87  i.MX Timer Tick
112:          0          0       GIC 112  20bc000.wdog
134:          0          0       GIC 134  mipi_dsi
137:        466          0       GIC 137  2101000.jr0
138:          0          0       GIC 138  2102000.jr1
139:          0          0       GIC 139  mmdc_1
144:          0          0       GIC 144  mmdc_1
147:          0          0       GIC 147  20e0000.hdmi_video
150:      62234          0       GIC 150  2188000.ethernet
151:          0          0       GIC 151  2188000.ethernet
192:          0          0  gpio-mxc   0  headphone detect
364:          1          0  gpio-mxc  12  da9063-irq
413:          0          1  da9063-irq   3  HWMON
414:          0          0  da9063-irq   0  ONKEY
415:          0          0  da9063-irq   1  ALARM
IPI0:          0          0  CPU wakeup interrupts
IPI1:          0         58  Timer broadcast interrupts
IPI2:       1405       2387  Rescheduling interrupts
IPI3:          0          0  Function call interrupts
IPI4:         19         33  Single function call interrupts
IPI5:          0          0  CPU stop interrupts
IPI6:        426        476  IRQ work interrupts
IPI7:          0          0  completion interrupts
Err:          0

 

You can se that there is not interrupts asociated to ad7879.

 

There is no difference when I build the linux kernel with this configuration:
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_AD7879=y
CONFIG_TOUCHSCREEN_AD7879_I2C=y

 

I did run dmesg and there is no log entries associated with ad7879.

 

In the imx6 linux I did the following commands:

 

>root@ccimx6sbc:i2cdetect 2
with this response:

 

WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-2.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- UU -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- 2c -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --    

 

If you can see the identifier of the device is detected (0x2c).

 

Then I made:

 

>root@ccimx6sbc: i2cdump -r 0-0x40 2 0x2c

 

With this response:

 

No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-2, address 0x2c, mode byte
Probe range limited to 0x00-0x40.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 40 00 00 00 00 00 00 00 00 00 00 00 03 00    ..@...........?.
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
40: 00   

 

You can se in 0x02 and 0x0e are two of the default values for the registers of ad7879 and they are correct. So I concluded that the controller is well connected.

 

I don't if I missing something.

If someone can helpme plis.

Outcomes