1#include <zephyr/dt-bindings/spi/spi.h>
2
3/ {
4	chosen {
5		zephyr,display = &st7796s_lcdic;
6		zephyr,touch = &ft7401;
7	};
8
9	lvgl_pointer {
10		compatible = "zephyr,lvgl-pointer-input";
11		input = <&ft7401>;
12		swap-xy;
13		invert-y;
14	};
15};
16
17&lcdic {
18	status = "okay";
19	nxp,swap-bytes;
20	/* Raise the timer0 ratio to enable longer reset delay */
21	nxp,timer0-ratio = <15>;
22	/*
23	 * Settings to connect this display:
24	 * Populate the following resistors:
25	 * - R125, R123, R12, R124, R15, R243, R239, R236, R233, R286, R246
26	 * Remove the following resistors:
27	 * - R9, R11, R20, R19, R242, R241, R237, R235, R245
28	 * Remove JP30 to disconnect Flexcomm SPI CS
29	 * Display can be connected to Arduino header (J5/J6)
30	 * Pin #  | Signal | Header
31	 * -------------------------------
32	 * 1      | VDD    | J5.8 (+3.3V)
33	 * 2      | RST    | J6.8 (LCD_SPI_RESETN)
34	 * 3      | SDO    | J5.5 (SPI_MISO)
35	 * 4      | CS     | J5.3 (LCD_SPI_SS)
36	 * 5      | SCLK   | J5.6 (LCD_SPI_SCK)
37	 * 6      | GND    | J5.7 (GND)
38	 * 7      | MOSI   | J5.4 (LCD_SPI_SDIO)
39	 * 8      | CD     | J5.1 (LCD_SPI_DC)
40	 * 9      | TE     | J5.2 (LCD_SPI_TE, not enabled)
41	 *
42	 * Pins 10 and 11 correspond to the backlight anode and cathode,
43	 * and must be driven by an external circuit
44	 */
45	st7796s_lcdic: st7796s@0 {
46		compatible = "sitronix,st7796s";
47		status = "okay";
48		reg = <0>;
49		mipi-max-frequency = <23000000>;
50		duplex = <SPI_HALF_DUPLEX>;
51		height = <320>;
52		width = <480>;
53		invert-mode = "1-dot";
54		frmctl1 = [80 10];
55		bpc = [1F 50 00 20];
56		dfc = [8A 07 3B];
57		pwr1 = [80 64];
58		pwr2 = <0x13>;
59		pwr3 = <0xA7>;
60		vcmpctl = <0x09>;
61		doca = [40 8A 00 00 29 19 A5 38];
62		pgc = [F0 06 0B 07 06 05 2E 33 47 3A 17 16 2E 31];
63		ngc = [F0 09 0D 09 08 23 2E 33 46 38 13 13 2C 32];
64		madctl = <0x28>;
65	};
66};
67
68&flexcomm2 {
69	status = "okay";
70	ft7401: ft7401@38 {
71		/*
72		 * Settings to connect this touch controller:
73		 * Populate JP3 and JP50 to connect I2C
74		 * Controller can be connected to Arduino Header (J8/J5)
75		 * Pin #1 | Signal | Header
76		 * -------------------------------
77		 * 1      | VDD    | J8.2 (+3.3V)
78		 * 2      | IOVDD  | J8.4 (+3.3V)
79		 * 3      | SCL    | J5.10 (SCL)
80		 * 4      | SDA    | J5.9 (SDA)
81		 * 5      | INT    | J6.3 (D2)
82		 * 6      | RST    | J6.4 (D3)
83		 * 7      | GND    | J8.6 (GND)
84		 * 8      | GND    | J8.7 (GND)
85		 *
86		 * Note- the actual controller present on this IC is a FT7401,
87		 * but the FT5336 driver in Zephyr supports this IC.
88		 */
89		compatible = "focaltech,ft5336";
90		reg = <0x38>;
91		reset-gpios = <&hsgpio0 15 GPIO_ACTIVE_LOW>;
92		int-gpios = <&hsgpio0 11 GPIO_ACTIVE_HIGH>;
93	};
94};
95