Radxa Zero 3W Resistive TouchScreen XPT2046

Hello

I have this display http://www.lcdwiki.com/4inch_HDMI_Display-C and touchscreen doesn’t work.

I write dts file but the touchscreen did not work.

Can point out my mistakes when writing dts?

/*
  • Generic Device Tree overlay for the ADS7846 touch controller

*/

/dts-v1/;
/plugin/;

/ {
compatible = “rockchip,rk3566”;

    fragment@0 {
            target = <&spi3>;

            __overlay__ {
                    status = "okay";
            };
    };

    fragment@1 {
            target = <&gpio4>;
            __overlay__ {
                    ads7846_pins: ads7846_pins {
                            rockchip,pins = <5 12 0 &pcfg_pull_up>;
                    };
            };
    };

    fragment@2 {
            target = <&spi3>;
            __overlay__ {
                    /* needed to avoid dtc warning */
                    #address-cells = <1>;
                    #size-cells = <0>;

                    ads7846: ads7846@1 {
                            compatible = "ti,ads7846";
                            reg = <1>;
                            spi-max-frequency = <2000000>;
                            interrupts = <12 2>; // high-to-low edge triggered
                            interrupt-parent = <&gpio4>;
                            pendown-gpio = <&gpio5 12 0>;
                            ti,x-plate-ohms = /bits/ 16 <60>;
                            ti,pressure-max = /bits/ 16 <255>;
                    };
            };
    };

};

for dts writting, you can refer to radxa overlays repository.

  1. Fragment @0 and fragment @2 can be combined into one.
  2. You need to write the related spi pins as pinctrl-0, and add pinctrl-names property.
  3. The pin of pendown-gpio and interrupts can be the same gpio pin.
  4. For details, please refer to this.