Skip to content

Instantly share code, notes, and snippets.

@4piu
Created September 1, 2024 21:56
Show Gist options
  • Save 4piu/2d00cc8b3e81daadc7bdcc074fc896be to your computer and use it in GitHub Desktop.
Save 4piu/2d00cc8b3e81daadc7bdcc074fc896be to your computer and use it in GitHub Desktop.
Overlay file for ili9341 touchscreen module
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target = <&pio>;
__overlay__ {
spi0_cs1: spi0_cs1 {
pins = "PC3"; /* CS */
function = "gpio_out";
output-high;
};
spi1_cs1: spi1_cs1 {
pins = "PA3"; /* T_CS */
function = "gpio_out";
output-high;
};
spi_tft_display_pins: spi_tft_display_pins {
pins = "PA1", "PG8", "PA2"; /* DC, RST, LED */
function = "gpio_out";
};
spi_tft_touch_pins: spi_tft_touch_pins {
pins = "PG9"; /* T_IRQ */
function = "irq";
};
};
};
fragment@1 {
target = <&spi0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-names = "default", "default";
cs-gpios= <&pio 2 3 0>, <&pio 0 3 1>;
spi_tft_display: spi_tft_display@0 {
pinctrl-1 = <&spi0_cs1>;
reg = <0>; /* Chip Select 0 */
compatible = "ilitek,ili9341";
spi-max-frequency = <64000000>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi_tft_display_pins>;
rotate = <90>;
fps = <60>;
buswidth = <8>;
dc-gpios = <&pio 0 1 0>; /* PA1 */
reset-gpios = <&pio 6 8 1 >; /* PG8 */
led-gpios=<&pio 0 2 0>; /* PA2 */
debug=<4>;
};
spi_tft_touch: spi_tft_touch@1 {
reg = <1>; /* Chip Select 1 */
compatible = "ti,ads7846"; /* xptek,xpt2046 */
spi-max-frequency = <2000000>;
pinctrl-names = "default";
status = "okay";
pinctrl-2=<&spi1_cs1 &spi1_cs1>;
pinctrl-3 = <&spi_tft_touch_pins>;
interrupt-parent = <&pio>;
interrupts = <6 9 2>; /* PG9 IRQ_TYPE_EDGE_FALLING */
pendown-gpio = <&pio 6 9 0>; /* PG9 */
/* driver defaults, optional
ti,x-min = /bits/ 16 <0>;
ti,y-min = /bits/ 16 <0>;
ti,x-max = /bits/ 16 <0x0FFF>;
ti,y-max = /bits/ 16 <0x0FFF>;
ti,pressure-min = /bits/ 16 <0>;
ti,pressure-max = /bits/ 16 <0xFFFF>;
ti,x-plate-ohms = /bits/ 16 <400>; */
};
};
};
fragment@2 {
target = <&spi1>;
__overlay__ {
pinctrl-names = "default", "default";
pinctrl-1 = <&spi1_cs1>;
cs-gpios = <0>, <&pio 0 3 0>; /* PA3 */
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment