xref: /linux/scripts/dtc/include-prefixes/arm64/rockchip/rk3568-anbernic-rg-ds.dts (revision 6589b3d76db2d6adbf8f2084c303fb24252a0dc6)
1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2
3/dts-v1/;
4
5#include <dt-bindings/gpio/gpio.h>
6#include <dt-bindings/input/gpio-keys.h>
7#include <dt-bindings/input/linux-event-codes.h>
8#include <dt-bindings/leds/common.h>
9#include <dt-bindings/pinctrl/rockchip.h>
10#include <dt-bindings/soc/rockchip,vop2.h>
11#include "rk3568.dtsi"
12
13/ {
14	model = "Anbernic RG DS";
15	chassis-type = "handset";
16	compatible = "anbernic,rg-ds", "rockchip,rk3568";
17
18	aliases {
19		mmc0 = &sdhci;
20		mmc1 = &sdmmc0;
21		mmc2 = &sdmmc2;
22	};
23
24	chosen: chosen {
25		stdout-path = "serial2:1500000n8";
26	};
27
28	adc_keys_home: adc-keys-home {
29		compatible = "adc-keys";
30		io-channel-names = "buttons";
31		io-channels = <&saradc 0>;
32		keyup-threshold-microvolt = <1800000>;
33		poll-interval = <60>;
34
35		button-home {
36			label = "HOME";
37			linux,code = <BTN_MODE>;
38			press-threshold-microvolt = <1750>;
39		};
40	};
41
42	adc_keys_play: adc-keys-play {
43		compatible = "adc-keys";
44		io-channel-names = "buttons";
45		io-channels = <&saradc 2>;
46		keyup-threshold-microvolt = <1300000>;
47		poll-interval = <60>;
48
49		button-play {
50			label = "PLAY";
51			linux,code = <KEY_PLAYPAUSE>;
52			press-threshold-microvolt = <1750>;
53		};
54	};
55
56	adc_mux: adc-mux {
57		compatible = "io-channel-mux";
58		channels = "left_x", "right_x", "left_y", "right_y";
59		#io-channel-cells = <1>;
60		io-channels = <&saradc 3>;
61		io-channel-names = "parent";
62		mux-controls = <&gpio_mux>;
63		settle-time-us = <100>;
64	};
65
66	adc-joystick {
67		compatible = "adc-joystick";
68		#address-cells = <1>;
69		io-channels = <&adc_mux 0>,
70			      <&adc_mux 1>,
71			      <&adc_mux 2>,
72			      <&adc_mux 3>;
73		pinctrl-0 = <&joy_mux_en>;
74		pinctrl-names = "default";
75		poll-interval = <60>;
76		#size-cells = <0>;
77
78		axis@0 {
79			reg = <0>;
80			abs-flat = <32>;
81			abs-fuzz = <32>;
82			abs-range = <1023 15>;
83			linux,code = <ABS_X>;
84		};
85
86		axis@1 {
87			reg = <1>;
88			abs-flat = <32>;
89			abs-fuzz = <32>;
90			abs-range = <15 1023>;
91			linux,code = <ABS_RY>;
92		};
93
94		axis@2 {
95			reg = <2>;
96			abs-flat = <32>;
97			abs-fuzz = <32>;
98			abs-range = <15 1023>;
99			linux,code = <ABS_Y>;
100		};
101
102		axis@3 {
103			reg = <3>;
104			abs-flat = <32>;
105			abs-fuzz = <32>;
106			abs-range = <15 1023>;
107			linux,code = <ABS_RX>;
108		};
109	};
110
111	backlight0: backlight0 {
112		compatible = "pwm-backlight";
113		enable-gpios = <&gpio4 RK_PA4 GPIO_ACTIVE_HIGH>;
114		pwms = <&pwm12 0 25000 0>;
115	};
116
117	backlight1: backlight1 {
118		compatible = "pwm-backlight";
119		enable-gpios = <&gpio4 RK_PA3 GPIO_ACTIVE_HIGH>;
120		pwms = <&pwm13 0 25000 0>;
121	};
122
123	/*
124	 * Values taken from BSP device-tree except for
125	 * "charge-full-design-microamp-hours" which was set
126	 * incorrectly at 2500000 (based on markings on the battery it
127	 * should be 4000000), "factory-internal-resistance-micro-ohms"
128	 * which was set at 8 but based on context should likely be 80000.
129	 *
130	 * "constant-charge-current-max-microamp" is set at 10 AMPs
131	 * which is likely incorrect but I cannot validate; furthermore
132	 * the onboard charger of the rk817 cannot charge past 3.5A
133	 * anyway.
134	 */
135	battery: battery {
136		compatible = "simple-battery";
137		charge-full-design-microamp-hours = <4000000>;
138		charge-term-current-microamp = <300000>;
139		constant-charge-current-max-microamp = <10000000>;
140		constant-charge-voltage-max-microvolt = <4350000>;
141		factory-internal-resistance-micro-ohms = <80000>;
142		precharge-current-microamp = <180000>;
143		precharge-upper-limit-microvolt = <3600000>;
144		voltage-max-design-microvolt = <4350000>;
145		voltage-min-design-microvolt = <3000000>;
146
147		/*
148		 * BSP device-tree missing value for 5 percent, so I
149		 * picked a value between 10 and 0.
150		 */
151		ocv-capacity-celsius = <20>;
152		ocv-capacity-table-0 =  <4338000 100>, <4251000 95>,
153					<4191000 90>, <4136000 85>,
154					<4083000 80>, <4039000 75>,
155					<3978000 70>, <3947000 65>,
156					<3908000 60>, <3861000 55>,
157					<3826000 50>, <3786000 45>,
158					<3772000 40>, <3761000 35>,
159					<3749000 30>, <3731000 25>,
160					<3707000 20>, <3677000 15>,
161					<3663000 10>, <3446000 5>,
162					<3400000 0>;
163	};
164
165	gpio_keys_control: gpio-keys-control {
166		compatible = "gpio-keys";
167		pinctrl-0 = <&gamepad_keys_l>;
168		pinctrl-names = "default";
169
170		button-a {
171			gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
172			label = "EAST";
173			linux,code = <BTN_EAST>;
174		};
175
176		button-b {
177			gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>;
178			label = "SOUTH";
179			linux,code = <BTN_SOUTH>;
180		};
181
182		button-down {
183			gpios = <&gpio2 RK_PD5 GPIO_ACTIVE_LOW>;
184			label = "DPAD-DOWN";
185			linux,code = <BTN_DPAD_DOWN>;
186		};
187
188		button-l1 {
189			gpios = <&gpio3 RK_PA3 GPIO_ACTIVE_LOW>;
190			label = "TL";
191			linux,code = <BTN_TL>;
192		};
193
194		button-l2 {
195			gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>;
196			label = "TL2";
197			linux,code = <BTN_TL2>;
198		};
199
200		button-left {
201			gpios = <&gpio2 RK_PD7 GPIO_ACTIVE_LOW>;
202			label = "DPAD-LEFT";
203			linux,code = <BTN_DPAD_LEFT>;
204		};
205
206		button-menu {
207			gpios = <&gpio2 RK_PD1 GPIO_ACTIVE_LOW>;
208			label = "HOME";
209			linux,code = <KEY_HOME>;
210		};
211
212		button-right {
213			gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_LOW>;
214			label = "DPAD-RIGHT";
215			linux,code = <BTN_DPAD_RIGHT>;
216		};
217
218		button-r1 {
219			gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>;
220			label = "T2";
221			linux,code = <BTN_TR>;
222		};
223
224		button-r2 {
225			gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
226			label = "TR2";
227			linux,code = <BTN_TR2>;
228		};
229
230		button-select {
231			gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>;
232			label = "SELECT";
233			linux,code = <BTN_SELECT>;
234		};
235
236		button-start {
237			gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>;
238			label = "START";
239			linux,code = <BTN_START>;
240		};
241
242		button-thumbl {
243			gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_LOW>;
244			label = "THUMBL";
245			linux,code = <BTN_THUMBL>;
246		};
247
248		button-thumbr {
249			gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>;
250			label = "THUMBR";
251			linux,code = <BTN_THUMBR>;
252		};
253
254		button-up {
255			gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_LOW>;
256			label = "DPAD-UP";
257			linux,code = <BTN_DPAD_UP>;
258		};
259
260		button-x {
261			gpios = <&gpio3 RK_PA7 GPIO_ACTIVE_LOW>;
262			label = "NORTH";
263			linux,code = <BTN_NORTH>;
264		};
265
266		button-y {
267			gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>;
268			label = "WEST";
269			linux,code = <BTN_WEST>;
270		};
271	};
272
273	gpio_keys_hall: gpio-keys-hall {
274		compatible = "gpio-keys";
275		pinctrl-0 = <&hall_int_l>;
276		pinctrl-names = "default";
277
278		lid-switch {
279			gpios = <&gpio0 RK_PC3 GPIO_ACTIVE_LOW>;
280			label = "LID";
281			linux,code = <SW_LID>;
282			linux,input-type = <EV_SW>;
283			wakeup-event-action = <EV_ACT_DEASSERTED>;
284			wakeup-source;
285		};
286	};
287
288	gpio_keys_volume: gpio-keys-volume {
289		compatible = "gpio-keys";
290		autorepeat;
291		pinctrl-0 = <&vol_keys_l>;
292		pinctrl-names = "default";
293
294		vol-down-key {
295			gpios = <&gpio3 RK_PA2 GPIO_ACTIVE_LOW>;
296			label = "VOLUMEDOWN";
297			linux,code = <KEY_VOLUMEDOWN>;
298		};
299
300		vol-up-key {
301			gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_LOW>;
302			label = "VOLUMEUP";
303			linux,code = <KEY_VOLUMEUP>;
304		};
305	};
306
307	gpio_mux: mux-controller {
308		compatible = "gpio-mux";
309		#mux-control-cells = <0>;
310		mux-gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>,
311			    <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>;
312		pinctrl-0 = <&joy_mux_config>;
313		pinctrl-names = "default";
314	};
315
316	leds: pwm-leds {
317		compatible = "pwm-leds";
318
319		green_led: led-0 {
320			color = <LED_COLOR_ID_GREEN>;
321			default-state = "on";
322			function = LED_FUNCTION_POWER;
323			max-brightness = <255>;
324			pwms = <&pwm5 0 25000 0>;
325		};
326
327		amber_led: led-1 {
328			color = <LED_COLOR_ID_AMBER>;
329			function = LED_FUNCTION_CHARGING;
330			max-brightness = <255>;
331			pwms = <&pwm6 0 25000 0>;
332		};
333
334		red_led: led-2 {
335			color = <LED_COLOR_ID_RED>;
336			default-state = "off";
337			function = LED_FUNCTION_STATUS;
338			max-brightness = <255>;
339			pwms = <&pwm7 0 25000 0>;
340		};
341	};
342
343	sdio_pwrseq: sdio-pwrseq {
344		compatible = "mmc-pwrseq-simple";
345		clock-names = "ext_clock";
346		clocks = <&rk817 1>;
347		pinctrl-0 = <&wifi_enable_h>;
348		pinctrl-names = "default";
349		post-power-on-delay-ms = <200>;
350		reset-gpios = <&gpio4 RK_PA2 GPIO_ACTIVE_LOW>;
351	};
352
353	sound {
354		compatible = "simple-audio-card";
355		pinctrl-0 = <&hp_det>;
356		pinctrl-names = "default";
357		simple-audio-card,format = "i2s";
358		simple-audio-card,hp-det-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;
359		simple-audio-card,mclk-fs = <256>;
360		simple-audio-card,name = "rk817_ext";
361		simple-audio-card,pin-switches = "Internal Speakers";
362		simple-audio-card,routing =
363			"MICL", "Mic Jack",
364			"Headphones", "HPOL",
365			"Headphones", "HPOR",
366			"Internal Speakers", "HPOL",
367			"Internal Speakers", "HPOR";
368		simple-audio-card,widgets =
369			"Microphone", "Mic Jack",
370			"Headphone", "Headphones",
371			"Speaker", "Internal Speakers";
372
373		simple-audio-card,codec {
374			sound-dai = <&rk817>;
375		};
376
377		simple-audio-card,cpu {
378			sound-dai = <&i2s1_8ch>;
379		};
380	};
381
382	vdd_lcd0: regulator-vdd-lcd0 {
383		compatible = "regulator-fixed";
384		enable-active-high;
385		gpio = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>;
386		pinctrl-0 = <&vdd_lcd0_h>;
387		pinctrl-names = "default";
388		regulator-name = "vdd_lcd0";
389		regulator-state-mem {
390			regulator-off-in-suspend;
391		};
392	};
393
394	vccio_lcd0: regulator-vccio-lcd0 {
395		compatible = "regulator-fixed";
396		enable-active-high;
397		gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>;
398		pinctrl-0 = <&vccio_lcd0_h>;
399		pinctrl-names = "default";
400		regulator-name = "vccio_lcd0";
401		regulator-state-mem {
402			regulator-off-in-suspend;
403		};
404	};
405
406	vdd_lcd1: regulator-vdd-lcd1 {
407		compatible = "regulator-fixed";
408		enable-active-high;
409		gpio = <&gpio0 RK_PC2 GPIO_ACTIVE_HIGH>;
410		pinctrl-0 = <&vdd_lcd1_h>;
411		pinctrl-names = "default";
412		regulator-name = "vdd_lcd1";
413		regulator-state-mem {
414			regulator-off-in-suspend;
415		};
416	};
417
418	vccio_lcd1: regulator-vccio-lcd1 {
419		compatible = "regulator-fixed";
420		enable-active-high;
421		gpio = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>;
422		pinctrl-0 = <&vccio_lcd1_h>;
423		pinctrl-names = "default";
424		regulator-name = "vccio_lcd1";
425		regulator-state-mem {
426			regulator-off-in-suspend;
427		};
428	};
429
430	vcc3v3_sd: regulator-vcc3v3-sd {
431		compatible = "regulator-fixed";
432		gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
433		pinctrl-0 = <&sdmmc_pwren_l>;
434		pinctrl-names = "default";
435		regulator-always-on;
436		regulator-boot-on;
437		regulator-name = "vcc3v3_sd";
438		regulator-min-microvolt = <3300000>;
439		regulator-max-microvolt = <3300000>;
440		vin-supply = <&vccio_sd>;
441	};
442
443	vcc_sys: regulator-vcc-sys {
444		compatible = "regulator-fixed";
445		regulator-always-on;
446		regulator-boot-on;
447		regulator-min-microvolt = <3800000>;
448		regulator-max-microvolt = <3800000>;
449		regulator-name = "vcc_sys";
450	};
451
452	vibrator: pwm-vibrator {
453		compatible = "pwm-vibrator";
454		pwm-names = "enable";
455		pwms = <&pwm14 0 100000 0>;
456		vcc-supply = <&vcc_sys>;
457	};
458
459	vcc_wifi: regulator-vcc-wifi {
460		compatible = "regulator-fixed";
461		enable-active-high;
462		gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
463		pinctrl-0 = <&vcc_wifi_h>;
464		pinctrl-names = "default";
465		regulator-always-on;
466		regulator-boot-on;
467		regulator-min-microvolt = <3300000>;
468		regulator-max-microvolt = <3300000>;
469		regulator-name = "vcc_wifi";
470	};
471};
472
473&cpu0 {
474	cpu-supply = <&vdd_cpu>;
475};
476
477&cpu1 {
478	cpu-supply = <&vdd_cpu>;
479};
480
481&cpu2 {
482	cpu-supply = <&vdd_cpu>;
483};
484
485&cpu3 {
486	cpu-supply = <&vdd_cpu>;
487};
488
489&cru {
490	assigned-clocks = <&pmucru CLK_RTC_32K>, <&cru PLL_GPLL>,
491			  <&pmucru PLL_PPLL>, <&cru PLL_VPLL>;
492	assigned-clock-rates = <32768>, <1200000000>,
493			       <200000000>, <292500000>;
494};
495
496&dsi0 {
497	status = "okay";
498	#address-cells = <1>;
499	#size-cells = <0>;
500
501	ports {
502		dsi0_in: port@0 {
503			reg = <0>;
504			dsi0_in_vp0: endpoint {
505				remote-endpoint = <&vp0_out_dsi0>;
506			};
507		};
508
509		dsi0_out: port@1 {
510			reg = <1>;
511			mipi_out_panel0: endpoint {
512				remote-endpoint = <&mipi_in_panel0>;
513			};
514		};
515	};
516
517	panel0: panel@0 {
518		compatible = "anbernic,rg-ds-display-bottom", "jadard,jd9365da-h3";
519		reg = <0>;
520		backlight = <&backlight0>;
521		pinctrl-0 = <&lcd0_rst>;
522		pinctrl-names = "default";
523		reset-gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_LOW>;
524		vdd-supply = <&vdd_lcd0>;
525		vccio-supply = <&vccio_lcd0>;
526
527		port {
528			mipi_in_panel0: endpoint {
529				remote-endpoint = <&mipi_out_panel0>;
530			};
531		};
532	};
533};
534
535&dsi1 {
536	status = "okay";
537	#address-cells = <1>;
538	#size-cells = <0>;
539
540	ports {
541		dsi1_in: port@0 {
542			reg = <0>;
543			dsi1_in_vp1: endpoint {
544				remote-endpoint = <&vp1_out_dsi1>;
545			};
546		};
547
548		dsi1_out: port@1 {
549			reg = <1>;
550			mipi_out_panel1: endpoint {
551				remote-endpoint = <&mipi_in_panel1>;
552			};
553		};
554	};
555
556	panel1: panel@0 {
557		compatible = "anbernic,rg-ds-display-top", "jadard,jd9365da-h3";
558		reg = <0>;
559		backlight = <&backlight1>;
560		pinctrl-0 = <&lcd1_rst>;
561		pinctrl-names = "default";
562		reset-gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_LOW>;
563		vdd-supply = <&vdd_lcd1>;
564		vccio-supply = <&vccio_lcd1>;
565
566		port {
567			mipi_in_panel1: endpoint {
568				remote-endpoint = <&mipi_out_panel1>;
569			};
570		};
571	};
572};
573
574&dsi_dphy0 {
575	status = "okay";
576};
577
578&dsi_dphy1 {
579	status = "okay";
580};
581
582&gpu {
583	mali-supply = <&vdd_gpu>;
584	status = "okay";
585};
586
587&i2c0 {
588	status = "okay";
589
590	rk817: pmic@20 {
591		compatible = "rockchip,rk817";
592		reg = <0x20>;
593		assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>;
594		assigned-clocks = <&cru I2S1_MCLKOUT_TX>;
595		#clock-cells = <1>;
596		clock-names = "mclk";
597		clock-output-names = "rk808-clkout1", "rk808-clkout2";
598		clocks = <&cru I2S1_MCLKOUT_TX>;
599		interrupt-parent = <&gpio0>;
600		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
601		pinctrl-0 = <&i2s1m0_mclk &pmic_int_l>;
602		pinctrl-names = "default";
603		#sound-dai-cells = <0>;
604		system-power-controller;
605		wakeup-source;
606
607		vcc1-supply = <&vcc_sys>;
608		vcc2-supply = <&vcc_sys>;
609		vcc3-supply = <&vcc_sys>;
610		vcc4-supply = <&vcc_sys>;
611		vcc5-supply = <&vcc_sys>;
612		vcc6-supply = <&vcc_sys>;
613		vcc7-supply = <&vcc_sys>;
614		vcc8-supply = <&vcc_sys>;
615		vcc9-supply = <&dcdc_boost>;
616
617		regulators {
618			vdd_logic: DCDC_REG1 {
619				regulator-always-on;
620				regulator-boot-on;
621				regulator-initial-mode = <0x2>;
622				regulator-max-microvolt = <1350000>;
623				regulator-min-microvolt = <900000>;
624				regulator-name = "vdd_logic";
625				regulator-ramp-delay = <6001>;
626				regulator-state-mem {
627					regulator-on-in-suspend;
628					regulator-suspend-microvolt = <900000>;
629				};
630			};
631
632			vdd_gpu: DCDC_REG2 {
633				regulator-always-on;
634				regulator-boot-on;
635				regulator-initial-mode = <0x2>;
636				regulator-max-microvolt = <1350000>;
637				regulator-min-microvolt = <825000>;
638				regulator-name = "vdd_gpu";
639				regulator-ramp-delay = <6001>;
640				regulator-state-mem {
641					regulator-off-in-suspend;
642				};
643			};
644
645			vcc_ddr: DCDC_REG3 {
646				regulator-always-on;
647				regulator-boot-on;
648				regulator-initial-mode = <0x2>;
649				regulator-name = "vcc_ddr";
650				regulator-state-mem {
651					regulator-on-in-suspend;
652				};
653			};
654
655			vcc_3v3: DCDC_REG4 {
656				regulator-always-on;
657				regulator-boot-on;
658				regulator-initial-mode = <0x2>;
659				regulator-max-microvolt = <3300000>;
660				regulator-min-microvolt = <3300000>;
661				regulator-name = "vcc_3v3";
662				regulator-state-mem {
663					regulator-on-in-suspend;
664					regulator-suspend-microvolt = <3300000>;
665				};
666			};
667
668			vcca1v8_pmu: LDO_REG1 {
669				regulator-always-on;
670				regulator-boot-on;
671				regulator-max-microvolt = <1800000>;
672				regulator-min-microvolt = <1800000>;
673				regulator-name = "vcca1v8_pmu";
674				regulator-state-mem {
675					regulator-on-in-suspend;
676					regulator-suspend-microvolt = <1800000>;
677				};
678			};
679
680			vdda_0v9: LDO_REG2 {
681				regulator-always-on;
682				regulator-boot-on;
683				regulator-max-microvolt = <900000>;
684				regulator-min-microvolt = <900000>;
685				regulator-name = "vdda_0v9";
686				regulator-state-mem {
687					regulator-off-in-suspend;
688				};
689			};
690
691			vdda0v9_pmu: LDO_REG3 {
692				regulator-always-on;
693				regulator-boot-on;
694				regulator-max-microvolt = <900000>;
695				regulator-min-microvolt = <900000>;
696				regulator-name = "vdda0v9_pmu";
697				regulator-state-mem {
698					regulator-on-in-suspend;
699					regulator-suspend-microvolt = <900000>;
700				};
701			};
702
703			vccio_acodec: LDO_REG4 {
704				regulator-always-on;
705				regulator-boot-on;
706				regulator-max-microvolt = <3300000>;
707				regulator-min-microvolt = <3300000>;
708				regulator-name = "vccio_acodec";
709				regulator-state-mem {
710					regulator-off-in-suspend;
711				};
712			};
713
714			vccio_sd: LDO_REG5 {
715				regulator-always-on;
716				regulator-boot-on;
717				regulator-max-microvolt = <3300000>;
718				regulator-min-microvolt = <1800000>;
719				regulator-name = "vccio_sd";
720				regulator-state-mem {
721					regulator-off-in-suspend;
722				};
723			};
724
725			vcc3v3_pmu: LDO_REG6 {
726				regulator-always-on;
727				regulator-boot-on;
728				regulator-max-microvolt = <3300000>;
729				regulator-min-microvolt = <3300000>;
730				regulator-name = "vcc3v3_pmu";
731				regulator-state-mem {
732					regulator-on-in-suspend;
733					regulator-suspend-microvolt = <3300000>;
734				};
735			};
736
737			vcc_1v8: LDO_REG7 {
738				regulator-always-on;
739				regulator-boot-on;
740				regulator-max-microvolt = <1800000>;
741				regulator-min-microvolt = <1800000>;
742				regulator-name = "vcc_1v8";
743				regulator-state-mem {
744					regulator-on-in-suspend;
745				};
746			};
747
748			vcc1v8_dvp: LDO_REG8 {
749				regulator-always-on;
750				regulator-boot-on;
751				regulator-max-microvolt = <3300000>;
752				regulator-min-microvolt = <1800000>;
753				regulator-name = "vcc1v8_dvp";
754				regulator-state-mem {
755					regulator-off-in-suspend;
756				};
757			};
758
759			vcc2v8_dvp: LDO_REG9 {
760				regulator-always-on;
761				regulator-boot-on;
762				regulator-max-microvolt = <2800000>;
763				regulator-min-microvolt = <2800000>;
764				regulator-name = "vcc2v8_dvp";
765				regulator-state-mem {
766					regulator-off-in-suspend;
767				};
768			};
769
770			dcdc_boost: BOOST {
771				regulator-always-on;
772				regulator-boot-on;
773				regulator-max-microvolt = <5400000>;
774				regulator-min-microvolt = <4700000>;
775				regulator-name = "boost";
776				regulator-state-mem {
777					regulator-off-in-suspend;
778				};
779			};
780
781			otg_switch: OTG_SWITCH {
782				regulator-name = "otg_switch";
783				regulator-state-mem {
784					regulator-off-in-suspend;
785				};
786			};
787		};
788
789	       rk817_charger: charger {
790			monitored-battery = <&battery>;
791			rockchip,resistor-sense-micro-ohms = <10000>;
792			rockchip,sleep-enter-current-microamp = <150000>;
793			rockchip,sleep-filter-current-microamp = <100000>;
794		};
795	};
796
797	vdd_cpu: regulator@40 {
798		compatible = "silergy,syr827";
799		reg = <0x40>;
800		fcs,suspend-voltage-selector = <1>;
801		regulator-always-on;
802		regulator-boot-on;
803		regulator-max-microvolt = <1390000>;
804		regulator-min-microvolt = <712500>;
805		regulator-name = "vdd_cpu";
806		regulator-ramp-delay = <2300>;
807		vin-supply = <&vcc_sys>;
808		regulator-state-mem {
809			regulator-off-in-suspend;
810		};
811	};
812
813	/*
814	 * Currently the rk817_charger and the cw2015 don't work together.
815	 * Disable the cw2015 for now because it performs the same function
816	 * as the rk817_charger for battery monitoring.
817	 */
818	cw2015: battery@62 {
819		compatible = "cellwise,cw2015";
820		reg = <0x62>;
821		cellwise,battery-profile = /bits/ 8
822				< 0x17 0x67 0x81 0x6F 0x69 0x65 0x63 0x54
823				 0x75 0x50 0x57 0x56 0x4E 0x4F 0x44 0x35
824				 0x2C 0x24 0x1E 0x1B 0x24 0x32 0x41 0x4D
825				 0x1C 0x57 0x0B 0x85 0x34 0x54 0x59 0x6D
826				 0x85 0x81 0x81 0x84 0x3C 0x1B 0x6C 0x6C
827				 0x0B 0x41 0x1C 0x4D 0x80 0x95 0xA0 0x14
828				 0x38 0x7E 0x98 0xA3 0x80 0x89 0x97 0xCB
829				 0x2F 0x00 0x64 0xA5 0xB5 0xC1 0x46 0xAE>;
830		cellwise,monitor-interval-ms = <5000>;
831		monitored-battery = <&battery>;
832		power-supplies = <&rk817_charger>;
833		status = "disabled";
834	};
835};
836
837&i2c2 {
838	clock-frequency = <200000>;
839	pinctrl-0 = <&i2c2m1_xfer>;
840	pinctrl-names = "default";
841	status = "okay";
842
843	/* awinic,aw87391 at 0x58 */
844	/* awinic,aw87391 at 0x5b */
845	/* invensense,icm42607p at 0x68 */
846};
847
848&i2c3 {
849	clock-frequency = <400000>;
850	pinctrl-0 = <&i2c3m1_xfer>;
851	pinctrl-names = "default";
852	status = "okay";
853
854	touch1: touchscreen@14 {
855		compatible = "goodix,gt911";
856		reg = <0x14>;
857		AVDD28-supply = <&vcc2v8_dvp>;
858		interrupt-parent = <&gpio0>;
859		interrupts = <RK_PC0 IRQ_TYPE_LEVEL_LOW>;
860		irq-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_HIGH>;
861		panel = <&panel1>;
862		reset-gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>;
863		touchscreen-size-x = <640>;
864		touchscreen-size-y = <480>;
865		touchscreen-inverted-x;
866		touchscreen-inverted-y;
867		pinctrl-0 = <&touch1_rst &touch1_irq>;
868		pinctrl-names = "default";
869		VDDIO-supply = <&vcc3v3_pmu>;
870	};
871};
872
873&i2c5 {
874	clock-frequency = <400000>;
875	pinctrl-0 = <&i2c5m0_xfer>;
876	pinctrl-names = "default";
877	status = "okay";
878
879	touch0: touchscreen@14 {
880		compatible = "goodix,gt911";
881		reg = <0x14>;
882		AVDD28-supply = <&vcc2v8_dvp>;
883		interrupt-parent = <&gpio0>;
884		interrupts = <RK_PB6 IRQ_TYPE_LEVEL_LOW>;
885		irq-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>;
886		panel = <&panel0>;
887		reset-gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
888		touchscreen-size-x = <640>;
889		touchscreen-size-y = <480>;
890		pinctrl-0 = <&touch0_rst &touch0_irq>;
891		pinctrl-names = "default";
892		VDDIO-supply = <&vcc3v3_pmu>;
893	};
894
895	/* Unused iSmartWare SW2001 encryption device at 0x3c */
896};
897
898&i2s1_8ch {
899	pinctrl-0 = <&i2s1m0_sclktx &i2s1m0_lrcktx &i2s1m0_sdi0 &i2s1m0_sdo0>;
900	pinctrl-names = "default";
901	rockchip,trcm-sync-tx-only;
902	status = "okay";
903};
904
905&pinctrl {
906	gpio-keys {
907		vol_keys_l: vol-keys_l {
908			rockchip,pins =
909				<3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>,
910				<3 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
911		};
912
913		gamepad_keys_l: gamepad-keys-l {
914			rockchip,pins =
915				<2 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>,
916				<2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>,
917				<2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>,
918				<2 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>,
919				<2 RK_PD5 RK_FUNC_GPIO &pcfg_pull_up>,
920				<2 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>,
921				<2 RK_PD7 RK_FUNC_GPIO &pcfg_pull_up>,
922				<3 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>,
923				<3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
924				<3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>,
925				<3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
926				<3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>,
927				<3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>,
928				<3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>,
929				<3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
930				<3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>,
931				<3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_up>;
932		};
933	};
934
935	gpio-lcd {
936		lcd0_rst: lcd0-rst {
937			rockchip,pins =
938				<0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
939		};
940
941		lcd1_rst: lcd1-rst {
942			rockchip,pins =
943				<0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
944		};
945	};
946
947	hall-sensor {
948		hall_int_l: hal-int-l {
949			rockchip,pins =
950				<0 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
951		};
952	};
953
954	hp-detect {
955		hp_det: hp-det {
956			rockchip,pins =
957				<4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
958		};
959	};
960
961	joy-mux {
962		joy_mux_en: joy-mux-en {
963			rockchip,pins =
964				<3 RK_PC1 RK_FUNC_GPIO &pcfg_output_low>;
965		};
966
967		joy_mux_config: joy-mux-config {
968			rockchip,pins =
969				<3 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>,
970				<3 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
971		};
972	};
973
974	pmic {
975		pmic_int_l: pmic-int-l {
976			rockchip,pins =
977				<0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
978		};
979	};
980
981	sdio-pwrseq {
982		wifi_enable_h: wifi-enable-h {
983			rockchip,pins =
984				<4 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
985		};
986	};
987
988	sdmmc {
989		sdmmc_pwren_l: sdmmc-pwren-l {
990			rockchip,pins =
991				<0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
992		};
993	};
994
995	touch {
996		touch0_rst: touch0-rst {
997			rockchip,pins =
998				<0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>;
999		};
1000
1001		touch0_irq: touch0-irq {
1002			rockchip,pins =
1003				<0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>;
1004		};
1005
1006		touch1_rst: touch1-rst {
1007			rockchip,pins =
1008				<0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>;
1009		};
1010
1011		touch1_irq: touch1-irq {
1012			rockchip,pins =
1013				<0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_up>;
1014		};
1015	};
1016
1017	vcc-lcd {
1018		vdd_lcd0_h: vdd-lcd0-h {
1019			rockchip,pins =
1020				<0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>;
1021		};
1022
1023		vccio_lcd0_h: vccio-lcd0-h {
1024			rockchip,pins =
1025				<0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
1026		};
1027
1028		vdd_lcd1_h: vdd-lcd1-h {
1029			rockchip,pins =
1030				<0 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
1031		};
1032
1033		vccio_lcd1_h: vccio-lcd1-h {
1034			rockchip,pins =
1035				<0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
1036		};
1037	};
1038
1039	vcc-wifi {
1040		vcc_wifi_h: vcc-wifi-h {
1041			rockchip,pins =
1042				<0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
1043		};
1044	};
1045
1046	wifi-irq {
1047		wifi_host_wake_irq: wifi-host-wake-irq {
1048			rockchip,pins =
1049				<4 RK_PA1 RK_FUNC_GPIO &pcfg_pull_down>;
1050		};
1051	};
1052};
1053
1054&pmu_io_domains {
1055	status = "okay";
1056	pmuio1-supply = <&vcc3v3_pmu>;
1057	pmuio2-supply = <&vcc3v3_pmu>;
1058	vccio1-supply = <&vccio_acodec>;
1059	vccio3-supply = <&vccio_sd>;
1060	vccio4-supply = <&vcc_3v3>;
1061	vccio5-supply = <&vcc_3v3>;
1062	vccio6-supply = <&vcc_1v8>;
1063	vccio7-supply = <&vcc_3v3>;
1064};
1065
1066&pwm5 {
1067	pinctrl-0 = <&pwm5_pins>;
1068	pinctrl-names = "default";
1069	status = "okay";
1070};
1071
1072&pwm6 {
1073	pinctrl-0 = <&pwm6_pins>;
1074	pinctrl-names = "default";
1075	status = "okay";
1076};
1077
1078&pwm7 {
1079	pinctrl-0 = <&pwm7_pins>;
1080	pinctrl-names = "default";
1081	status = "okay";
1082};
1083
1084&pwm12 {
1085	pinctrl-0 = <&pwm12m1_pins>;
1086	pinctrl-names = "default";
1087	status = "okay";
1088};
1089
1090&pwm13 {
1091	pinctrl-0 = <&pwm13m1_pins>;
1092	pinctrl-names = "default";
1093	status = "okay";
1094};
1095
1096&pwm14 {
1097	pinctrl-0 = <&pwm14m0_pins>;
1098	pinctrl-names = "default";
1099	status = "okay";
1100};
1101
1102&saradc {
1103	vref-supply = <&vcc_1v8>;
1104	status = "okay";
1105};
1106
1107&sdhci {
1108	bus-width = <8>;
1109	max-frequency = <200000000>;
1110	no-sd;
1111	no-sdio;
1112	non-removable;
1113	pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe &emmc_rstnout>;
1114	pinctrl-names = "default";
1115	status = "okay";
1116};
1117
1118&sdmmc0 {
1119	bus-width = <4>;
1120	cap-sd-highspeed;
1121	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
1122	disable-wp;
1123	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
1124	pinctrl-names = "default";
1125	sd-uhs-sdr104;
1126	vmmc-supply = <&vcc3v3_sd>;
1127	vqmmc-supply = <&vccio_sd>;
1128	status = "okay";
1129};
1130
1131&sdmmc2 {
1132	#address-cells = <1>;
1133	bus-width = <4>;
1134	cap-sd-highspeed;
1135	cap-sdio-irq;
1136	keep-power-in-suspend;
1137	max-frequency = <100000000>;
1138	mmc-pwrseq = <&sdio_pwrseq>;
1139	non-removable;
1140	pinctrl-0 = <&sdmmc2m0_bus4 &sdmmc2m0_clk &sdmmc2m0_cmd>;
1141	pinctrl-names = "default";
1142	sd-uhs-sdr104;
1143	#size-cells = <0>;
1144	vmmc-supply = <&vcc_wifi>;
1145	status = "okay";
1146
1147	sdio_wifi: wifi@1 {
1148		reg = <1>;
1149		interrupt-parent = <&gpio4>;
1150		interrupts = <RK_PA1 IRQ_TYPE_LEVEL_LOW>;
1151		interrupt-names = "host-wake";
1152		pinctrl-0 = <&wifi_host_wake_irq>;
1153		pinctrl-names = "default";
1154	};
1155};
1156
1157&tsadc {
1158	rockchip,hw-tshut-mode = <0>;
1159	rockchip,hw-tshut-polarity = <0>;
1160	status = "okay";
1161};
1162
1163&uart1 {
1164	pinctrl-0 = <&uart1m1_xfer &uart1m1_ctsn &uart1m1_rtsn>;
1165	pinctrl-names = "default";
1166	uart-has-rtscts;
1167	status = "okay";
1168
1169	bluetooth {
1170		compatible = "realtek,rtl8821cs-bt", "realtek,rtl8723bs-bt";
1171		device-wake-gpios = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>;
1172		enable-gpios = <&gpio0 RK_PD5 GPIO_ACTIVE_HIGH>;
1173		host-wake-gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>;
1174	};
1175};
1176
1177/* No DMA for a debug serial console. */
1178&uart2 {
1179	/delete-property/ dmas;
1180	status = "okay";
1181};
1182
1183&usb_host0_xhci {
1184	dr_mode = "peripheral";
1185	phy-names = "usb2-phy";
1186	phys = <&usb2phy0_otg>;
1187	maximum-speed = "high-speed";
1188	status = "okay";
1189};
1190
1191&usb_host0_ehci {
1192	status = "okay";
1193};
1194
1195&usb_host0_ohci {
1196	status = "okay";
1197};
1198
1199&usb2phy0 {
1200	status = "okay";
1201};
1202
1203&usb2phy0_otg {
1204	status = "okay";
1205};
1206
1207&usb2phy1 {
1208	status = "okay";
1209};
1210
1211&usb2phy1_otg {
1212	status = "okay";
1213};
1214
1215&vop {
1216	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
1217	assigned-clock-parents = <&cru PLL_VPLL>, <&cru PLL_VPLL>;
1218	status = "okay";
1219};
1220
1221&vop_mmu {
1222	status = "okay";
1223};
1224
1225&vp0 {
1226	vp0_out_dsi0: endpoint@ROCKCHIP_VOP2_EP_MIPI0 {
1227		reg = <ROCKCHIP_VOP2_EP_MIPI0>;
1228		remote-endpoint = <&dsi0_in_vp0>;
1229	};
1230};
1231
1232&vp1 {
1233	vp1_out_dsi1: endpoint@ROCKCHIP_VOP2_EP_MIPI1 {
1234		reg = <ROCKCHIP_VOP2_EP_MIPI1>;
1235		remote-endpoint = <&dsi1_in_vp1>;
1236	};
1237};
1238