Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => STMP1 => Topic started by: yugandharbabu on November 07, 2023, 12:55:49 PM

Title: Adding new touch driver in overlay has issues
Post by: yugandharbabu on November 07, 2023, 12:55:49 PM
Hi,

I am using STMP157 Lime2 board with prebuilt image provided in olimage guide. I tested it with 7inch Olimex LCD and everything is good. Now I connected Riverdi 7inch 1024x600 LCD with capacitive touch panel (https://www.mouser.in/datasheet/2/1021/DS_RVT70HSTNWC00_B_Rev_1_2-3137742.pdf) with same pins, so LCD is displaying as like olimex 7 inch LCD but touch is not working. I verified the LCD datasheets and found that olimex LCD has goodix gt911 touch controller and riverdi LCD has ilitek ili2132 touch controller. So, I added ilitek driver from ilitek_ts_i2c.c (https://elixir.bootlin.com/linux/v5.19.17/source/drivers/input/touchscreen/ilitek_ts_i2c.c) and compiled the olimex linux kernel. I copied the .deb files to STMP157 board as mentioned in olimage guide doc.

I modified the STM32MP1 7inch LCD overlay file lcd-stm32mp1-7cts.dts (https://github.com/OLIMEX/olinuxino-overlays/blob/master/stm32mp1/lcd-stm32mp1-7cts.dts) as below. fragment@2 {
target = <&i2c1>;
__overlay__ {
ilitek@41 { /*gt911@14 { */
                                compatible = "ilitek,ili2132"; /* "goodix,gt911"; */
                                reg = <0x41>; /* <0x14>; */

                                interrupt-parent = <&gpioi>;
                                interrupts = <11 2>;          /* PI11: IRQ_TYPE_EDGE_FALLING */

                                irq-gpios = <&gpioi 11 0>;      /* PH10 */
                                reset-gpios = <&gpioa 14 0>;    /* PA13: GPIO_ACTIVE_HIGH */

                                touchscreen-swapped-x-y;
                        };
};
};
I compiled the dts files using make file provided in olinuxino-overlays repo. I copied the lcd-stm32mp1-7cts.dtbo file to /usr/lib/olinuxino-overlays/stm32mp1/ folder in STMP157 board. I executed the script olinuxino-display and selected LCD-OLinuXino-7CTS to use the modified dtbo file and rebooted the device.

Now, I can see below messages during boot.
[   14.653391] pwm-backlight display-bl: supply power not found, using dummy regulator
[   14.680346] panel-simple panel: supply power not found, using dummy regulator
[   14.686659] panel-simple panel: Specify missing connector_type
[   14.730963] pwm-backlight display-bl: supply power not found, using dummy regulator
[   14.739235] panel-simple panel: supply power not found, using dummy regulator
[   14.745400] panel-simple panel: Specify missing connector_type
[   14.819402] [drm] Initialized stm 1.0.0 20170330 for 5a001000.display-controller on minor 1
[   14.837420] ilitek_ts_i2c: (ilitek_ts_i2c_probe): --enter probe--
[   15.852517] ilitek_ts_i2c: (ilitek_protocol_init): --enter--
[   15.856763] ilitek_ts_i2c: (api_protocol_set_cmd): --enter--
[   15.862486] ilitek_ts_i2c: (ilitek_i2c_write_and_read): addr:0x41 cmd:0x42 w_len:1 r_len:3
[   15.887471] vm.flags stats: 0
[   15.887483] LTDC Reg stats: 0
[   15.888575] ilitek_ts_i2c: (ilitek_read_tp_info): --enter--
[   15.888584] ilitek_ts_i2c: (api_protocol_set_cmd): --enter--
[   15.888598] ilitek_ts_i2c: (ilitek_i2c_write_and_read): addr:0x41 cmd:0x42 w_len:1 r_len:3
[   15.894298] ilitek_ts_i2c: (api_protocol_set_cmd): --enter--
[   15.894318] ilitek_ts_i2c: (ilitek_i2c_write_and_read): addr:0x41 cmd:0x61 w_len:1 r_len:32
[   15.902518] ilitek_ts_i2c: (api_protocol_set_cmd): --enter--
[   15.902535] ilitek_ts_i2c: (ilitek_i2c_write_and_read): addr:0x41 cmd:0x40 w_len:1 r_len:8
[   15.908619] ilitek_ts_i2c: (api_protocol_set_cmd): --enter--
[   15.908635] ilitek_ts_i2c: (ilitek_i2c_write_and_read): addr:0x41 cmd:0x21 w_len:1 r_len:8
[   15.914706] ilitek_ts_i2c: (api_protocol_set_cmd): --enter--
[   15.914720] ilitek_ts_i2c: (ilitek_i2c_write_and_read): addr:0x41 cmd:0x20 w_len:1 r_len:15
[   15.921406] ilitek_ts_i2c: (api_protocol_set_cmd): --enter--
[   15.921420] ilitek_ts_i2c: (ilitek_i2c_write_and_read): addr:0x41 cmd:0xc0 w_len:1 r_len:2
[   15.926979] ilitek_ts_i2c: (ilitek_input_dev_init): --enter--
[   15.927330] input: ilitek_ts as /devices/platform/soc/40012000.i2c/i2c-0/0-0041/input/input1
[   15.927350] ilitek_ts_i2c: (ilitek_ts_i2c_probe): ilitek reg irq: 110
[   15.932135] Console: switching to colour frame buffer device 128x37

But, the LCD is not showing anything like earlier and no touch events also when I run evtest /dev/input/event1 and press and touch panel. Only below output appears for evtest command.
root@stm32mp1-olinuxino-lime:~# evtest /dev/input/event1
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "ilitek_ts"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 330 (BTN_TOUCH)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value      0
      Min        0
      Max     1024
    Event code 1 (ABS_Y)
      Value      0
      Min        0
      Max      600
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max        9
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max     1024
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max      600
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
Properties:
  Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)

What wrong I did? Is changing LCD overlay file correct? or driver file is not correct?

When I change i2c address and driver info in overlay file, why LCD stopped showing?

To verify my changes, I copied the original dtbo file again and rebooted, now LCD is showing up and touch not working and also no /dev/input/event1.

Please suggest if anyone is aware of these issues or know about linux touchscreen drivers. Thank you.