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