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