1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Samsung Galaxy Book2
4 *
5 * Copyright (c) 2022, Xilin Wu <strongtz@yeah.net>
6 */
7
8/dts-v1/;
9
10#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
11#include <dt-bindings/input/gpio-keys.h>
12#include <dt-bindings/input/input.h>
13#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
14#include <dt-bindings/sound/qcom,q6afe.h>
15#include <dt-bindings/sound/qcom,q6asm.h>
16#include "sdm850.dtsi"
17#include "pm8998.dtsi"
18
19/*
20 * Update following upstream (sdm845.dtsi) reserved
21 * memory mappings for firmware loading to succeed
22 */
23/delete-node/ &qseecom_mem;
24/delete-node/ &wlan_msa_mem;
25/delete-node/ &slpi_mem;
26/delete-node/ &ipa_fw_mem;
27/delete-node/ &ipa_gsi_mem;
28/delete-node/ &gpu_mem;
29/delete-node/ &mpss_region;
30/delete-node/ &adsp_mem;
31/delete-node/ &cdsp_mem;
32/delete-node/ &venus_mem;
33/delete-node/ &mba_region;
34/delete-node/ &spss_mem;
35
36/ {
37	model = "Samsung Galaxy Book2";
38	compatible = "samsung,w737", "qcom,sdm845";
39	chassis-type = "convertible";
40
41	chosen {
42		#address-cells = <2>;
43		#size-cells = <2>;
44		ranges;
45
46		// Firmware initialized the display at 1280p instead of 1440p
47		framebuffer0: framebuffer@80400000 {
48			compatible = "simple-framebuffer";
49			reg = <0 0x80400000 0 (1920 * 1280 * 4)>;
50			width = <1920>;
51			height = <1280>;
52			stride = <(1920 * 4)>;
53			format = "a8r8g8b8";
54		};
55	};
56
57	aliases {
58		hsuart0 = &uart6;
59	};
60
61	/* Reserved memory changes */
62	reserved-memory {
63		/* Bootloader display framebuffer region */
64		cont_splash_mem: memory@80400000 {
65			reg = <0x0 0x80400000 0x0 0x960000>;
66			no-map;
67		};
68
69		qseecom_mem: memory@8b500000 {
70			reg = <0 0x8b500000 0 0xa00000>;
71			no-map;
72		};
73
74		wlan_msa_mem: memory@8c400000 {
75			reg = <0 0x8c400000 0 0x100000>;
76			no-map;
77		};
78
79		slpi_mem: memory@8c500000 {
80			reg = <0 0x8c500000 0 0x1200000>;
81			no-map;
82		};
83
84		ipa_fw_mem: memory@8d700000 {
85			reg = <0 0x8d700000 0 0x100000>;
86			no-map;
87		};
88
89		gpu_mem: memory@8d800000 {
90			reg = <0 0x8d800000 0 0x5000>;
91			no-map;
92		};
93
94		mpss_region: memory@8e000000 {
95			reg = <0 0x8e000000 0 0x8000000>;
96			no-map;
97		};
98
99		adsp_mem: memory@96000000 {
100			reg = <0 0x96000000 0 0x2000000>;
101			no-map;
102		};
103
104		cdsp_mem: memory@98000000 {
105			reg = <0 0x98000000 0 0x800000>;
106			no-map;
107		};
108
109		venus_mem: memory@98800000 {
110			reg = <0 0x98800000 0 0x500000>;
111			no-map;
112		};
113
114		mba_region: memory@98d00000 {
115			reg = <0 0x98d00000 0 0x200000>;
116			no-map;
117		};
118
119		spss_mem: memory@98f00000 {
120			reg = <0 0x98f00000 0 0x100000>;
121			no-map;
122		};
123	};
124};
125
126&adsp_pas {
127	firmware-name = "qcom/samsung/w737/qcadsp850.mbn";
128	status = "okay";
129};
130
131&apps_rsc {
132	pm8998-rpmh-regulators {
133		compatible = "qcom,pm8998-rpmh-regulators";
134		qcom,pmic-id = "a";
135
136		vdd-l2-l8-l17-supply = <&vreg_s3a_1p35>;
137		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_2p04>;
138
139		vreg_s2a_1p125: smps2 {
140		};
141
142		vreg_s3a_1p35: smps3 {
143			regulator-min-microvolt = <1352000>;
144			regulator-max-microvolt = <1352000>;
145			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
146		};
147
148		vreg_s4a_1p8: smps4 {
149			regulator-min-microvolt = <1800000>;
150			regulator-max-microvolt = <1800000>;
151			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
152		};
153
154		vreg_s5a_2p04: smps5 {
155			regulator-min-microvolt = <2040000>;
156			regulator-max-microvolt = <2040000>;
157			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
158		};
159
160		vreg_s7a_1p025: smps7 {
161		};
162
163		vdd_qusb_hs0:
164		vdda_hp_pcie_core:
165		vdda_mipi_csi0_0p9:
166		vdda_mipi_csi1_0p9:
167		vdda_mipi_csi2_0p9:
168		vdda_mipi_dsi0_pll:
169		vdda_mipi_dsi1_pll:
170		vdda_qlink_lv:
171		vdda_qlink_lv_ck:
172		vdda_qrefs_0p875:
173		vdda_pcie_core:
174		vdda_pll_cc_ebi01:
175		vdda_pll_cc_ebi23:
176		vdda_sp_sensor:
177		vdda_ufs1_core:
178		vdda_ufs2_core:
179		vdda_usb1_ss_core:
180		vdda_usb2_ss_core:
181		vreg_l1a_0p875: ldo1 {
182			regulator-min-microvolt = <880000>;
183			regulator-max-microvolt = <880000>;
184			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
185		};
186
187		vddpx_10:
188		vreg_l2a_1p2: ldo2 {
189			regulator-min-microvolt = <1200000>;
190			regulator-max-microvolt = <1200000>;
191			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
192			regulator-always-on;
193		};
194
195		vreg_l3a_1p0: ldo3 {
196		};
197
198		vdd_wcss_cx:
199		vdd_wcss_mx:
200		vdda_wcss_pll:
201		vreg_l5a_0p8: ldo5 {
202			regulator-min-microvolt = <800000>;
203			regulator-max-microvolt = <800000>;
204			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
205		};
206
207		vddpx_13:
208		vreg_l6a_1p8: ldo6 {
209			regulator-min-microvolt = <1800000>;
210			regulator-max-microvolt = <1800000>;
211			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
212		};
213
214		vreg_l7a_1p8: ldo7 {
215			regulator-min-microvolt = <1800000>;
216			regulator-max-microvolt = <1800000>;
217			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
218		};
219
220		vreg_l8a_1p2: ldo8 {
221		};
222
223		vreg_l9a_1p8: ldo9 {
224		};
225
226		vreg_l10a_1p8: ldo10 {
227		};
228
229		vreg_l11a_1p0: ldo11 {
230		};
231
232		vdd_qfprom:
233		vdd_qfprom_sp:
234		vdda_apc1_cs_1p8:
235		vdda_gfx_cs_1p8:
236		vdda_qrefs_1p8:
237		vdda_qusb_hs0_1p8:
238		vddpx_11:
239		vreg_l12a_1p8: ldo12 {
240			regulator-min-microvolt = <1800000>;
241			regulator-max-microvolt = <1800000>;
242			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
243		};
244
245		vddpx_2:
246		vreg_l13a_2p95: ldo13 {
247		};
248
249		vreg_l14a_1p88: ldo14 {
250			regulator-min-microvolt = <1880000>;
251			regulator-max-microvolt = <1880000>;
252			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
253			regulator-always-on;
254		};
255
256		vreg_l15a_1p8: ldo15 {
257		};
258
259		vreg_l16a_2p7: ldo16 {
260		};
261
262		vreg_l17a_1p3: ldo17 {
263			regulator-min-microvolt = <1304000>;
264			regulator-max-microvolt = <1304000>;
265			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
266		};
267
268		vreg_l18a_1p8: ldo18 {
269		};
270
271		vreg_l19a_3p0: ldo19 {
272			regulator-min-microvolt = <3100000>;
273			regulator-max-microvolt = <3108000>;
274			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
275		};
276
277		vreg_l20a_2p95: ldo20 {
278			regulator-min-microvolt = <2960000>;
279			regulator-max-microvolt = <2960000>;
280			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
281		};
282
283		vreg_l21a_2p95: ldo21 {
284		};
285
286		vreg_l22a_2p85: ldo22 {
287		};
288
289		vreg_l23a_3p3: ldo23 {
290			regulator-min-microvolt = <3300000>;
291			regulator-max-microvolt = <3312000>;
292			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
293		};
294
295		vdda_qusb_hs0_3p1:
296		vreg_l24a_3p075: ldo24 {
297			regulator-min-microvolt = <3075000>;
298			regulator-max-microvolt = <3083000>;
299			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
300		};
301
302		vreg_l25a_3p3: ldo25 {
303			regulator-min-microvolt = <3104000>;
304			regulator-max-microvolt = <3112000>;
305			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
306		};
307
308		vdda_hp_pcie_1p2:
309		vdda_hv_ebi0:
310		vdda_hv_ebi1:
311		vdda_hv_ebi2:
312		vdda_hv_ebi3:
313		vdda_mipi_csi_1p25:
314		vdda_mipi_dsi0_1p2:
315		vdda_mipi_dsi1_1p2:
316		vdda_pcie_1p2:
317		vdda_ufs1_1p2:
318		vdda_ufs2_1p2:
319		vdda_usb1_ss_1p2:
320		vdda_usb2_ss_1p2:
321		vreg_l26a_1p2: ldo26 {
322			regulator-min-microvolt = <1200000>;
323			regulator-max-microvolt = <1208000>;
324			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
325		};
326
327		vreg_l28a_3p0: ldo28 {
328		};
329
330		vreg_lvs1a_1p8: lvs1 {
331		};
332
333		vreg_lvs2a_1p8: lvs2 {
334		};
335	};
336};
337
338&cdsp_pas {
339	firmware-name = "qcom/samsung/w737/qccdsp850.mbn";
340	status = "okay";
341};
342
343&gcc {
344	protected-clocks = <GCC_QSPI_CORE_CLK>,
345			   <GCC_QSPI_CORE_CLK_SRC>,
346			   <GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
347			   <GCC_LPASS_Q6_AXI_CLK>,
348			   <GCC_LPASS_SWAY_CLK>;
349};
350
351&i2c10 {
352	status = "okay";
353	clock-frequency = <400000>;
354
355	/* SN65DSI86 @ 0x2c */
356	/* The panel requires dual DSI, which is not supported by the bridge driver */
357};
358
359&i2c11 {
360	status = "okay";
361	clock-frequency = <400000>;
362
363	/* HID-I2C Touchscreen @ 0x20 */
364};
365
366&i2c15 {
367	status = "okay";
368	clock-frequency = <400000>;
369
370	digitizer@9 {
371		compatible = "wacom,w9013", "hid-over-i2c";
372		reg = <0x9>;
373		pinctrl-names = "default";
374		pinctrl-0 = <&pen_irq_l>, <&pen_pdct_l>, <&pen_rst_l>;
375
376		post-power-on-delay-ms = <120>;
377
378		interrupt-parent = <&tlmm>;
379		interrupts = <119 IRQ_TYPE_LEVEL_LOW>;
380
381		hid-descr-addr = <0x1>;
382	};
383};
384
385&ipa {
386	status = "okay";
387	memory-region = <&ipa_fw_mem>;
388	firmware-name = "qcom/samsung/w737/ipa_fws.elf";
389};
390
391/* No idea why it causes an SError when enabled */
392&llcc {
393	status = "disabled";
394};
395
396&mss_pil {
397	status = "okay";
398	firmware-name = "qcom/samsung/w737/qcdsp1v2850.mbn", "qcom/samsung/w737/qcdsp2850.mbn";
399};
400
401&qup_i2c10_default {
402	pinconf {
403		pins = "gpio55", "gpio56";
404		drive-strength = <2>;
405		bias-disable;
406	};
407};
408
409&qup_i2c11_default {
410	pinconf {
411		pins = "gpio31", "gpio32";
412		drive-strength = <2>;
413		bias-disable;
414	};
415};
416
417&qup_i2c12_default {
418	pinmux {
419		drive-strength = <2>;
420		bias-disable;
421	};
422};
423
424&qup_uart6_default {
425	pinmux {
426		 pins = "gpio45", "gpio46", "gpio47", "gpio48";
427		 function = "qup6";
428	};
429
430	cts {
431		pins = "gpio45";
432		bias-pull-down;
433	};
434
435	rts-tx {
436		pins = "gpio46", "gpio47";
437		drive-strength = <2>;
438		bias-disable;
439	};
440
441	rx {
442		pins = "gpio48";
443		bias-pull-up;
444	};
445};
446
447&qupv3_id_0 {
448	status = "okay";
449};
450
451&qupv3_id_1 {
452	status = "okay";
453};
454
455&q6asmdai {
456	dai@0 {
457		reg = <0>;
458	};
459
460	dai@1 {
461		reg = <1>;
462	};
463
464	dai@2 {
465		reg = <2>;
466	};
467};
468
469&sound {
470	compatible = "qcom,sdm845-sndcard";
471	model = "Samsung-W737";
472
473	audio-routing =
474		"RX_BIAS", "MCLK",
475		"AMIC2", "MIC BIAS2",
476		"SpkrLeft IN", "SPK1 OUT",
477		"SpkrRight IN", "SPK2 OUT",
478		"MM_DL1",  "MultiMedia1 Playback",
479		"MM_DL3",  "MultiMedia3 Playback",
480		"MultiMedia2 Capture", "MM_UL2";
481
482	mm1-dai-link {
483		link-name = "MultiMedia1";
484		cpu {
485			sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA1>;
486		};
487	};
488
489	mm2-dai-link {
490		link-name = "MultiMedia2";
491		cpu {
492			sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA2>;
493		};
494	};
495
496	mm3-dai-link {
497		link-name = "MultiMedia3";
498		cpu {
499			sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA3>;
500		};
501	};
502
503	slim-dai-link {
504		link-name = "SLIM Playback";
505		cpu {
506			sound-dai = <&q6afedai SLIMBUS_0_RX>;
507		};
508
509		platform {
510			sound-dai = <&q6routing>;
511		};
512
513		codec {
514			sound-dai = <&left_spkr>, <&right_spkr>, <&swm 0>, <&wcd9340 0>;
515		};
516	};
517
518	slimcap-dai-link {
519		link-name = "SLIM Capture";
520		cpu {
521			sound-dai = <&q6afedai SLIMBUS_0_TX>;
522		};
523
524		platform {
525			sound-dai = <&q6routing>;
526		};
527
528		codec {
529			sound-dai = <&wcd9340 1>;
530		};
531	};
532
533	slim-wcd-dai-link {
534		link-name = "SLIM WCD Playback";
535		cpu {
536			sound-dai = <&q6afedai SLIMBUS_1_RX>;
537		};
538
539		platform {
540			sound-dai = <&q6routing>;
541		};
542
543		codec {
544			sound-dai = <&wcd9340 2>;
545		};
546	};
547};
548
549&tlmm {
550	gpio-reserved-ranges = <0 6>, <85 4>;
551
552	pen_irq_l: pen-irq-l {
553		pinmux {
554			pins = "gpio119";
555			function = "gpio";
556		};
557
558		pinconf {
559			pins = "gpio119";
560			bias-disable;
561		};
562	};
563
564	pen_pdct_l: pen-pdct-l {
565		pinmux {
566			pins = "gpio124";
567			function = "gpio";
568		};
569
570		pinconf {
571			pins = "gpio124";
572			bias-disable;
573			drive-strength = <2>;
574			output-high;
575		};
576	};
577
578	pen_rst_l: pen-rst-l {
579		pinmux  {
580			pins = "gpio21";
581			function = "gpio";
582		};
583
584		pinconf {
585			pins = "gpio21";
586			bias-disable;
587			drive-strength = <2>;
588
589			/*
590			 * The pen driver doesn't currently support
591			 * driving this reset line.  By specifying
592			 * output-high here we're relying on the fact
593			 * that this pin has a default pulldown at boot
594			 * (which makes sure the pen was in reset if it
595			 * was powered) and then we set it high here to
596			 * take it out of reset.  Better would be if the
597			 * pen driver could control this and we could
598			 * remove "output-high" here.
599			 */
600			output-high;
601		};
602	};
603
604	wcd_intr_default: wcd_intr_default {
605		pins = "gpio54";
606		function = "gpio";
607
608		input-enable;
609		bias-pull-down;
610		drive-strength = <2>;
611	};
612};
613
614&uart6 {
615	status = "okay";
616
617	bluetooth {
618		compatible = "qcom,wcn3990-bt";
619
620		vddio-supply = <&vreg_s4a_1p8>;
621		vddxo-supply = <&vreg_l7a_1p8>;
622		vddrf-supply = <&vreg_l17a_1p3>;
623		vddch0-supply = <&vreg_l25a_3p3>;
624		vddch1-supply = <&vreg_l23a_3p3>;
625		max-speed = <3200000>;
626	};
627};
628
629&ufs_mem_hc {
630	status = "okay";
631
632	reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>;
633
634	vcc-supply = <&vreg_l20a_2p95>;
635	vcc-max-microamp = <600000>;
636};
637
638&ufs_mem_phy {
639	status = "okay";
640
641	vdda-phy-supply = <&vdda_ufs1_core>;
642	vdda-pll-supply = <&vdda_ufs1_1p2>;
643};
644
645&usb_1 {
646	status = "okay";
647};
648
649&usb_1_dwc3 {
650	dr_mode = "host";
651};
652
653&usb_1_hsphy {
654	status = "okay";
655
656	vdd-supply = <&vdda_usb1_ss_core>;
657	vdda-pll-supply = <&vdda_qusb_hs0_1p8>;
658	vdda-phy-dpdm-supply = <&vdda_qusb_hs0_3p1>;
659
660	qcom,imp-res-offset-value = <8>;
661	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
662	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
663	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
664};
665
666&usb_1_qmpphy {
667	status = "okay";
668
669	vdda-phy-supply = <&vdda_usb1_ss_1p2>;
670	vdda-pll-supply = <&vdda_usb1_ss_core>;
671};
672
673&usb_2 {
674	status = "okay";
675};
676
677&usb_2_dwc3 {
678	dr_mode = "host";
679};
680
681&usb_2_hsphy {
682	status = "okay";
683
684	vdd-supply = <&vdda_usb2_ss_core>;
685	vdda-pll-supply = <&vdda_qusb_hs0_1p8>;
686	vdda-phy-dpdm-supply = <&vdda_qusb_hs0_3p1>;
687
688	qcom,imp-res-offset-value = <8>;
689	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_22_8_MA>;
690};
691
692&usb_2_qmpphy {
693	status = "okay";
694
695	vdda-phy-supply = <&vdda_usb2_ss_1p2>;
696	vdda-pll-supply = <&vdda_usb2_ss_core>;
697};
698
699&venus {
700	status = "okay";
701	firmware-name = "qcom/samsung/w737/qcvss850.mbn";
702};
703
704&wcd9340{
705	pinctrl-0 = <&wcd_intr_default>;
706	pinctrl-names = "default";
707	clock-names = "extclk";
708	clocks = <&rpmhcc RPMH_LN_BB_CLK2>;
709	reset-gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>;
710	vdd-buck-supply = <&vreg_s4a_1p8>;
711	vdd-buck-sido-supply = <&vreg_s4a_1p8>;
712	vdd-tx-supply = <&vreg_s4a_1p8>;
713	vdd-rx-supply = <&vreg_s4a_1p8>;
714	vdd-io-supply = <&vreg_s4a_1p8>;
715	qcom,mbhc-buttons-vthreshold-microvolt = <75000 150000 237000 500000 500000 500000 500000 500000>;
716	qcom,mbhc-headset-vthreshold-microvolt = <1700000>;
717	qcom,mbhc-headphone-vthreshold-microvolt = <50000>;
718
719	swm: swm@c85 {
720		left_spkr: wsa8810-left{
721			compatible = "sdw10217211000";
722			reg = <0 3>;
723			powerdown-gpios = <&wcdgpio 1 GPIO_ACTIVE_HIGH>;
724			#thermal-sensor-cells = <0>;
725			sound-name-prefix = "SpkrLeft";
726			#sound-dai-cells = <0>;
727		};
728
729		right_spkr: wsa8810-right{
730			compatible = "sdw10217211000";
731			powerdown-gpios = <&wcdgpio 2 GPIO_ACTIVE_HIGH>;
732			reg = <0 4>;
733			#thermal-sensor-cells = <0>;
734			sound-name-prefix = "SpkrRight";
735			#sound-dai-cells = <0>;
736		};
737	};
738};
739
740&wifi {
741	status = "okay";
742
743	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
744	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
745	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
746	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
747	vdd-3.3-ch1-supply = <&vreg_l23a_3p3>;
748
749	qcom,snoc-host-cap-8bit-quirk;
750};
751