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