Using the capacitive touchscreen with Capacitive Touch Adapter

Hi,

I come from here Touch for capacitive-touch-display-7inch-parallel - Toradex Community

I have my custom dts created where I added some changes but I’m still unsure of how to select my GPIOs as interruptions sources (for defaultness sake, I will keep SODIMM 28 and 30). I’ve already read the documentation regarding the customization of the DTS but I don’t seem to find the correct values.

This is the first DTS I’ve tried:

 //vf-colibri-eval-v3.dtsi
 &i2c0 {    
 
     /* Atmel maxtouch controller */
     atmel_mxt_ts: atmel_mxt_ts@4a {
         compatible = "atmel,maxtouch";
         reg = <0x4a>;
 
         //Change this?
         interrupt-parent = <&gpio2>; //
         interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
 
         status = "okay"; //CHANGED!
     };
 
 };
 
 //vf-colibri.dtsi
 &pwm0 {
     status = "okay";
     pinctrl-0 = <&pinctrl_pwm0_a>; //CHANGED
 };
 
 &pwm1 {
     status = "okay";
     pinctrl-0 = <&pinctrl_pwm1_d>; //CHANGED
 };

I’ve also tried:

&i2c0 {	

	/* Atmel maxtouch controller */
	atmel_mxt_ts: atmel_mxt_ts@4a {
		compatible = "atmel,maxtouch";
		//reg = <0x4a>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_gpiotouch>;
		reg = <0x10>;
		//interrupt-parent = <&gpio2>;
		//interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
                gpios = <&gpio0 30 GPIO_ACTIVE_HIGH /* SO-DIMM 28, Pen down interrupt */
                         &gpio0 23 GPIO_ACTIVE_LOW /* SO-DIMM 30, Reset interrupt */
                        >;
		status = "okay"; //CHANGED!
	};

};

Thanks,
Álvaro.

I’ve just realised @Stefan just answered me in the other post (I though I had to open a new question). I’ll update the post with the correct solution asap :slight_smile:

Yes, it is actually better having this information in a separate thread since it refers to Vybrid. I will post my answer here.

You can just overwrite the pwm0/1 in your carrier board level device tree. The full change for the Evaluation Board should look like this (or as a patch file):

--- a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
@@ -138,10 +138,12 @@
        /* Atmel maxtouch controller */
        atmel_mxt_ts: atmel_mxt_ts@4a {
                compatible = "atmel,maxtouch";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpiotouch>;
                reg = <0x4a>;
-               interrupt-parent = <&gpio2>;
-               interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
-               status = "disabled";
+               interrupt-parent = <&gpio0>;
+               interrupts = <30 IRQ_TYPE_EDGE_FALLING>; /* SO-DIMM 28, int */
+               status = "okay";
        };
 
        /* TouchRevolution Fusion 7 and 10 multi-touch controller */
@@ -164,10 +166,12 @@
 };
 
 &pwm0 {
+       pinctrl-0 = <&pinctrl_pwm0_a>; /* Use only PWM<A> */
        status = "okay";
 };
 
 &pwm1 {
+       pinctrl-0 = <&pinctrl_pwm1_d>; /* Use only PWM<D> */
        status = "okay";
 };
 
@@ -215,8 +219,8 @@
 
                pinctrl_gpiotouch: touchgpios {
                        fsl,pins = <
-                               VF610_PAD_PTB8__GPIO_30         0x6f
-                               VF610_PAD_PTB1__GPIO_23         0x4f
+                               VF610_PAD_PTB8__GPIO_30         0x22ed
+                               VF610_PAD_PTB1__GPIO_23         0x22ed
                        >;
                };
        };

I’ve also had to to make an additional change in the kernel:

I forced the installation of the TS driver (Device Drivers → Input Device Support → Touchscreens → Atmel mXT I2C touchscreen), it was “m”

After this, the touchscreen was working but adjusted to the previous resolution. Additional changes should be made in order to adjust it to 800x480 (using xrandr for instance)

Compiling it in should not be required if you did not replace the kernel. Just loading the module (using modeprobe atmel_mxt_ts or automatically at boot using echo atmel_mxt_ts > /etc/modules-load.d/capacitive-touch.conf)

The resolution change is documented in the following article:

Display Output, Resolution and Timings (Linux)