1// SPDX-License-Identifier: GPL-2.0
2/*
3 * SDM845 OnePlus 6(T) (enchilada / fajita) common device tree source
4 *
5 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
6 */
7
8/dts-v1/;
9
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/input/linux-event-codes.h>
12#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
13
14#include "sdm845.dtsi"
15#include "pm8998.dtsi"
16#include "pmi8998.dtsi"
17
18/delete-node/ &rmtfs_mem;
19
20/ {
21	aliases {
22		hsuart0 = &uart6;
23	};
24
25	gpio-keys {
26		compatible = "gpio-keys";
27		label = "Volume keys";
28		autorepeat;
29
30		pinctrl-names = "default";
31		pinctrl-0 = <&volume_down_gpio &volume_up_gpio>;
32
33		vol-down {
34			label = "Volume down";
35			linux,code = <KEY_VOLUMEDOWN>;
36			gpios = <&pm8998_gpio 5 GPIO_ACTIVE_LOW>;
37			debounce-interval = <15>;
38		};
39
40		vol-up {
41			label = "Volume up";
42			linux,code = <KEY_VOLUMEUP>;
43			gpios = <&pm8998_gpio 6 GPIO_ACTIVE_LOW>;
44			debounce-interval = <15>;
45		};
46	};
47
48	reserved-memory {
49		/*
50		 * The rmtfs memory region in downstream is 'dynamically allocated'
51		 * but given the same address every time. Hard code it as this address is
52		 * where the modem firmware expects it to be.
53		 */
54		rmtfs_mem: memory@f5b01000 {
55			compatible = "qcom,rmtfs-mem";
56			reg = <0 0xf5b01000 0 0x200000>;
57			no-map;
58
59			qcom,client-id = <1>;
60			qcom,vmid = <15>;
61		};
62
63		/*
64		 * It seems like reserving the old rmtfs_mem region is also needed to prevent
65		 * random crashes which are most likely modem related, more testing needed.
66		 */
67		removed_region: memory@88f00000 {
68			no-map;
69			reg = <0 0x88f00000 0 0x200000>;
70		};
71
72		ramoops: ramoops@ac300000 {
73			compatible = "ramoops";
74			reg = <0 0xac300000 0 0x400000>;
75			record-size = <0x40000>;
76			console-size = <0x40000>;
77			ftrace-size = <0x40000>;
78			pmsg-size = <0x200000>;
79			devinfo-size = <0x1000>;
80			ecc-size = <16>;
81		};
82	};
83
84	vph_pwr: vph-pwr-regulator {
85		compatible = "regulator-fixed";
86		regulator-name = "vph_pwr";
87		regulator-min-microvolt = <3700000>;
88		regulator-max-microvolt = <3700000>;
89	};
90
91	/*
92	 * Apparently RPMh does not provide support for PM8998 S4 because it
93	 * is always-on; model it as a fixed regulator.
94	 */
95	vreg_s4a_1p8: pm8998-smps4 {
96		compatible = "regulator-fixed";
97		regulator-name = "vreg_s4a_1p8";
98
99		regulator-min-microvolt = <1800000>;
100		regulator-max-microvolt = <1800000>;
101
102		regulator-always-on;
103		regulator-boot-on;
104
105		vin-supply = <&vph_pwr>;
106	};
107
108	/*
109	 * The touchscreen regulator seems to be controlled somehow by a gpio.
110	 * Model it as a fixed regulator and keep it on. Without schematics we
111	 * don't know how this is actually wired up...
112	 */
113	ts_1p8_supply: ts-1p8-regulator {
114		compatible = "regulator-fixed";
115		regulator-name = "ts_1p8_supply";
116
117		regulator-min-microvolt = <1800000>;
118		regulator-max-microvolt = <1800000>;
119
120		gpio = <&tlmm 88 0>;
121		enable-active-high;
122		regulator-boot-on;
123	};
124};
125
126&adsp_pas {
127	status = "okay";
128	firmware-name = "qcom/sdm845/oneplus6/adsp.mbn";
129};
130
131&apps_rsc {
132	pm8998-rpmh-regulators {
133		compatible = "qcom,pm8998-rpmh-regulators";
134		qcom,pmic-id = "a";
135
136		vdd-s1-supply = <&vph_pwr>;
137		vdd-s2-supply = <&vph_pwr>;
138		vdd-s3-supply = <&vph_pwr>;
139		vdd-s4-supply = <&vph_pwr>;
140		vdd-s5-supply = <&vph_pwr>;
141		vdd-s6-supply = <&vph_pwr>;
142		vdd-s7-supply = <&vph_pwr>;
143		vdd-s8-supply = <&vph_pwr>;
144		vdd-s9-supply = <&vph_pwr>;
145		vdd-s10-supply = <&vph_pwr>;
146		vdd-s11-supply = <&vph_pwr>;
147		vdd-s12-supply = <&vph_pwr>;
148		vdd-s13-supply = <&vph_pwr>;
149		vdd-l1-l27-supply = <&vreg_s7a_1p025>;
150		vdd-l2-l8-l17-supply = <&vreg_s3a_1p35>;
151		vdd-l3-l11-supply = <&vreg_s7a_1p025>;
152		vdd-l4-l5-supply = <&vreg_s7a_1p025>;
153		vdd-l6-supply = <&vph_pwr>;
154		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_2p04>;
155		vdd-l9-supply = <&vreg_bob>;
156		vdd-l10-l23-l25-supply = <&vreg_bob>;
157		vdd-l13-l19-l21-supply = <&vreg_bob>;
158		vdd-l16-l28-supply = <&vreg_bob>;
159		vdd-l18-l22-supply = <&vreg_bob>;
160		vdd-l20-l24-supply = <&vreg_bob>;
161		vdd-l26-supply = <&vreg_s3a_1p35>;
162		vin-lvs-1-2-supply = <&vreg_s4a_1p8>;
163
164		vreg_s3a_1p35: smps3 {
165			regulator-min-microvolt = <1352000>;
166			regulator-max-microvolt = <1352000>;
167		};
168
169		vreg_s5a_2p04: smps5 {
170			regulator-min-microvolt = <1904000>;
171			regulator-max-microvolt = <2040000>;
172		};
173
174		vreg_s7a_1p025: smps7 {
175			regulator-min-microvolt = <900000>;
176			regulator-max-microvolt = <1028000>;
177		};
178
179		vdda_mipi_dsi0_pll:
180		vdda_qlink_lv:
181		vdda_ufs1_core:
182		vdda_usb1_ss_core:
183		vreg_l1a_0p875: ldo1 {
184			regulator-min-microvolt = <880000>;
185			regulator-max-microvolt = <880000>;
186			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
187		};
188
189		vreg_l2a_1p2: ldo2 {
190			regulator-min-microvolt = <1200000>;
191			regulator-max-microvolt = <1200000>;
192			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
193			regulator-always-on;
194		};
195
196		vreg_l5a_0p8: ldo5 {
197			regulator-min-microvolt = <800000>;
198			regulator-max-microvolt = <800000>;
199			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
200		};
201
202		vreg_l7a_1p8: ldo7 {
203			regulator-min-microvolt = <1800000>;
204			regulator-max-microvolt = <1800000>;
205			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
206		};
207
208		vdda_qusb_hs0_1p8:
209		vreg_l12a_1p8: ldo12 {
210			regulator-min-microvolt = <1800000>;
211			regulator-max-microvolt = <1800000>;
212			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
213		};
214
215		vreg_l14a_1p88: ldo14 {
216			regulator-min-microvolt = <1800000>;
217			regulator-max-microvolt = <1800000>;
218			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
219			regulator-always-on;
220		};
221
222		vreg_l17a_1p3: ldo17 {
223			regulator-min-microvolt = <1304000>;
224			regulator-max-microvolt = <1304000>;
225			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
226		};
227
228		vreg_l20a_2p95: ldo20 {
229			regulator-min-microvolt = <2704000>;
230			regulator-max-microvolt = <2960000>;
231			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
232		};
233
234		vdda_qusb_hs0_3p1:
235		vreg_l24a_3p075: ldo24 {
236			regulator-min-microvolt = <3088000>;
237			regulator-max-microvolt = <3088000>;
238			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
239		};
240
241		vreg_l25a_3p3: ldo25 {
242			regulator-min-microvolt = <3300000>;
243			regulator-max-microvolt = <3312000>;
244			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
245		};
246
247		vdda_mipi_dsi0_1p2:
248		vdda_ufs1_1p2:
249		vreg_l26a_1p2: ldo26 {
250			regulator-min-microvolt = <1200000>;
251			regulator-max-microvolt = <1200000>;
252			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
253		};
254
255		vreg_l28a_3p0: ldo28 {
256			regulator-min-microvolt = <2856000>;
257			regulator-max-microvolt = <3008000>;
258			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
259		};
260	};
261
262	pmi8998-rpmh-regulators {
263		compatible = "qcom,pmi8998-rpmh-regulators";
264		qcom,pmic-id = "b";
265
266		vdd-bob-supply = <&vph_pwr>;
267
268		vreg_bob: bob {
269			regulator-min-microvolt = <3312000>;
270			regulator-max-microvolt = <3600000>;
271			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
272			regulator-allow-bypass;
273		};
274	};
275
276	pm8005-rpmh-regulators {
277		compatible = "qcom,pm8005-rpmh-regulators";
278		qcom,pmic-id = "c";
279
280		vdd-s1-supply = <&vph_pwr>;
281		vdd-s2-supply = <&vph_pwr>;
282		vdd-s3-supply = <&vph_pwr>;
283		vdd-s4-supply = <&vph_pwr>;
284
285		vreg_s3c_0p6: smps3 {
286			regulator-min-microvolt = <600000>;
287			regulator-max-microvolt = <600000>;
288		};
289	};
290};
291
292&cdsp_pas {
293	status = "okay";
294	firmware-name = "qcom/sdm845/oneplus6/cdsp.mbn";
295};
296
297&dsi0 {
298	status = "okay";
299	vdda-supply = <&vdda_mipi_dsi0_1p2>;
300
301	#address-cells = <1>;
302	#size-cells = <0>;
303
304	/*
305	 * Both devices use different panels but all other properties
306	 * are common. Compatible line is declared in device dts.
307	 */
308	display_panel: panel@0 {
309		status = "disabled";
310
311		#address-cells = <1>;
312		#size-cells = <0>;
313		reg = <0>;
314
315		vddio-supply = <&vreg_l14a_1p88>;
316
317		reset-gpios = <&tlmm 6 GPIO_ACTIVE_LOW>;
318
319		pinctrl-names = "default";
320		pinctrl-0 = <&panel_reset_pins &panel_te_pin &panel_esd_pin>;
321
322		port {
323			panel_in: endpoint {
324				remote-endpoint = <&dsi0_out>;
325			};
326		};
327	};
328};
329
330&dsi0_out {
331	remote-endpoint = <&panel_in>;
332	data-lanes = <0 1 2 3>;
333};
334
335&dsi0_phy {
336	status = "okay";
337	vdds-supply = <&vdda_mipi_dsi0_pll>;
338};
339
340&gcc {
341	protected-clocks = <GCC_QSPI_CORE_CLK>,
342				<GCC_QSPI_CORE_CLK_SRC>,
343				<GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
344				<GCC_LPASS_Q6_AXI_CLK>,
345				<GCC_LPASS_SWAY_CLK>;
346};
347
348&gpu {
349	zap-shader {
350		memory-region = <&gpu_mem>;
351		firmware-name = "qcom/sdm845/oneplus6/a630_zap.mbn";
352	};
353};
354
355&i2c12 {
356	status = "okay";
357	clock-frequency = <400000>;
358
359	synaptics-rmi4-i2c@20 {
360		compatible = "syna,rmi4-i2c";
361		reg = <0x20>;
362		#address-cells = <1>;
363		#size-cells = <0>;
364		interrupts-extended = <&tlmm 125 IRQ_TYPE_EDGE_FALLING>;
365
366		pinctrl-names = "default";
367		pinctrl-0 = <&ts_default_pins>;
368
369		vdd-supply = <&vreg_l28a_3p0>;
370		vio-supply = <&ts_1p8_supply>;
371
372		syna,reset-delay-ms = <200>;
373		syna,startup-delay-ms = <200>;
374
375		rmi4-f01@1 {
376			reg = <0x01>;
377			syna,nosleep-mode = <1>;
378		};
379
380		rmi4_f12: rmi4-f12@12 {
381			reg = <0x12>;
382			touchscreen-x-mm = <68>;
383			touchscreen-y-mm = <144>;
384			syna,sensor-type = <1>;
385			syna,rezero-wait-ms = <200>;
386		};
387	};
388};
389
390&mdss {
391	status = "okay";
392};
393
394&mdss_mdp {
395	status = "okay";
396};
397
398/* Modem/wifi*/
399&mss_pil {
400	status = "okay";
401	firmware-name = "qcom/sdm845/oneplus6/mba.mbn", "qcom/sdm845/oneplus6/modem.mbn";
402};
403
404&pm8998_gpio {
405	volume_down_gpio: pm8998_gpio5 {
406		pinconf {
407			pins = "gpio5";
408			function = "normal";
409			input-enable;
410			bias-pull-up;
411			qcom,drive-strength = <0>;
412		};
413	};
414
415	volume_up_gpio: pm8998_gpio6 {
416		pinconf {
417			pins = "gpio6";
418			function = "normal";
419			input-enable;
420			bias-pull-up;
421			qcom,drive-strength = <0>;
422		};
423	};
424};
425
426&qupv3_id_1 {
427	status = "okay";
428};
429
430&qupv3_id_0 {
431	status = "okay";
432};
433
434&qup_i2c12_default {
435	mux {
436		pins = "gpio49", "gpio50";
437		function = "qup12";
438		drive-strength = <2>;
439		bias-disable;
440	};
441};
442
443&qup_i2c10_default {
444	pinconf {
445		pins = "gpio55", "gpio56";
446		drive-strength = <2>;
447		bias-disable;
448	};
449};
450
451&qup_uart9_default {
452	pinconf-tx {
453		pins = "gpio4";
454		drive-strength = <2>;
455		bias-disable;
456	};
457
458	pinconf-rx {
459		pins = "gpio5";
460		drive-strength = <2>;
461		bias-pull-up;
462	};
463};
464
465/*
466 * Prevent garbage data on bluetooth UART lines
467 */
468&qup_uart6_default {
469	pinmux {
470		pins = "gpio45", "gpio46", "gpio47", "gpio48";
471		function = "qup6";
472	};
473
474	cts {
475		pins = "gpio45";
476		bias-pull-down;
477	};
478
479	rts-tx {
480		pins = "gpio46", "gpio47";
481		drive-strength = <2>;
482		bias-disable;
483	};
484
485	rx {
486		pins = "gpio48";
487		bias-pull-up;
488	};
489};
490
491&uart6 {
492	status = "okay";
493
494	bluetooth {
495		compatible = "qcom,wcn3990-bt";
496
497		/*
498		 * This path is relative to the qca/
499		 * subdir under lib/firmware.
500		 */
501		firmware-name = "oneplus6/crnv21.bin";
502
503		vddio-supply = <&vreg_s4a_1p8>;
504		vddxo-supply = <&vreg_l7a_1p8>;
505		vddrf-supply = <&vreg_l17a_1p3>;
506		vddch0-supply = <&vreg_l25a_3p3>;
507		max-speed = <3200000>;
508	};
509};
510
511&ufs_mem_hc {
512	status = "okay";
513
514	reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>;
515
516	vcc-supply = <&vreg_l20a_2p95>;
517	vcc-max-microamp = <600000>;
518};
519
520&ufs_mem_phy {
521	status = "okay";
522
523	vdda-phy-supply = <&vdda_ufs1_core>;
524	vdda-pll-supply = <&vdda_ufs1_1p2>;
525};
526
527&usb_1 {
528	status = "okay";
529
530	/*
531	 * disable USB3 clock requirement as the device only supports
532	 * USB2.
533	 */
534	qcom,select-utmi-as-pipe-clk;
535};
536
537&usb_1_dwc3 {
538	/*
539	 * We don't have the capability to switch modes yet.
540	 */
541	dr_mode = "peripheral";
542
543	/* fastest mode for USB 2 */
544	maximum-speed = "high-speed";
545
546	/* Remove USB3 phy as it's unused on this device. */
547	phys = <&usb_1_hsphy>;
548	phy-names = "usb2-phy";
549};
550
551&usb_1_hsphy {
552	status = "okay";
553
554	vdd-supply = <&vdda_usb1_ss_core>;
555	vdda-pll-supply = <&vdda_qusb_hs0_1p8>;
556	vdda-phy-dpdm-supply = <&vdda_qusb_hs0_3p1>;
557
558	qcom,imp-res-offset-value = <8>;
559	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
560	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
561	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
562};
563
564&tlmm {
565	gpio-reserved-ranges = <0 4>, <81 4>;
566
567	tri_state_key_default: tri_state_key_default {
568		mux {
569			pins = "gpio40", "gpio42", "gpio26";
570			function = "gpio";
571			drive-strength = <2>;
572			bias-disable;
573		};
574	};
575
576	ts_default_pins: ts-int {
577		mux {
578			pins = "gpio99", "gpio125";
579			function = "gpio";
580			drive-strength = <16>;
581			bias-pull-up;
582		};
583	};
584
585	panel_reset_pins: panel-reset {
586		mux {
587			pins = "gpio6", "gpio25", "gpio26";
588			function = "gpio";
589			drive-strength = <8>;
590			bias-disable = <0>;
591		};
592	};
593
594	panel_te_pin: panel-te {
595		mux {
596			pins = "gpio10";
597			function = "mdp_vsync";
598			drive-strength = <2>;
599			bias-disable;
600			input-enable;
601		};
602	};
603
604	panel_esd_pin: panel-esd {
605		mux {
606			pins = "gpio30";
607			function = "gpio";
608			drive-strength = <2>;
609			bias-pull-down;
610			input-enable;
611		};
612	};
613};
614
615&wifi {
616	status = "okay";
617	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
618	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
619	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
620	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
621
622	qcom,snoc-host-cap-8bit-quirk;
623};
624