Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit e41e597

Browse files
macromorganwens
authored andcommitted
arm64: dts: allwinner: anbernic-rg35xx-h: Add ADC joysticks
Add support for the ADC joysticks found on the Anbernic RG35XX-H. The joysticks use one channel of the GPADC which is muxed 4 ways by an ADC mux. Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Link: https://lore.kernel.org/r/20240605172049.231108-5-macroalpha82@gmail.com Signed-off-by: Chen-Yu Tsai <wens@csie.org>
1 parent 59678cc commit e41e597

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-h.dts

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,78 @@
99
/ {
1010
model = "Anbernic RG35XX H";
1111
compatible = "anbernic,rg35xx-h", "allwinner,sun50i-h700";
12+
13+
adc-joystick {
14+
compatible = "adc-joystick";
15+
io-channels = <&adc_mux 0>,
16+
<&adc_mux 1>,
17+
<&adc_mux 2>,
18+
<&adc_mux 3>;
19+
pinctrl-0 = <&joy_mux_pin>;
20+
pinctrl-names = "default";
21+
poll-interval = <60>;
22+
#address-cells = <1>;
23+
#size-cells = <0>;
24+
25+
axis@0 {
26+
reg = <0>;
27+
abs-flat = <32>;
28+
abs-fuzz = <32>;
29+
abs-range = <4096 0>;
30+
linux,code = <ABS_X>;
31+
};
32+
33+
axis@1 {
34+
reg = <1>;
35+
abs-flat = <32>;
36+
abs-fuzz = <32>;
37+
abs-range = <0 4096>;
38+
linux,code = <ABS_Y>;
39+
};
40+
41+
axis@2 {
42+
reg = <2>;
43+
abs-flat = <32>;
44+
abs-fuzz = <32>;
45+
abs-range = <0 4096>;
46+
linux,code = <ABS_RX>;
47+
};
48+
49+
axis@3 {
50+
reg = <3>;
51+
abs-flat = <32>;
52+
abs-fuzz = <32>;
53+
abs-range = <4096 0>;
54+
linux,code = <ABS_RY>;
55+
};
56+
};
57+
58+
adc_mux: adc-mux {
59+
compatible = "io-channel-mux";
60+
channels = "left_x", "left_y", "right_x", "right_y";
61+
#io-channel-cells = <1>;
62+
io-channels = <&gpadc 0>;
63+
io-channel-names = "parent";
64+
mux-controls = <&gpio_mux>;
65+
settle-time-us = <100>;
66+
};
67+
68+
gpio_mux: mux-controller {
69+
compatible = "gpio-mux";
70+
mux-gpios = <&pio 8 1 GPIO_ACTIVE_LOW>,
71+
<&pio 8 2 GPIO_ACTIVE_LOW>;
72+
#mux-control-cells = <0>;
73+
};
74+
};
75+
76+
&gpadc {
77+
#address-cells = <1>;
78+
#size-cells = <0>;
79+
status = "okay";
80+
81+
channel@0 {
82+
reg = <0>;
83+
};
1284
};
1385

1486
&gpio_keys_gamepad {
@@ -34,3 +106,10 @@
34106
&ohci1 {
35107
status = "okay";
36108
};
109+
110+
&pio {
111+
joy_mux_pin: joy-mux-pin {
112+
pins = "PI0";
113+
function = "gpio_out";
114+
};
115+
};

0 commit comments

Comments
 (0)