1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Lenovo Yoga C630
4 *
5 * Copyright (c) 2019, Linaro Ltd.
6 */
7
8/dts-v1/;
9
10#include <dt-bindings/input/gpio-keys.h>
11#include <dt-bindings/input/input.h>
12#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
13#include <dt-bindings/sound/qcom,q6afe.h>
14#include <dt-bindings/sound/qcom,q6asm.h>
15#include "sdm850.dtsi"
16#include "sdm845-wcd9340.dtsi"
17#include "pm8998.dtsi"
18
19/*
20 * Update following upstream (sdm845.dtsi) reserved
21 * memory mappings for firmware loading to succeed
22 * and enable the IPA device.
23 */
24/delete-node/ &ipa_fw_mem;
25/delete-node/ &ipa_gsi_mem;
26/delete-node/ &gpu_mem;
27/delete-node/ &adsp_mem;
28/delete-node/ &wlan_msa_mem;
29
30/ {
31	model = "Lenovo Yoga C630";
32	compatible = "lenovo,yoga-c630", "qcom,sdm845";
33	chassis-type = "convertible";
34
35	aliases {
36		hsuart0 = &uart6;
37	};
38
39	gpio-keys {
40		compatible = "gpio-keys";
41
42		pinctrl-names = "default";
43		pinctrl-0 = <&lid_pin_active>, <&mode_pin_active>;
44
45		switch-lid {
46			gpios = <&tlmm 124 GPIO_ACTIVE_HIGH>;
47			linux,input-type = <EV_SW>;
48			linux,code = <SW_LID>;
49			wakeup-source;
50			wakeup-event-action = <EV_ACT_DEASSERTED>;
51		};
52
53		switch-mode {
54			gpios = <&tlmm 95 GPIO_ACTIVE_HIGH>;
55			linux,input-type = <EV_SW>;
56			linux,code = <SW_TABLET_MODE>;
57		};
58	};
59
60	/* Reserved memory changes for IPA */
61	reserved-memory {
62		wlan_msa_mem: memory@8c400000 {
63			reg = <0 0x8c400000 0 0x100000>;
64			no-map;
65		};
66
67		gpu_mem: memory@8c515000 {
68			reg = <0 0x8c515000 0 0x2000>;
69			no-map;
70		};
71
72		ipa_fw_mem: memory@8c517000 {
73			reg = <0 0x8c517000 0 0x5a000>;
74			no-map;
75		};
76
77		adsp_mem: memory@8c600000 {
78			reg = <0 0x8c600000 0 0x1a00000>;
79			no-map;
80		};
81	};
82
83	sn65dsi86_refclk: sn65dsi86-refclk {
84		compatible = "fixed-clock";
85		#clock-cells = <0>;
86
87		clock-frequency = <19200000>;
88	};
89
90	backlight: backlight {
91		compatible = "pwm-backlight";
92		pwms = <&sn65dsi86 1000000>;
93		enable-gpios = <&tlmm 11 GPIO_ACTIVE_HIGH>;
94	};
95};
96
97&adsp_pas {
98	firmware-name = "qcom/sdm850/LENOVO/81JL/qcadsp850.mbn";
99	status = "okay";
100};
101
102&apps_rsc {
103	regulators-0 {
104		compatible = "qcom,pm8998-rpmh-regulators";
105		qcom,pmic-id = "a";
106
107		vdd-l2-l8-l17-supply = <&vreg_s3a_1p35>;
108		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_2p04>;
109
110		vreg_s2a_1p125: smps2 {
111		};
112
113		vreg_s3a_1p35: smps3 {
114			regulator-min-microvolt = <1352000>;
115			regulator-max-microvolt = <1352000>;
116			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
117		};
118
119		vreg_s4a_1p8: smps4 {
120			regulator-min-microvolt = <1800000>;
121			regulator-max-microvolt = <1800000>;
122			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
123		};
124
125		vreg_s5a_2p04: smps5 {
126			regulator-min-microvolt = <2040000>;
127			regulator-max-microvolt = <2040000>;
128			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
129		};
130
131		vreg_s7a_1p025: smps7 {
132		};
133
134		vdd_qusb_hs0:
135		vdda_hp_pcie_core:
136		vdda_mipi_csi0_0p9:
137		vdda_mipi_csi1_0p9:
138		vdda_mipi_csi2_0p9:
139		vdda_mipi_dsi0_pll:
140		vdda_mipi_dsi1_pll:
141		vdda_qlink_lv:
142		vdda_qlink_lv_ck:
143		vdda_qrefs_0p875:
144		vdda_pcie_core:
145		vdda_pll_cc_ebi01:
146		vdda_pll_cc_ebi23:
147		vdda_sp_sensor:
148		vdda_ufs1_core:
149		vdda_ufs2_core:
150		vdda_usb1_ss_core:
151		vdda_usb2_ss_core:
152		vreg_l1a_0p875: ldo1 {
153			regulator-min-microvolt = <880000>;
154			regulator-max-microvolt = <880000>;
155			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
156		};
157
158		vddpx_10:
159		vreg_l2a_1p2: ldo2 {
160			regulator-min-microvolt = <1200000>;
161			regulator-max-microvolt = <1200000>;
162			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
163			regulator-always-on;
164		};
165
166		vreg_l3a_1p0: ldo3 {
167		};
168
169		vdd_wcss_cx:
170		vdd_wcss_mx:
171		vdda_wcss_pll:
172		vreg_l5a_0p8: ldo5 {
173			regulator-min-microvolt = <800000>;
174			regulator-max-microvolt = <800000>;
175			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
176		};
177
178		vddpx_13:
179		vreg_l6a_1p8: ldo6 {
180			regulator-min-microvolt = <1800000>;
181			regulator-max-microvolt = <1800000>;
182			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
183		};
184
185		vreg_l7a_1p8: ldo7 {
186			regulator-min-microvolt = <1800000>;
187			regulator-max-microvolt = <1800000>;
188			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
189		};
190
191		vreg_l8a_1p2: ldo8 {
192		};
193
194		vreg_l9a_1p8: ldo9 {
195		};
196
197		vreg_l10a_1p8: ldo10 {
198		};
199
200		vreg_l11a_1p0: ldo11 {
201		};
202
203		vdd_qfprom:
204		vdd_qfprom_sp:
205		vdda_apc1_cs_1p8:
206		vdda_gfx_cs_1p8:
207		vdda_qrefs_1p8:
208		vdda_qusb_hs0_1p8:
209		vddpx_11:
210		vreg_l12a_1p8: ldo12 {
211			regulator-min-microvolt = <1800000>;
212			regulator-max-microvolt = <1800000>;
213			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
214		};
215
216		vddpx_2:
217		vreg_l13a_2p95: ldo13 {
218		};
219
220		vreg_l14a_1p88: ldo14 {
221			regulator-min-microvolt = <1880000>;
222			regulator-max-microvolt = <1880000>;
223			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
224			regulator-always-on;
225		};
226
227		vreg_l15a_1p8: ldo15 {
228		};
229
230		vreg_l16a_2p7: ldo16 {
231		};
232
233		vreg_l17a_1p3: ldo17 {
234			regulator-min-microvolt = <1304000>;
235			regulator-max-microvolt = <1304000>;
236			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
237		};
238
239		vreg_l18a_2p7: ldo18 {
240		};
241
242		vreg_l19a_3p0: ldo19 {
243			regulator-min-microvolt = <3100000>;
244			regulator-max-microvolt = <3108000>;
245			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
246		};
247
248		vreg_l20a_2p95: ldo20 {
249			regulator-min-microvolt = <2960000>;
250			regulator-max-microvolt = <2960000>;
251			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
252		};
253
254		vreg_l21a_2p95: ldo21 {
255		};
256
257		vreg_l22a_2p85: ldo22 {
258		};
259
260		vreg_l23a_3p3: ldo23 {
261			regulator-min-microvolt = <3300000>;
262			regulator-max-microvolt = <3312000>;
263			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
264		};
265
266		vdda_qusb_hs0_3p1:
267		vreg_l24a_3p075: ldo24 {
268			regulator-min-microvolt = <3075000>;
269			regulator-max-microvolt = <3083000>;
270			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
271		};
272
273		vreg_l25a_3p3: ldo25 {
274			regulator-min-microvolt = <3104000>;
275			regulator-max-microvolt = <3112000>;
276			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
277		};
278
279		vdda_hp_pcie_1p2:
280		vdda_hv_ebi0:
281		vdda_hv_ebi1:
282		vdda_hv_ebi2:
283		vdda_hv_ebi3:
284		vdda_mipi_csi_1p25:
285		vdda_mipi_dsi0_1p2:
286		vdda_mipi_dsi1_1p2:
287		vdda_pcie_1p2:
288		vdda_ufs1_1p2:
289		vdda_ufs2_1p2:
290		vdda_usb1_ss_1p2:
291		vdda_usb2_ss_1p2:
292		vreg_l26a_1p2: ldo26 {
293			regulator-min-microvolt = <1200000>;
294			regulator-max-microvolt = <1208000>;
295			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
296		};
297
298		vreg_l28a_3p0: ldo28 {
299		};
300
301		vreg_lvs1a_1p8: lvs1 {
302		};
303
304		vreg_lvs2a_1p8: lvs2 {
305		};
306	};
307};
308
309&cdsp_pas {
310	firmware-name = "qcom/sdm850/LENOVO/81JL/qccdsp850.mbn";
311	status = "okay";
312};
313
314&gcc {
315	protected-clocks = <GCC_QSPI_CORE_CLK>,
316			   <GCC_QSPI_CORE_CLK_SRC>,
317			   <GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
318			   <GCC_LPASS_Q6_AXI_CLK>,
319			   <GCC_LPASS_SWAY_CLK>;
320};
321
322&gmu {
323	status = "okay";
324};
325
326&gpu {
327	status = "okay";
328	zap-shader {
329		memory-region = <&gpu_mem>;
330		firmware-name = "qcom/sdm850/LENOVO/81JL/qcdxkmsuc850.mbn";
331	};
332};
333
334&i2c1 {
335	status = "okay";
336	clock-frequency = <400000>;
337};
338
339&i2c3 {
340	status = "okay";
341	clock-frequency = <400000>;
342	/* Overwrite pinctrl-0 from sdm845.dtsi */
343	pinctrl-0 = <&qup_i2c3_default &i2c3_hid_active>;
344
345	tsel: hid@15 {
346		compatible = "hid-over-i2c";
347		reg = <0x15>;
348		hid-descr-addr = <0x1>;
349
350		interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_HIGH>;
351	};
352
353	tsc2: hid@2c {
354		compatible = "hid-over-i2c";
355		reg = <0x2c>;
356		hid-descr-addr = <0x20>;
357
358		interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_HIGH>;
359	};
360};
361
362&i2c5 {
363	status = "okay";
364	clock-frequency = <400000>;
365
366	tsc1: hid@10 {
367		compatible = "hid-over-i2c";
368		reg = <0x10>;
369		hid-descr-addr = <0x1>;
370
371		interrupts-extended = <&tlmm 125 IRQ_TYPE_LEVEL_LOW>;
372
373		pinctrl-names = "default";
374		pinctrl-0 = <&i2c5_hid_active>;
375	};
376};
377
378&i2c10 {
379	status = "okay";
380	clock-frequency = <400000>;
381
382	sn65dsi86: bridge@2c {
383		compatible = "ti,sn65dsi86";
384		reg = <0x2c>;
385		pinctrl-names = "default";
386		pinctrl-0 = <&sn65dsi86_pin_active>;
387
388		enable-gpios = <&tlmm 96 GPIO_ACTIVE_HIGH>;
389
390		vpll-supply = <&vreg_l14a_1p88>;
391		vccio-supply = <&vreg_l14a_1p88>;
392
393		clocks = <&sn65dsi86_refclk>;
394		clock-names = "refclk";
395
396		no-hpd;
397		#pwm-cells = <1>;
398
399		ports {
400			#address-cells = <1>;
401			#size-cells = <0>;
402
403			port@0 {
404				reg = <0>;
405				sn65dsi86_in_a: endpoint {
406					remote-endpoint = <&mdss_dsi0_out>;
407				};
408			};
409
410			port@1 {
411				reg = <1>;
412				sn65dsi86_out: endpoint {
413					remote-endpoint = <&panel_in_edp>;
414				};
415			};
416		};
417
418		aux-bus {
419			panel: panel {
420				compatible = "boe,nv133fhm-n61";
421				backlight = <&backlight>;
422
423				port {
424					panel_in_edp: endpoint {
425						remote-endpoint = <&sn65dsi86_out>;
426					};
427				};
428			};
429		};
430	};
431};
432
433&i2c11 {
434	status = "okay";
435	clock-frequency = <400000>;
436
437	ecsh: hid@5c {
438		compatible = "hid-over-i2c";
439		reg = <0x5c>;
440		hid-descr-addr = <0x1>;
441
442		interrupts-extended = <&tlmm 92 IRQ_TYPE_LEVEL_LOW>;
443
444		pinctrl-names = "default";
445		pinctrl-0 = <&i2c11_hid_active>;
446	};
447};
448
449&ipa {
450	qcom,gsi-loader = "self";
451	memory-region = <&ipa_fw_mem>;
452	status = "okay";
453};
454
455&mdss {
456	status = "okay";
457};
458
459&mdss_dsi0 {
460	status = "okay";
461	vdda-supply = <&vreg_l26a_1p2>;
462
463	ports {
464		port@1 {
465			endpoint {
466				remote-endpoint = <&sn65dsi86_in_a>;
467				data-lanes = <0 1 2 3>;
468			};
469		};
470	};
471};
472
473&mdss_dsi0_phy {
474	status = "okay";
475	vdds-supply = <&vreg_l1a_0p875>;
476};
477
478&mss_pil {
479	status = "okay";
480	firmware-name = "qcom/sdm850/LENOVO/81JL/qcdsp1v2850.mbn", "qcom/sdm850/LENOVO/81JL/qcdsp2850.mbn";
481};
482
483&qup_i2c10_default {
484	drive-strength = <2>;
485	bias-disable;
486};
487
488&qup_i2c12_default {
489	drive-strength = <2>;
490	bias-disable;
491};
492
493&qupv3_id_0 {
494	status = "okay";
495};
496
497&qupv3_id_1 {
498	status = "okay";
499};
500
501&q6asmdai {
502	dai@0 {
503		reg = <0>;
504	};
505
506	dai@1 {
507		reg = <1>;
508	};
509
510	dai@2 {
511		reg = <2>;
512	};
513};
514
515&sound {
516	compatible = "lenovo,yoga-c630-sndcard", "qcom,sdm845-sndcard";
517	model = "Lenovo-YOGA-C630-13Q50";
518
519	audio-routing =
520		"RX_BIAS", "MCLK",
521		"AMIC2", "MIC BIAS2",
522		"SpkrLeft IN", "SPK1 OUT",
523		"SpkrRight IN", "SPK2 OUT",
524		"MM_DL1",  "MultiMedia1 Playback",
525		"MM_DL3",  "MultiMedia3 Playback",
526		"MultiMedia2 Capture", "MM_UL2";
527
528	mm1-dai-link {
529		link-name = "MultiMedia1";
530		cpu {
531			sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA1>;
532		};
533	};
534
535	mm2-dai-link {
536		link-name = "MultiMedia2";
537		cpu {
538			sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA2>;
539		};
540	};
541
542	mm3-dai-link {
543		link-name = "MultiMedia3";
544		cpu {
545			sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA3>;
546		};
547	};
548
549	slim-dai-link {
550		link-name = "SLIM Playback";
551		cpu {
552			sound-dai = <&q6afedai SLIMBUS_0_RX>;
553		};
554
555		platform {
556			sound-dai = <&q6routing>;
557		};
558
559		codec {
560			sound-dai = <&left_spkr>, <&right_spkr>, <&swm 0>, <&wcd9340 0>;
561		};
562	};
563
564	slimcap-dai-link {
565		link-name = "SLIM Capture";
566		cpu {
567			sound-dai = <&q6afedai SLIMBUS_0_TX>;
568		};
569
570		platform {
571			sound-dai = <&q6routing>;
572		};
573
574		codec {
575			sound-dai = <&wcd9340 1>;
576		};
577	};
578
579	slim-wcd-dai-link {
580		link-name = "SLIM WCD Playback";
581		cpu {
582			sound-dai = <&q6afedai SLIMBUS_1_RX>;
583		};
584
585		platform {
586			sound-dai = <&q6routing>;
587		};
588
589		codec {
590			sound-dai = <&wcd9340 2>;
591		};
592	};
593};
594
595&tlmm {
596	gpio-reserved-ranges = <0 4>, <81 4>;
597
598	sn65dsi86_pin_active: sn65dsi86-enable-state {
599		pins = "gpio96";
600		function = "gpio";
601		drive-strength = <2>;
602		bias-disable;
603	};
604
605	i2c3_hid_active: i2c2-hid-active-state {
606		pins = "gpio37";
607		function = "gpio";
608
609		bias-pull-up;
610		drive-strength = <2>;
611	};
612
613	i2c5_hid_active: i2c5-hid-active-state {
614		pins = "gpio125";
615		function = "gpio";
616
617		bias-pull-up;
618		drive-strength = <2>;
619	};
620
621	i2c11_hid_active: i2c11-hid-active-state {
622		pins = "gpio92";
623		function = "gpio";
624
625		bias-pull-up;
626		drive-strength = <2>;
627	};
628
629	lid_pin_active: lid-pin-state {
630		pins = "gpio124";
631		function = "gpio";
632
633		bias-disable;
634	};
635
636	mode_pin_active: mode-pin-state {
637		pins = "gpio95";
638		function = "gpio";
639
640		bias-disable;
641	};
642};
643
644&uart6 {
645	pinctrl-names = "default";
646	pinctrl-0 = <&qup_uart6_4pin>;
647	status = "okay";
648
649	bluetooth {
650		compatible = "qcom,wcn3990-bt";
651
652		vddio-supply = <&vreg_s4a_1p8>;
653		vddxo-supply = <&vreg_l7a_1p8>;
654		vddrf-supply = <&vreg_l17a_1p3>;
655		vddch0-supply = <&vreg_l25a_3p3>;
656		vddch1-supply = <&vreg_l23a_3p3>;
657		max-speed = <3200000>;
658	};
659};
660
661&ufs_mem_hc {
662	status = "okay";
663
664	reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>;
665
666	vcc-supply = <&vreg_l20a_2p95>;
667	vcc-max-microamp = <600000>;
668};
669
670&ufs_mem_phy {
671	status = "okay";
672
673	vdda-phy-supply = <&vdda_ufs1_core>;
674	vdda-pll-supply = <&vdda_ufs1_1p2>;
675};
676
677&usb_1 {
678	status = "okay";
679};
680
681&usb_1_dwc3 {
682	dr_mode = "host";
683};
684
685&usb_1_hsphy {
686	status = "okay";
687
688	vdd-supply = <&vdda_usb1_ss_core>;
689	vdda-pll-supply = <&vdda_qusb_hs0_1p8>;
690	vdda-phy-dpdm-supply = <&vdda_qusb_hs0_3p1>;
691
692	qcom,imp-res-offset-value = <8>;
693	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
694	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
695	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
696};
697
698&usb_1_qmpphy {
699	status = "okay";
700
701	vdda-phy-supply = <&vdda_usb1_ss_1p2>;
702	vdda-pll-supply = <&vdda_usb1_ss_core>;
703};
704
705&usb_2 {
706	status = "okay";
707};
708
709&usb_2_dwc3 {
710	dr_mode = "host";
711};
712
713&usb_2_hsphy {
714	status = "okay";
715
716	vdd-supply = <&vdda_usb2_ss_core>;
717	vdda-pll-supply = <&vdda_qusb_hs0_1p8>;
718	vdda-phy-dpdm-supply = <&vdda_qusb_hs0_3p1>;
719
720	qcom,imp-res-offset-value = <8>;
721	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_22_8_MA>;
722};
723
724&usb_2_qmpphy {
725	status = "okay";
726
727	vdda-phy-supply = <&vdda_usb2_ss_1p2>;
728	vdda-pll-supply = <&vdda_usb2_ss_core>;
729};
730
731&venus {
732	firmware-name = "qcom/sdm850/LENOVO/81JL/qcvss850.mbn";
733	status = "okay";
734};
735
736&wcd9340 {
737	reset-gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>;
738	vdd-buck-supply = <&vreg_s4a_1p8>;
739	vdd-buck-sido-supply = <&vreg_s4a_1p8>;
740	vdd-tx-supply = <&vreg_s4a_1p8>;
741	vdd-rx-supply = <&vreg_s4a_1p8>;
742	vdd-io-supply = <&vreg_s4a_1p8>;
743	qcom,mbhc-buttons-vthreshold-microvolt = <75000 150000 237000 500000 500000 500000 500000 500000>;
744	qcom,mbhc-headset-vthreshold-microvolt = <1700000>;
745	qcom,mbhc-headphone-vthreshold-microvolt = <50000>;
746
747	swm: swm@c85 {
748		left_spkr: speaker@0,3 {
749			compatible = "sdw10217211000";
750			reg = <0 3>;
751			powerdown-gpios = <&wcdgpio 1 GPIO_ACTIVE_LOW>;
752			#thermal-sensor-cells = <0>;
753			sound-name-prefix = "SpkrLeft";
754			#sound-dai-cells = <0>;
755		};
756
757		right_spkr: speaker@0,4 {
758			compatible = "sdw10217211000";
759			powerdown-gpios = <&wcdgpio 2 GPIO_ACTIVE_LOW>;
760			reg = <0 4>;
761			#thermal-sensor-cells = <0>;
762			sound-name-prefix = "SpkrRight";
763			#sound-dai-cells = <0>;
764		};
765	};
766};
767
768&wifi {
769	status = "okay";
770
771	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
772	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
773	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
774	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
775	vdd-3.3-ch1-supply = <&vreg_l23a_3p3>;
776
777	qcom,snoc-host-cap-8bit-quirk;
778};
779
780&crypto {
781	/* FIXME: qce_start triggers an SError */
782	status = "disable";
783};
784