xref: /linux/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts (revision 26bda0dff9ca74ae071643e0176f248d72f43580)
1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2020 Martijn Braam <martijn@brixit.nl>
4 * Copyright (c) 2021 Kamil Trzciński <ayufan@ayufan.eu>
5 */
6
7/*
8 * PinePhone Pro datasheet:
9 * https://files.pine64.org/doc/PinePhonePro/PinephonePro-Schematic-V1.0-20211127.pdf
10 */
11
12/dts-v1/;
13#include <dt-bindings/input/gpio-keys.h>
14#include <dt-bindings/input/linux-event-codes.h>
15#include <dt-bindings/leds/common.h>
16#include "rk3399-s.dtsi"
17
18/ {
19	model = "Pine64 PinePhone Pro";
20	compatible = "pine64,pinephone-pro", "rockchip,rk3399";
21	chassis-type = "handset";
22
23	aliases {
24		mmc0 = &sdio0;
25		mmc1 = &sdmmc;
26		mmc2 = &sdhci;
27	};
28
29	chosen {
30		stdout-path = "serial2:115200n8";
31	};
32
33	adc-keys {
34		compatible = "adc-keys";
35		io-channels = <&saradc 1>;
36		io-channel-names = "buttons";
37		keyup-threshold-microvolt = <1600000>;
38		poll-interval = <100>;
39
40		button-up {
41			label = "Volume Up";
42			linux,code = <KEY_VOLUMEUP>;
43			press-threshold-microvolt = <100000>;
44		};
45
46		button-down {
47			label = "Volume Down";
48			linux,code = <KEY_VOLUMEDOWN>;
49			press-threshold-microvolt = <600000>;
50		};
51	};
52
53	backlight: backlight {
54		compatible = "pwm-backlight";
55		pwms = <&pwm0 0 50000 0>;
56	};
57
58	gpio-keys {
59		compatible = "gpio-keys";
60		pinctrl-names = "default";
61		pinctrl-0 = <&pwrbtn_pin>;
62
63		key-power {
64			debounce-interval = <20>;
65			gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
66			label = "Power";
67			linux,code = <KEY_POWER>;
68			wakeup-source;
69		};
70	};
71
72	leds {
73		compatible = "gpio-leds";
74		pinctrl-names = "default";
75		pinctrl-0 = <&red_led_pin &green_led_pin &blue_led_pin>;
76
77		led_red: led-0 {
78			color = <LED_COLOR_ID_RED>;
79			gpios = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>;
80		};
81
82		led_green: led-1 {
83			color = <LED_COLOR_ID_GREEN>;
84			gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>;
85		};
86
87		led_blue: led-2 {
88			color = <LED_COLOR_ID_BLUE>;
89			gpios = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>;
90		};
91	};
92
93	multi-led {
94		compatible = "leds-group-multicolor";
95		color = <LED_COLOR_ID_RGB>;
96		function = LED_FUNCTION_INDICATOR;
97		leds = <&led_red>, <&led_green>, <&led_blue>;
98	};
99
100	vcc_sys: regulator-vcc-sys {
101		compatible = "regulator-fixed";
102		regulator-name = "vcc_sys";
103		regulator-always-on;
104		regulator-boot-on;
105	};
106
107	vcc3v3_sys: regulator-vcc3v3-sys {
108		compatible = "regulator-fixed";
109		regulator-name = "vcc3v3_sys";
110		regulator-always-on;
111		regulator-boot-on;
112		regulator-min-microvolt = <3300000>;
113		regulator-max-microvolt = <3300000>;
114		vin-supply = <&vcc_sys>;
115	};
116
117	vcca1v8_s3: regulator-vcc1v8-s3 {
118		compatible = "regulator-fixed";
119		regulator-name = "vcca1v8_s3";
120		regulator-min-microvolt = <1800000>;
121		regulator-max-microvolt = <1800000>;
122		vin-supply = <&vcc3v3_sys>;
123		regulator-always-on;
124		regulator-boot-on;
125	};
126
127	vcc1v8_codec: regulator-vcc1v8-codec {
128		compatible = "regulator-fixed";
129		enable-active-high;
130		gpio = <&gpio3 RK_PA4 GPIO_ACTIVE_HIGH>;
131		pinctrl-names = "default";
132		pinctrl-0 = <&vcc1v8_codec_en>;
133		regulator-name = "vcc1v8_codec";
134		regulator-min-microvolt = <1800000>;
135		regulator-max-microvolt = <1800000>;
136		vin-supply = <&vcc3v3_sys>;
137	};
138
139	wifi_pwrseq: sdio-wifi-pwrseq {
140		compatible = "mmc-pwrseq-simple";
141		clocks = <&rk818 1>;
142		clock-names = "ext_clock";
143		pinctrl-names = "default";
144		pinctrl-0 = <&wifi_enable_h_pin>;
145		/*
146		 * Wait between power-on and SDIO access for CYP43455
147		 * POR circuit.
148		 */
149		post-power-on-delay-ms = <110>;
150		/*
151		 * Wait between consecutive toggles for CYP43455 CBUCK
152		 * regulator discharge.
153		 */
154		power-off-delay-us = <10000>;
155
156		/* WL_REG_ON on module */
157		reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
158	};
159
160	/* MIPI DSI panel 1.8v supply */
161	vcc1v8_lcd: regulator-vcc1v8-lcd {
162		compatible = "regulator-fixed";
163		enable-active-high;
164		regulator-name = "vcc1v8_lcd";
165		regulator-min-microvolt = <1800000>;
166		regulator-max-microvolt = <1800000>;
167		vin-supply = <&vcc3v3_sys>;
168		gpio = <&gpio3 RK_PA5 GPIO_ACTIVE_HIGH>;
169		pinctrl-names = "default";
170	};
171
172	/* MIPI DSI panel 2.8v supply */
173	vcc2v8_lcd: regulator-vcc2v8-lcd {
174		compatible = "regulator-fixed";
175		enable-active-high;
176		regulator-name = "vcc2v8_lcd";
177		regulator-min-microvolt = <2800000>;
178		regulator-max-microvolt = <2800000>;
179		vin-supply = <&vcc3v3_sys>;
180		gpio = <&gpio3 RK_PA1 GPIO_ACTIVE_HIGH>;
181		pinctrl-names = "default";
182	};
183
184	vibrator {
185		compatible = "gpio-vibrator";
186		enable-gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_HIGH>;
187		vcc-supply = <&vcc3v3_sys>;
188	};
189};
190
191&cpu_alert0 {
192	temperature = <65000>;
193};
194&cpu_alert1 {
195	temperature = <68000>;
196};
197
198&cpu_l0 {
199	cpu-supply = <&vdd_cpu_l>;
200};
201
202&cpu_l1 {
203	cpu-supply = <&vdd_cpu_l>;
204};
205
206&cpu_l2 {
207	cpu-supply = <&vdd_cpu_l>;
208};
209
210&cpu_l3 {
211	cpu-supply = <&vdd_cpu_l>;
212};
213
214&cpu_b0 {
215	cpu-supply = <&vdd_cpu_b>;
216};
217
218&cpu_b1 {
219	cpu-supply = <&vdd_cpu_b>;
220};
221
222&emmc_phy {
223	status = "okay";
224};
225
226&gpu {
227	mali-supply = <&vdd_gpu>;
228	status = "okay";
229};
230
231&i2c0 {
232	clock-frequency = <400000>;
233	i2c-scl-rising-time-ns = <168>;
234	i2c-scl-falling-time-ns = <4>;
235	status = "okay";
236
237	rk818: pmic@1c {
238		compatible = "rockchip,rk818";
239		reg = <0x1c>;
240		interrupt-parent = <&gpio1>;
241		interrupts = <RK_PC5 IRQ_TYPE_LEVEL_LOW>;
242		#clock-cells = <1>;
243		clock-output-names = "xin32k", "rk808-clkout2";
244		pinctrl-names = "default";
245		pinctrl-0 = <&pmic_int_l>;
246		system-power-controller;
247		wakeup-source;
248
249		vcc1-supply = <&vcc_sys>;
250		vcc2-supply = <&vcc_sys>;
251		vcc3-supply = <&vcc_sys>;
252		vcc4-supply = <&vcc_sys>;
253		vcc6-supply = <&vcc_sys>;
254		vcc7-supply = <&vcc3v3_sys>;
255		vcc8-supply = <&vcc_sys>;
256		vcc9-supply = <&vcc3v3_sys>;
257
258		regulators {
259			vdd_cpu_l: DCDC_REG1 {
260				regulator-name = "vdd_cpu_l";
261				regulator-always-on;
262				regulator-boot-on;
263				regulator-min-microvolt = <875000>;
264				regulator-max-microvolt = <975000>;
265				regulator-ramp-delay = <6001>;
266				regulator-state-mem {
267					regulator-off-in-suspend;
268				};
269			};
270
271			vdd_center: DCDC_REG2 {
272				regulator-name = "vdd_center";
273				regulator-always-on;
274				regulator-boot-on;
275				regulator-min-microvolt = <800000>;
276				regulator-max-microvolt = <1000000>;
277				regulator-ramp-delay = <6001>;
278				regulator-state-mem {
279					regulator-off-in-suspend;
280				};
281			};
282
283			vcc_ddr: DCDC_REG3 {
284				regulator-name = "vcc_ddr";
285				regulator-always-on;
286				regulator-boot-on;
287				regulator-state-mem {
288					regulator-on-in-suspend;
289				};
290			};
291
292			vcc_1v8: DCDC_REG4 {
293				regulator-name = "vcc_1v8";
294				regulator-always-on;
295				regulator-boot-on;
296				regulator-min-microvolt = <1800000>;
297				regulator-max-microvolt = <1800000>;
298				regulator-state-mem {
299					regulator-on-in-suspend;
300				};
301			};
302
303			vcca3v0_codec: LDO_REG1 {
304				regulator-name = "vcca3v0_codec";
305				regulator-min-microvolt = <3000000>;
306				regulator-max-microvolt = <3000000>;
307			};
308
309			vcc3v0_touch: LDO_REG2 {
310				regulator-name = "vcc3v0_touch";
311				regulator-min-microvolt = <3000000>;
312				regulator-max-microvolt = <3000000>;
313			};
314
315			vcca1v8_codec: LDO_REG3 {
316				regulator-name = "vcca1v8_codec";
317				regulator-min-microvolt = <1800000>;
318				regulator-max-microvolt = <1800000>;
319			};
320
321			rk818_pwr_on: LDO_REG4 {
322				regulator-name = "rk818_pwr_on";
323				regulator-always-on;
324				regulator-boot-on;
325				regulator-min-microvolt = <3300000>;
326				regulator-max-microvolt = <3300000>;
327				regulator-state-mem {
328					regulator-on-in-suspend;
329				};
330			};
331
332			vcc_3v0: LDO_REG5 {
333				regulator-name = "vcc_3v0";
334				regulator-always-on;
335				regulator-boot-on;
336				regulator-min-microvolt = <3000000>;
337				regulator-max-microvolt = <3000000>;
338				regulator-state-mem {
339					regulator-on-in-suspend;
340				};
341			};
342
343			vcc_1v5: LDO_REG6 {
344				regulator-name = "vcc_1v5";
345				regulator-always-on;
346				regulator-boot-on;
347				regulator-min-microvolt = <1500000>;
348				regulator-max-microvolt = <1500000>;
349				regulator-state-mem {
350					regulator-on-in-suspend;
351				};
352			};
353
354			vcc1v8_dvp: LDO_REG7 {
355				regulator-name = "vcc1v8_dvp";
356				regulator-min-microvolt = <1800000>;
357				regulator-max-microvolt = <1800000>;
358			};
359
360			vcc3v3_s3: LDO_REG8 {
361				regulator-name = "vcc3v3_s3";
362				regulator-always-on;
363				regulator-boot-on;
364				regulator-min-microvolt = <3300000>;
365				regulator-max-microvolt = <3300000>;
366				regulator-state-mem {
367					regulator-off-in-suspend;
368				};
369			};
370
371			vccio_sd: LDO_REG9 {
372				regulator-name = "vccio_sd";
373				regulator-min-microvolt = <1800000>;
374				regulator-max-microvolt = <3300000>;
375			};
376
377			vcc3v3_s0: SWITCH_REG {
378				regulator-name = "vcc3v3_s0";
379				regulator-always-on;
380				regulator-boot-on;
381				regulator-state-mem {
382					regulator-on-in-suspend;
383				};
384			};
385		};
386	};
387
388	vdd_cpu_b: regulator@40 {
389		compatible = "silergy,syr827";
390		reg = <0x40>;
391		fcs,suspend-voltage-selector = <1>;
392		pinctrl-names = "default";
393		pinctrl-0 = <&vsel1_pin>;
394		regulator-name = "vdd_cpu_b";
395		regulator-min-microvolt = <875000>;
396		regulator-max-microvolt = <1150000>;
397		regulator-ramp-delay = <1000>;
398		regulator-always-on;
399		regulator-boot-on;
400
401		regulator-state-mem {
402			regulator-off-in-suspend;
403		};
404	};
405
406	vdd_gpu: regulator@41 {
407		compatible = "silergy,syr828";
408		reg = <0x41>;
409		fcs,suspend-voltage-selector = <1>;
410		pinctrl-names = "default";
411		pinctrl-0 = <&vsel2_pin>;
412		regulator-name = "vdd_gpu";
413		regulator-min-microvolt = <875000>;
414		regulator-max-microvolt = <975000>;
415		regulator-ramp-delay = <1000>;
416		regulator-always-on;
417		regulator-boot-on;
418
419		regulator-state-mem {
420			regulator-off-in-suspend;
421		};
422	};
423};
424
425&i2c3 {
426	i2c-scl-rising-time-ns = <450>;
427	i2c-scl-falling-time-ns = <15>;
428	status = "okay";
429
430	touchscreen@14 {
431		compatible = "goodix,gt1158";
432		reg = <0x14>;
433		interrupt-parent = <&gpio3>;
434		interrupts = <RK_PB5 IRQ_TYPE_EDGE_RISING>;
435		irq-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_HIGH>;
436		reset-gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_HIGH>;
437		AVDD28-supply = <&vcc3v0_touch>;
438		VDDIO-supply = <&vcc3v0_touch>;
439		touchscreen-size-x = <720>;
440		touchscreen-size-y = <1440>;
441	};
442};
443
444&i2c4 {
445	i2c-scl-rising-time-ns = <600>;
446	i2c-scl-falling-time-ns = <20>;
447	status = "okay";
448
449	/* Accelerometer/gyroscope */
450	mpu6500@68 {
451		compatible = "invensense,mpu6500";
452		reg = <0x68>;
453		interrupt-parent = <&gpio1>;
454		interrupts = <RK_PC6 IRQ_TYPE_LEVEL_LOW>;
455		vddio-supply = <&vcc_1v8>;
456	};
457};
458
459&io_domains {
460	bt656-supply = <&vcc1v8_dvp>;
461	audio-supply = <&vcca1v8_codec>;
462	sdmmc-supply = <&vccio_sd>;
463	gpio1830-supply = <&vcc_3v0>;
464	status = "okay";
465};
466
467&mipi_dsi {
468	status = "okay";
469	clock-master;
470
471	ports {
472		mipi_out: port@1 {
473			#address-cells = <0>;
474			#size-cells = <0>;
475			reg = <1>;
476
477			mipi_out_panel: endpoint {
478				remote-endpoint = <&mipi_in_panel>;
479			};
480		};
481	};
482
483	panel@0 {
484		compatible = "hannstar,hsd060bhw4";
485		reg = <0>;
486		backlight = <&backlight>;
487		reset-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>;
488		vcc-supply = <&vcc2v8_lcd>;
489		iovcc-supply = <&vcc1v8_lcd>;
490		pinctrl-names = "default";
491
492		port {
493			mipi_in_panel: endpoint {
494				remote-endpoint = <&mipi_out_panel>;
495			};
496		};
497	};
498};
499
500&pmu_io_domains {
501	pmu1830-supply = <&vcc_1v8>;
502	status = "okay";
503};
504
505&pinctrl {
506	buttons {
507		pwrbtn_pin: pwrbtn-pin {
508			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
509		};
510	};
511
512	leds {
513		red_led_pin: red-led-pin {
514			rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
515		};
516
517		green_led_pin: green-led-pin {
518			rockchip,pins = <4 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
519		};
520
521		blue_led_pin: blue-led-pin {
522			rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
523		};
524	};
525
526	pmic {
527		pmic_int_l: pmic-int-l {
528			rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
529		};
530
531		vsel1_pin: vsel1-pin {
532			rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
533		};
534
535		vsel2_pin: vsel2-pin {
536			rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
537		};
538	};
539
540	sdio-pwrseq {
541		wifi_enable_h_pin: wifi-enable-h-pin {
542			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
543		};
544	};
545
546	sound {
547		vcc1v8_codec_en: vcc1v8-codec-en {
548			rockchip,pins = <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>;
549		};
550	};
551
552	wireless-bluetooth {
553		bt_wake_pin: bt-wake-pin {
554			rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
555		};
556
557		bt_host_wake_pin: bt-host-wake-pin {
558			rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
559		};
560
561		bt_reset_pin: bt-reset-pin {
562			rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
563		};
564	};
565};
566
567&sdio0 {
568	bus-width = <4>;
569	cap-sd-highspeed;
570	cap-sdio-irq;
571	disable-wp;
572	keep-power-in-suspend;
573	mmc-pwrseq = <&wifi_pwrseq>;
574	non-removable;
575	pinctrl-names = "default";
576	pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
577	sd-uhs-sdr104;
578	status = "okay";
579};
580
581&pwm0 {
582	status = "okay";
583};
584
585&saradc {
586	vref-supply = <&vcca1v8_s3>;
587	status = "okay";
588};
589
590&sdmmc {
591	bus-width = <4>;
592	cap-sd-highspeed;
593	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
594	disable-wp;
595	max-frequency = <150000000>;
596	pinctrl-names = "default";
597	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
598	vmmc-supply = <&vcc3v3_sys>;
599	vqmmc-supply = <&vccio_sd>;
600	status = "okay";
601};
602
603&sdhci {
604	bus-width = <8>;
605	mmc-hs200-1_8v;
606	non-removable;
607	status = "okay";
608};
609
610&spi1 {
611	status = "okay";
612
613	flash@0 {
614		compatible = "jedec,spi-nor";
615		reg = <0>;
616		spi-max-frequency = <10000000>;
617	};
618};
619
620&tsadc {
621	rockchip,hw-tshut-mode = <1>;
622	rockchip,hw-tshut-polarity = <1>;
623	status = "okay";
624};
625
626&uart0 {
627	pinctrl-names = "default";
628	pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
629	uart-has-rtscts;
630	status = "okay";
631
632	bluetooth {
633		compatible = "brcm,bcm4345c5";
634		clocks = <&rk818 1>;
635		clock-names = "lpo";
636		device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>;
637		host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
638		max-speed = <1500000>;
639		pinctrl-names = "default";
640		pinctrl-0 = <&bt_host_wake_pin &bt_wake_pin &bt_reset_pin>;
641		shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
642		vbat-supply = <&vcc3v3_sys>;
643		vddio-supply = <&vcc_1v8>;
644	};
645};
646
647&uart2 {
648	status = "okay";
649};
650
651&vopb {
652	status = "okay";
653	assigned-clocks = <&cru DCLK_VOP0_DIV>, <&cru DCLK_VOP0>,
654			  <&cru ACLK_VOP0>, <&cru HCLK_VOP0>;
655	assigned-clock-rates = <0>, <0>, <400000000>, <100000000>;
656	assigned-clock-parents = <&cru PLL_GPLL>, <&cru DCLK_VOP0_DIV>;
657};
658
659&vopb_mmu {
660	status = "okay";
661};
662
663&vopl {
664	status = "okay";
665	assigned-clocks = <&cru DCLK_VOP1_DIV>, <&cru DCLK_VOP1>,
666			  <&cru ACLK_VOP1>, <&cru HCLK_VOP1>;
667	assigned-clock-rates = <0>, <0>, <400000000>, <100000000>;
668	assigned-clock-parents = <&cru PLL_GPLL>, <&cru DCLK_VOP1_DIV>;
669};
670
671&vopl_mmu {
672	status = "okay";
673};
674