1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 Hardkernel Co., Ltd
4 * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH
5 * Copyright (c) 2022 Maya Matuszczyk <maccraft123mc@gmail.com>
6 */
7
8/dts-v1/;
9#include "rk3326-odroid-go.dtsi"
10
11/ {
12	model = "ODROID-GO Super";
13	compatible = "hardkernel,rk3326-odroid-go3", "rockchip,rk3326";
14
15	joystick_mux_controller: mux-controller {
16		compatible = "gpio-mux";
17		pinctrl = <&mux_en_pins>;
18		#mux-control-cells = <0>;
19
20		mux-gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>,
21			    <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>;
22	};
23
24	joystick_mux: adc-mux {
25		compatible = "io-channel-mux";
26		io-channels = <&saradc 1>;
27		io-channel-names = "parent";
28		#io-channel-cells = <1>;
29
30		mux-controls = <&joystick_mux_controller>;
31		channels = "0", "1", "2", "3";
32	};
33
34	analog_sticks: adc-joystick {
35		compatible = "adc-joystick";
36		io-channels = <&joystick_mux 0>,
37			      <&joystick_mux 1>,
38			      <&joystick_mux 2>,
39			      <&joystick_mux 3>;
40		poll-interval = <60>;
41		#address-cells = <1>;
42		#size-cells = <0>;
43
44		axis@0 {
45			reg = <0>;
46			abs-flat = <10>;
47			abs-fuzz = <10>;
48			abs-range = <180 800>;
49			linux,code = <ABS_X>;
50		};
51
52		axis@1 {
53			reg = <1>;
54			abs-flat = <10>;
55			abs-fuzz = <10>;
56			abs-range = <180 800>;
57			linux,code = <ABS_RX>;
58		};
59
60		axis@2 {
61			reg = <2>;
62			abs-flat = <10>;
63			abs-fuzz = <10>;
64			abs-range = <180 800>;
65			linux,code = <ABS_Y>;
66		};
67
68		axis@3 {
69			reg = <3>;
70			abs-flat = <10>;
71			abs-fuzz = <10>;
72			abs-range = <180 800>;
73			linux,code = <ABS_RY>;
74		};
75	};
76
77	battery: battery {
78		compatible = "simple-battery";
79		charge-full-design-microamp-hours = <4000000>;
80		charge-term-current-microamp = <300000>;
81		constant-charge-current-max-microamp = <2000000>;
82		constant-charge-voltage-max-microvolt = <4200000>;
83		factory-internal-resistance-micro-ohms = <180000>;
84		voltage-max-design-microvolt = <4100000>;
85		voltage-min-design-microvolt = <3500000>;
86
87		ocv-capacity-celsius = <20>;
88		ocv-capacity-table-0 =  <4046950 100>, <4001920 95>, <3967900 90>, <3919950 85>,
89					<3888450 80>, <3861850 75>, <3831540 70>, <3799130 65>,
90					<3768190 60>, <3745650 55>, <3726610 50>, <3711630 45>,
91					<3696720 40>, <3685660 35>, <3674950 30>, <3663050 25>,
92					<3649470 20>, <3635260 15>, <3616920 10>, <3592440 5>,
93					<3574170 0>;
94	};
95
96	gpio-keys-vol {
97		compatible = "gpio-keys";
98		autorepeat;
99		pinctrl-0 = <&btn_pins_vol>;
100		pinctrl-names = "default";
101
102		button-vol-down {
103			gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>;
104			label = "VOLUMEDOWN";
105			linux,code = <KEY_VOLUMEDOWN>;
106		};
107
108		button-volume-up {
109			gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>;
110			label = "VOLUMEUP";
111			linux,code = <KEY_VOLUMEUP>;
112		};
113	};
114};
115
116/* f1 and f2 conflict with volume buttons */
117/delete-node/ &btn_f1;
118/delete-node/ &btn_f2;
119
120&builtin_gamepad {
121	button-sw19 {
122		gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>;
123		label = "SELECT";
124		linux,code = <BTN_SELECT>;
125	};
126	/* note that TR2 and TL2 are swapped */
127	button-sw20 {
128		gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
129		label = "TOP-RIGHT 2";
130		linux,code = <BTN_TR2>;
131	};
132	button-sw21 {
133		gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>;
134		label = "TOP-LEFT 2";
135		linux,code = <BTN_TL2>;
136	};
137	button-sw22 {
138		gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
139		label = "START";
140		linux,code = <BTN_START>;
141	};
142};
143
144&internal_display {
145	status = "disabled";
146};
147
148&rk817_charger {
149	monitored-battery = <&battery>;
150};
151
152&pinctrl {
153	btns {
154		btn_pins: btn-pins {
155			rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>,
156					<1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>,
157					<1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
158					<1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>,
159					<1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>,
160					<1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>,
161					<1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>,
162					<1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>,
163					<2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>,
164					<2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>,
165					<2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
166					<2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>,
167					<2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
168					<2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>,
169					<3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>,
170					<3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
171					<3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>,
172					<3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>;
173		};
174		btn_pins_vol: btn-pins-vol {
175			rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>,
176					<2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
177		};
178	};
179
180	joystick {
181		mux_en_pins: mux-pins {
182			rockchip,pins = <3 RK_PB5 RK_FUNC_GPIO &pcfg_output_low>;
183		};
184	};
185};
186