summaryrefslogtreecommitdiffstats
path: root/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg503.dts
blob: 94e6dd61a2dbb4f1bca3efb7106c1d500ac3cb06 (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)

/dts-v1/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/pinctrl/rockchip.h>
#include "rk3566-anbernic-rgxx3.dtsi"

/ {
	model = "RG503";
	compatible = "anbernic,rg503", "rockchip,rk3566";

	aliases {
		mmc0 = &sdmmc0;
		mmc1 = &sdmmc1;
		mmc2 = &sdmmc2;
	};

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

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

		axis@1 {
			reg = <1>;
			abs-flat = <32>;
			abs-fuzz = <32>;
			abs-range = <15 1023>;
			linux,code = <ABS_RX>;
		};

		axis@2 {
			reg = <2>;
			abs-flat = <32>;
			abs-fuzz = <32>;
			abs-range = <15 1023>;
			linux,code = <ABS_Y>;
		};

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

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

	battery: battery {
		compatible = "simple-battery";
		charge-full-design-microamp-hours = <3472000>;
		charge-term-current-microamp = <300000>;
		constant-charge-current-max-microamp = <2000000>;
		constant-charge-voltage-max-microvolt = <4200000>;
		factory-internal-resistance-micro-ohms = <117000>;
		voltage-max-design-microvolt = <4172000>;
		voltage-min-design-microvolt = <3400000>;

		ocv-capacity-celsius = <20>;
		ocv-capacity-table-0 =	<4172000 100>, <4054000 95>, <3984000 90>, <3926000 85>,
					<3874000 80>, <3826000 75>, <3783000 70>, <3746000 65>,
					<3714000 60>, <3683000 55>, <3650000 50>, <3628000 45>,
					<3612000 40>, <3600000 35>, <3587000 30>, <3571000 25>,
					<3552000 20>, <3525000 15>, <3492000 10>, <3446000 5>,
					<3400000 0>;
	};

	gpio_mux: mux-controller {
		compatible = "gpio-mux";
		mux-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>,
			    <&gpio0 RK_PB7 GPIO_ACTIVE_LOW>;
		#mux-control-cells = <0>;
	};

	gpio_spi: spi {
		compatible = "spi-gpio";
		pinctrl-names = "default";
		pinctrl-0 = <&spi_pins>;
		#address-cells = <1>;
		#size-cells = <0>;

		sck-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>;
		mosi-gpios = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
		cs-gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>;
		num-chipselects = <0>;

		panel@0 {
			compatible = "samsung,ams495qa01";
			reg = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&lcd_reset>;
			reset-gpios = <&gpio4 RK_PA0 GPIO_ACTIVE_LOW>;
			vdd-supply = <&vcc_3v3>;

			port {
				mipi_in_panel: endpoint {
					remote-endpoint = <&mipi_out_panel>;
				};
			};
		};
	};

	/* Channels reversed for both headphones and speakers. */
	sound {
		compatible = "simple-audio-card";
		simple-audio-card,name = "rk817_ext";
		simple-audio-card,aux-devs = <&spk_amp>;
		simple-audio-card,format = "i2s";
		simple-audio-card,hp-det-gpio = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
		simple-audio-card,mclk-fs = <256>;
		simple-audio-card,widgets =
			"Microphone", "Mic Jack",
			"Headphone", "Headphones",
			"Speaker", "Internal Speakers";
		simple-audio-card,routing =
			"MICL", "Mic Jack",
			"Headphones", "HPOL",
			"Headphones", "HPOR",
			"Internal Speakers", "Speaker Amp OUTL",
			"Internal Speakers", "Speaker Amp OUTR",
			"Speaker Amp INL", "HPOL",
			"Speaker Amp INR", "HPOR";
		simple-audio-card,pin-switches = "Internal Speakers";

		simple-audio-card,codec {
			sound-dai = <&rk817>;
		};

		simple-audio-card,cpu {
			sound-dai = <&i2s1_8ch>;
		};
	};

	spk_amp: audio-amplifier {
		compatible = "simple-audio-amplifier";
		enable-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;
		pinctrl-0 = <&spk_amp_enable_h>;
		pinctrl-names = "default";
		sound-name-prefix = "Speaker Amp";
	};
};

&cru {
	assigned-clocks = <&pmucru CLK_RTC_32K>, <&cru PLL_GPLL>,
			  <&pmucru PLL_PPLL>, <&cru PLL_VPLL>;
	assigned-clock-rates = <32768>, <1200000000>,
			       <200000000>, <500000000>;
};

&dsi_dphy0 {
	status = "okay";
};

&dsi0 {
	status = "okay";

	ports {
		dsi0_in: port@0 {
			reg = <0>;

			dsi0_in_vp1: endpoint {
				remote-endpoint = <&vp1_out_dsi0>;
			};
		};

		dsi0_out: port@1 {
			reg = <1>;

			mipi_out_panel: endpoint {
				remote-endpoint = <&mipi_in_panel>;
			};
		};
	};
};

&gpio_keys_control {
	button-a {
		gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>;
		label = "EAST";
		linux,code = <BTN_EAST>;
	};

	button-left {
		gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>;
		label = "DPAD-LEFT";
		linux,code = <BTN_DPAD_LEFT>;
	};

	button-right {
		gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
		label = "DPAD-RIGHT";
		linux,code = <BTN_DPAD_RIGHT>;
	};

	button-r1 {
		gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>;
		label = "TR";
		linux,code = <BTN_TR>;
	};

	button-r2 {
		gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
		label = "TR2";
		linux,code = <BTN_TR2>;
	};

	button-right {
		gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
		label = "DPAD-RIGHT";
		linux,code = <BTN_DPAD_RIGHT>;
	};

	button-thumbl {
		gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>;
		label = "THUMBL";
		linux,code = <BTN_THUMBL>;
	};

	button-thumbr {
		gpios = <&gpio3 RK_PA2 GPIO_ACTIVE_LOW>;
		label = "THUMBR";
		linux,code = <BTN_THUMBR>;
	};

	button-y {
		gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>;
		label = "WEST";
		linux,code = <BTN_WEST>;
	};
};

&pinctrl {
	audio-amplifier {
		spk_amp_enable_h: spk-amp-enable-h {
			rockchip,pins =
				<4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	gpio-lcd {
		lcd_reset: lcd-reset {
			rockchip,pins =
				<4 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	gpio-spi {
		spi_pins: spi-pins {
			rockchip,pins =
				<4 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>,
				<4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>,
				<4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};
};

&rk817 {
	rk817_charger: charger {
		monitored-battery = <&battery>;
		rockchip,resistor-sense-micro-ohms = <10000>;
		rockchip,sleep-enter-current-microamp = <300000>;
		rockchip,sleep-filter-current-microamp = <100000>;
	};
};

&vp1 {
	vp1_out_dsi0: endpoint@ROCKCHIP_VOP2_EP_MIPI0 {
		reg = <ROCKCHIP_VOP2_EP_MIPI0>;
		remote-endpoint = <&dsi0_in_vp1>;
	};
};