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				sensor-gain = <1>;
219				sensitivity-delta-sense = <32>;
220				signal-guard = <0 0 0>;
221				calib-sensitivity = <1 1 1>;
222			};
223
224			stmpe811@4 {
225				compatible = "st,stmpe811";
226				reg = <0x4>;
227				int-gpios = <&test_gpio 0 0>;
228				panel-driver-settling-time-us = <10>;
229				touch-detect-delay-us = <10>;
230				touch-average-control = <1>;
231				tracking-index = <0>;
232			};
233
234			pat@5 {
235				compatible = "pixart,pat912x";
236				reg = <0x5>;
237				motion-gpios = <&test_gpio 0 0>;
238				zephyr,axis-x = <0>;
239				zephyr,axis-y = <1>;
240				res-x-cpi = <0>;
241				res-y-cpi = <0>;
242				invert-x;
243				invert-y;
244				sleep1-enable;
245				sleep2-enable;
246			};
247
248			cf1133@6 {
249				compatible = "sitronix,cf1133";
250				reg = <0x6>;
251				int-gpios = <&test_gpio 0 0>;
252			};
253
254			chsc6x@7 {
255				compatible = "chipsemi,chsc6x";
256				reg = <0x7>;
257				irq-gpios = <&test_gpio 0 0>;
258			};
259
260			pinnacle@8 {
261				compatible = "cirque,pinnacle";
262				reg = <0x8>;
263				data-ready-gpios = <&test_gpio 0 0>;
264				data-mode = "relative";
265				primary-tap-enable;
266				swap-xy;
267			};
268
269			touch_dev: ili2132a@9 {
270				compatible = "ilitek,ili2132a";
271				reg = <0x9>;
272				irq-gpios = <&test_gpio 0 0>;
273				rst-gpios = <&test_gpio 1 0>;
274			};
275
276			nunchuk@a {
277				reg = <0xa>;
278				compatible= "nintendo,nunchuk";
279			};
280
281			cy8cmbr3xxx@b {
282				compatible = "cypress,cy8cmbr3xxx";
283				status= "okay";
284				reg = <0xb>;
285				int-gpios = <&test_gpio 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
286				rst-gpios = <&test_gpio 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
287				input-codes = <0 1 2 3 4 5 6 7>;
288				proximity-codes = <8>;
289			};
290
291			chsc5x@c {
292				compatible = "chipsemi,chsc5x";
293				reg = <0xc>;
294				int-gpios = <&test_gpio 0 0>;
295				reset-gpios = <&test_gpio 1 0>;
296			};
297		};
298
299		spi@2 {
300			#address-cells = <1>;
301			#size-cells = <0>;
302			compatible = "vnd,spi";
303			reg = <0x2 0x1000>;
304			status = "okay";
305			clock-frequency = <2000000>;
306
307			/* one entry for every devices */
308			cs-gpios = <&test_gpio 0 0>,
309				   <&test_gpio 1 0>,
310				   <&test_gpio 2 0>,
311				   <&test_gpio 3 0>;
312
313			xpt2046@0 {
314				compatible = "xptek,xpt2046";
315				spi-max-frequency = <0>;
316				reg = <0x0>;
317				int-gpios = <&test_gpio 0 0>;
318				touchscreen-size-x = <10>;
319				touchscreen-size-y = <10>;
320				min-x = <0>;
321				min-y = <0>;
322				max-x = <1>;
323				max-y = <1>;
324			};
325
326			pmw3610@1 {
327				compatible = "pixart,pmw3610";
328				spi-max-frequency = <0>;
329				reg = <0x1>;
330				motion-gpios = <&test_gpio 0 0>;
331				reset-gpios = <&test_gpio 1 0>;
332				zephyr,axis-x = <0>;
333				zephyr,axis-y = <1>;
334				invert-x;
335				invert-y;
336				force-awake;
337				smart-mode;
338			};
339
340			pinnacle@2 {
341				compatible = "cirque,pinnacle";
342				reg = <0x2>;
343				spi-max-frequency = <0>;
344				data-ready-gpios = <&test_gpio 0 0>;
345				data-mode = "absolute";
346				idle-packets-count = <20>;
347				clipping-enable;
348				scaling-enable;
349				invert-x;
350				invert-y;
351			};
352
353			paw32xx@3 {
354				compatible = "pixart,paw32xx";
355				reg = <3>;
356				spi-max-frequency = <0>;
357				motion-gpios = <&test_gpio 0 0>;
358				zephyr,axis-x = <0>;
359				zephyr,axis-y = <1>;
360				invert-x;
361				invert-y;
362				res-cpi = <800>;
363			};
364		};
365	};
366};
367