1/*
2 * Copyright 2023 Google LLC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <zephyr/dt-bindings/input/input-event-codes.h>
8
9/ {
10	test {
11		#address-cells = <1>;
12		#size-cells = <1>;
13
14		test_adc: adc@adc0adc0 {
15			compatible = "vnd,adc";
16			reg = <0xadc0adc0 0x1000>;
17			#io-channel-cells = <1>;
18			#address-cells = <1>;
19			#size-cells = <0>;
20			status = "okay";
21
22			channel@0 {
23				reg = <0>;
24				zephyr,gain = "ADC_GAIN_1";
25				zephyr,reference = "ADC_REF_VDD_1";
26				zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
27			};
28		};
29
30		test_gpio: gpio@0 {
31			compatible = "vnd,gpio";
32			gpio-controller;
33			reg = <0x0 0x1000>;
34			#gpio-cells = <0x2>;
35			status = "okay";
36		};
37
38		adc-keys {
39			compatible = "adc-keys";
40			io-channels = <&test_adc 0>;
41			keyup-threshold-mv = <0>;
42
43			button_0 {
44				press-thresholds-mv = <1500>, <1750>;
45				zephyr,code = <0>;
46			};
47
48			button_1 {
49				press-thresholds-mv = <2500>, <1750>;
50				zephyr,code = <1>;
51			};
52		};
53
54		gpio-keys {
55			compatible = "gpio-keys";
56			debounce-interval-ms = <30>;
57
58			button_0 {
59				gpios = <&test_gpio 0 0>;
60				zephyr,code = <0>;
61			};
62		};
63
64		gpio-keys-polled {
65			compatible = "gpio-keys";
66			debounce-interval-ms = <30>;
67
68			button_0 {
69				gpios = <&test_gpio 0 0>;
70				zephyr,code = <0>;
71			};
72
73			polling-mode;
74		};
75
76		evdev {
77			compatible = "zephyr,native-linux-evdev";
78		};
79
80		kbd-matrix-0 {
81			compatible = "gpio-kbd-matrix";
82			row-gpios = <&test_gpio 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>,
83				    <&test_gpio 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
84			col-gpios = <&test_gpio 2 GPIO_ACTIVE_LOW>,
85				    <&test_gpio 3 GPIO_ACTIVE_LOW>,
86				    <&test_gpio 4 GPIO_ACTIVE_LOW>;
87			actual-key-mask = <0x0f 0x0a 0x0b>;
88
89			keymap {
90				compatible = "input-keymap";
91				keymap = <0 1 2>;
92				row-size = <2>;
93				col-size = <2>;
94			};
95		};
96
97		kbd-matrix-1 {
98			compatible = "gpio-kbd-matrix";
99			row-gpios = <&test_gpio 0 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
100				    <&test_gpio 1 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
101				    <&test_gpio 2 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
102			col-gpios = <&test_gpio 3 GPIO_ACTIVE_HIGH>,
103				    <&test_gpio 4 GPIO_ACTIVE_HIGH>;
104			col-drive-inactive;
105			idle-mode = "poll";
106		};
107
108		kbd-matrix-2 {
109			compatible = "gpio-kbd-matrix";
110			row-gpios = <&test_gpio 0 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
111				    <&test_gpio 1 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
112				    <&test_gpio 2 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
113			col-gpios = <&test_gpio 3 GPIO_ACTIVE_HIGH>,
114				    <&test_gpio 4 GPIO_ACTIVE_HIGH>;
115			poll-timeout-ms = <0>;
116			idle-mode = "scan";
117		};
118
119		qdec-gpio {
120			compatible = "gpio-qdec";
121			gpios = <&test_gpio 0 0>, <&test_gpio 1 0>;
122			steps-per-period = <4>;
123			zephyr,axis = <0>;
124			sample-time-us = <2000>;
125			idle-timeout-ms = <200>;
126		};
127
128		qdec-gpio-polled {
129			compatible = "gpio-qdec";
130			gpios = <&test_gpio 0 0>, <&test_gpio 1 0>;
131			led-gpios = <&test_gpio 2 0>;
132			led-pre-us = <5>;
133			steps-per-period = <4>;
134			zephyr,axis = <0>;
135			sample-time-us = <2000>;
136			idle-timeout-ms = <200>;
137			idle-poll-time-us = <5000>;
138		};
139
140		analog_axis {
141			compatible = "analog-axis";
142
143			axis-x {
144				io-channels = <&test_adc 0>;
145				out-min = <(-127)>;
146				out-max = <127>;
147				in-deadzone = <8>;
148				in-min = <(-100)>;
149				in-max = <100>;
150				zephyr,axis = <0>;
151				invert-input;
152				invert-output;
153			};
154		};
155
156		longpress: longpress {
157			input = <&longpress>;
158			compatible = "zephyr,input-longpress";
159			input-codes = <0>;
160			short-codes = <0>;
161			long-codes = <0>;
162			long-delay-ms = <100>;
163		};
164
165		double_tap: doubletap {
166			input = <&double_tap>;
167			compatible = "zephyr,input-double-tap";
168			input-codes = <0>;
169			double-tap-codes = <0>;
170			double-tap-delay-ms = <0>;
171		};
172
173		test_uart: uart@55556666 {
174			compatible = "vnd,serial";
175			reg = <0x55556666 0x1000>;
176			status = "okay";
177
178			#address-cells = <1>;
179			#size-cells = <0>;
180
181			sbus {
182				compatible = "futaba,sbus";
183
184				right_stick_x {
185					channel = <1>;
186					type = <INPUT_EV_ABS>;
187					zephyr,code = <INPUT_ABS_RX>;
188				};
189			};
190		};
191
192		i2c@1 {
193			#address-cells = <1>;
194			#size-cells = <0>;
195			compatible = "vnd,i2c";
196			reg = <0x1 0x1000>;
197			status = "okay";
198			clock-frequency = <100000>;
199
200			ft5336@0 {
201				compatible = "focaltech,ft5336";
202				reg = <0x0>;
203				int-gpios = <&test_gpio 0 0>;
204			};
205
206			ft6146@0 {
207				compatible = "focaltech,ft6146";
208				reg = <0x0>;
209				int-gpios = <&test_gpio 0 0>;
210				reset-gpios = <&test_gpio 1 0>;
211			};
212
213			gt911@1 {
214				compatible = "goodix,gt911";
215				reg = <0x1>;
216				irq-gpios = <&test_gpio 0 0>;
217				reset-gpios = <&test_gpio 1 0>;
218			};
219
220			cst816s@2 {
221				compatible = "hynitron,cst816s";
222				reg = <0x2>;
223				irq-gpios = <&test_gpio 0 0>;
224				rst-gpios = <&test_gpio 1 0>;
225			};
226
227			cap12xx@3 {
228				compatible = "microchip,cap12xx";
229				reg = <0x3>;
230				int-gpios = <&test_gpio 0 0>;
231				input-codes = <0 1 2>;
232				sensor-gain = <1>;
233				sensitivity-delta-sense = <32>;
234				signal-guard = <0 0 0>;
235				calib-sensitivity = <1 1 1>;
236			};
237
238			stmpe811@4 {
239				compatible = "st,stmpe811";
240				reg = <0x4>;
241				int-gpios = <&test_gpio 0 0>;
242				panel-driver-settling-time-us = <10>;
243				touch-detect-delay-us = <10>;
244				touch-average-control = <1>;
245				tracking-index = <0>;
246			};
247
248			pat@5 {
249				compatible = "pixart,pat912x";
250				reg = <0x5>;
251				motion-gpios = <&test_gpio 0 0>;
252				zephyr,axis-x = <0>;
253				zephyr,axis-y = <1>;
254				res-x-cpi = <0>;
255				res-y-cpi = <0>;
256				invert-x;
257				invert-y;
258				sleep1-enable;
259				sleep2-enable;
260			};
261
262			cf1133@6 {
263				compatible = "sitronix,cf1133";
264				reg = <0x6>;
265				int-gpios = <&test_gpio 0 0>;
266			};
267
268			chsc6x@7 {
269				compatible = "chipsemi,chsc6x";
270				reg = <0x7>;
271				irq-gpios = <&test_gpio 0 0>;
272			};
273
274			pinnacle@8 {
275				compatible = "cirque,pinnacle";
276				reg = <0x8>;
277				data-ready-gpios = <&test_gpio 0 0>;
278				data-mode = "relative";
279				primary-tap-enable;
280				swap-xy;
281			};
282
283			touch_dev: ili2132a@9 {
284				compatible = "ilitek,ili2132a";
285				reg = <0x9>;
286				irq-gpios = <&test_gpio 0 0>;
287				rst-gpios = <&test_gpio 1 0>;
288			};
289
290			nunchuk@a {
291				reg = <0xa>;
292				compatible = "nintendo,nunchuk";
293			};
294
295			cy8cmbr3xxx@b {
296				compatible = "cypress,cy8cmbr3xxx";
297				status = "okay";
298				reg = <0xb>;
299				int-gpios = <&test_gpio 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
300				rst-gpios = <&test_gpio 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
301				input-codes = <0 1 2 3 4 5 6 7>;
302				proximity-codes = <8>;
303			};
304
305			chsc5x@c {
306				compatible = "chipsemi,chsc5x";
307				reg = <0xc>;
308				int-gpios = <&test_gpio 0 0>;
309				reset-gpios = <&test_gpio 1 0>;
310			};
311		};
312
313		spi@2 {
314			#address-cells = <1>;
315			#size-cells = <0>;
316			compatible = "vnd,spi";
317			reg = <0x2 0x1000>;
318			status = "okay";
319			clock-frequency = <2000000>;
320
321			/* one entry for every devices */
322			cs-gpios = <&test_gpio 0 0>,
323				   <&test_gpio 1 0>,
324				   <&test_gpio 2 0>,
325				   <&test_gpio 3 0>;
326
327			xpt2046@0 {
328				compatible = "xptek,xpt2046";
329				spi-max-frequency = <0>;
330				reg = <0x0>;
331				int-gpios = <&test_gpio 0 0>;
332				touchscreen-size-x = <10>;
333				touchscreen-size-y = <10>;
334				min-x = <0>;
335				min-y = <0>;
336				max-x = <1>;
337				max-y = <1>;
338			};
339
340			pmw3610@1 {
341				compatible = "pixart,pmw3610";
342				spi-max-frequency = <0>;
343				reg = <0x1>;
344				motion-gpios = <&test_gpio 0 0>;
345				reset-gpios = <&test_gpio 1 0>;
346				zephyr,axis-x = <0>;
347				zephyr,axis-y = <1>;
348				invert-x;
349				invert-y;
350				force-awake;
351				smart-mode;
352			};
353
354			pinnacle@2 {
355				compatible = "cirque,pinnacle";
356				reg = <0x2>;
357				spi-max-frequency = <0>;
358				data-ready-gpios = <&test_gpio 0 0>;
359				data-mode = "absolute";
360				idle-packets-count = <20>;
361				clipping-enable;
362				scaling-enable;
363				invert-x;
364				invert-y;
365			};
366
367			paw32xx@3 {
368				compatible = "pixart,paw32xx";
369				reg = <3>;
370				spi-max-frequency = <0>;
371				motion-gpios = <&test_gpio 0 0>;
372				zephyr,axis-x = <0>;
373				zephyr,axis-y = <1>;
374				invert-x;
375				invert-y;
376				res-cpi = <800>;
377			};
378		};
379	};
380};
381