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&dsi0 {
315	status = "okay";
316	vdda-supply = <&vreg_l26a_1p2>;
317
318	ports {
319		port@1 {
320			endpoint {
321				remote-endpoint = <&sn65dsi86_in_a>;
322				data-lanes = <0 1 2 3>;
323			};
324		};
325	};
326};
327
328&dsi0_phy {
329	status = "okay";
330	vdds-supply = <&vreg_l1a_0p875>;
331};
332
333&gcc {
334	protected-clocks = <GCC_QSPI_CORE_CLK>,
335			   <GCC_QSPI_CORE_CLK_SRC>,
336			   <GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
337			   <GCC_LPASS_Q6_AXI_CLK>,
338			   <GCC_LPASS_SWAY_CLK>;
339};
340
341&gmu {
342	status = "okay";
343};
344
345&gpu {
346	status = "okay";
347	zap-shader {
348		memory-region = <&gpu_mem>;
349		firmware-name = "qcom/sdm850/LENOVO/81JL/qcdxkmsuc850.mbn";
350	};
351};
352
353&i2c1 {
354	status = "okay";
355	clock-frequency = <400000>;
356};
357
358&i2c3 {
359	status = "okay";
360	clock-frequency = <400000>;
361	/* Overwrite pinctrl-0 from sdm845.dtsi */
362	pinctrl-0 = <&qup_i2c3_default &i2c3_hid_active>;
363
364	tsel: hid@15 {
365		compatible = "hid-over-i2c";
366		reg = <0x15>;
367		hid-descr-addr = <0x1>;
368
369		interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_HIGH>;
370	};
371
372	tsc2: hid@2c {
373		compatible = "hid-over-i2c";
374		reg = <0x2c>;
375		hid-descr-addr = <0x20>;
376
377		interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_HIGH>;
378	};
379};
380
381&i2c5 {
382	status = "okay";
383	clock-frequency = <400000>;
384
385	tsc1: hid@10 {
386		compatible = "hid-over-i2c";
387		reg = <0x10>;
388		hid-descr-addr = <0x1>;
389
390		interrupts-extended = <&tlmm 125 IRQ_TYPE_LEVEL_LOW>;
391
392		pinctrl-names = "default";
393		pinctrl-0 = <&i2c5_hid_active>;
394	};
395};
396
397&i2c10 {
398	status = "okay";
399	clock-frequency = <400000>;
400
401	sn65dsi86: bridge@2c {
402		compatible = "ti,sn65dsi86";
403		reg = <0x2c>;
404		pinctrl-names = "default";
405		pinctrl-0 = <&sn65dsi86_pin_active>;
406
407		enable-gpios = <&tlmm 96 GPIO_ACTIVE_HIGH>;
408
409		vpll-supply = <&vreg_l14a_1p88>;
410		vccio-supply = <&vreg_l14a_1p88>;
411
412		clocks = <&sn65dsi86_refclk>;
413		clock-names = "refclk";
414
415		no-hpd;
416		#pwm-cells = <1>;
417
418		ports {
419			#address-cells = <1>;
420			#size-cells = <0>;
421
422			port@0 {
423				reg = <0>;
424				sn65dsi86_in_a: endpoint {
425					remote-endpoint = <&dsi0_out>;
426				};
427			};
428
429			port@1 {
430				reg = <1>;
431				sn65dsi86_out: endpoint {
432					remote-endpoint = <&panel_in_edp>;
433				};
434			};
435		};
436
437		aux-bus {
438			panel: panel {
439				compatible = "boe,nv133fhm-n61";
440				backlight = <&backlight>;
441
442				port {
443					panel_in_edp: endpoint {
444						remote-endpoint = <&sn65dsi86_out>;
445					};
446				};
447			};
448		};
449	};
450};
451
452&i2c11 {
453	status = "okay";
454	clock-frequency = <400000>;
455
456	ecsh: hid@5c {
457		compatible = "hid-over-i2c";
458		reg = <0x5c>;
459		hid-descr-addr = <0x1>;
460
461		interrupts-extended = <&tlmm 92 IRQ_TYPE_LEVEL_LOW>;
462
463		pinctrl-names = "default";
464		pinctrl-0 = <&i2c11_hid_active>;
465	};
466};
467
468&ipa {
469	qcom,gsi-loader = "self";
470	memory-region = <&ipa_fw_mem>;
471	status = "okay";
472};
473
474&mdss {
475	status = "okay";
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