summaryrefslogtreecommitdiff
path: root/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-h.dts
blob: ff453336eab1d16fc67bada040fb9445f6629b9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/*
 * Copyright (C) 2024 Ryan Walklin <ryan@testtoast.com>.
 * Copyright (C) 2024 Chris Morgan <macroalpha82@gmail.com>.
 */

#include "sun50i-h700-anbernic-rg35xx-plus.dts"

/ {
	model = "Anbernic RG35XX H";
	compatible = "anbernic,rg35xx-h", "allwinner,sun50i-h700";

	adc-joystick {
		compatible = "adc-joystick";
		io-channels = <&adc_mux 0>,
			      <&adc_mux 1>,
			      <&adc_mux 2>,
			      <&adc_mux 3>;
		pinctrl-0 = <&joy_mux_pin>;
		pinctrl-names = "default";
		poll-interval = <60>;
		#address-cells = <1>;
		#size-cells = <0>;

		axis@0 {
			reg = <0>;
			abs-flat = <32>;
			abs-fuzz = <32>;
			abs-range = <4096 0>;
			linux,code = <ABS_X>;
		};

		axis@1 {
			reg = <1>;
			abs-flat = <32>;
			abs-fuzz = <32>;
			abs-range = <0 4096>;
			linux,code = <ABS_Y>;
		};

		axis@2 {
			reg = <2>;
			abs-flat = <32>;
			abs-fuzz = <32>;
			abs-range = <0 4096>;
			linux,code = <ABS_RX>;
		};

		axis@3 {
			reg = <3>;
			abs-flat = <32>;
			abs-fuzz = <32>;
			abs-range = <4096 0>;
			linux,code = <ABS_RY>;
		};
	};

	adc_mux: adc-mux {
		compatible = "io-channel-mux";
		channels = "left_x", "left_y", "right_x", "right_y";
		#io-channel-cells = <1>;
		io-channels = <&gpadc 0>;
		io-channel-names = "parent";
		mux-controls = <&gpio_mux>;
		settle-time-us = <100>;
	};

	gpio_mux: mux-controller {
		compatible = "gpio-mux";
		mux-gpios = <&pio 8 1 GPIO_ACTIVE_LOW>,
			    <&pio 8 2 GPIO_ACTIVE_LOW>;
		#mux-control-cells = <0>;
	};
};

&gpadc {
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	channel@0 {
		reg = <0>;
	};
};

&gpio_keys_gamepad {
	button-thumbl {
		label = "GPIO Thumb Left";
		gpios = <&pio 4 8 GPIO_ACTIVE_LOW>; /* PE8 */
		linux,input-type = <EV_KEY>;
		linux,code = <BTN_THUMBL>;
	};

	button-thumbr {
		label = "GPIO Thumb Right";
		gpios = <&pio 4 9 GPIO_ACTIVE_LOW>; /* PE9 */
		linux,input-type = <EV_KEY>;
		linux,code = <BTN_THUMBR>;
	};
};

&ehci1 {
	status = "okay";
};

&ohci1 {
	status = "okay";
};

&pio {
	joy_mux_pin: joy-mux-pin {
		pins = "PI0";
		function = "gpio_out";
	};
};