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			cy8cmbr3xxx@b {
278				compatible = "cypress,cy8cmbr3xxx";
279				status= "okay";
280				reg = <0xb>;
281				int-gpios = <&test_gpio 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
282				rst-gpios = <&test_gpio 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
283				input-codes = <0 1 2 3 4 5 6 7>;
284				proximity-codes = <8>;
285			};
286		};
287
288		spi@2 {
289			#address-cells = <1>;
290			#size-cells = <0>;
291			compatible = "vnd,spi";
292			reg = <0x2 0x1000>;
293			status = "okay";
294			clock-frequency = <2000000>;
295
296			/* one entry for every devices */
297			cs-gpios = <&test_gpio 0 0>,
298				   <&test_gpio 1 0>,
299				   <&test_gpio 2 0>,
300				   <&test_gpio 3 0>;
301
302			xpt2046@0 {
303				compatible = "xptek,xpt2046";
304				spi-max-frequency = <0>;
305				reg = <0x0>;
306				int-gpios = <&test_gpio 0 0>;
307				touchscreen-size-x = <10>;
308				touchscreen-size-y = <10>;
309				min-x = <0>;
310				min-y = <0>;
311				max-x = <1>;
312				max-y = <1>;
313			};
314
315			pmw3610@1 {
316				compatible = "pixart,pmw3610";
317				spi-max-frequency = <0>;
318				reg = <0x1>;
319				motion-gpios = <&test_gpio 0 0>;
320				reset-gpios = <&test_gpio 1 0>;
321				zephyr,axis-x = <0>;
322				zephyr,axis-y = <1>;
323				invert-x;
324				invert-y;
325				force-awake;
326				smart-mode;
327			};
328
329			pinnacle@2 {
330				compatible = "cirque,pinnacle";
331				reg = <0x2>;
332				spi-max-frequency = <0>;
333				data-ready-gpios = <&test_gpio 0 0>;
334				data-mode = "absolute";
335				idle-packets-count = <20>;
336				clipping-enable;
337				scaling-enable;
338				invert-x;
339				invert-y;
340			};
341
342			paw32xx@3 {
343				compatible = "pixart,paw32xx";
344				reg = <3>;
345				spi-max-frequency = <0>;
346				motion-gpios = <&test_gpio 0 0>;
347				zephyr,axis-x = <0>;
348				zephyr,axis-y = <1>;
349				invert-x;
350				invert-y;
351				res-cpi = <800>;
352			};
353		};
354	};
355};
356