Linux 6.7-rc7
[linux-modified.git] / arch / arm64 / boot / dts / qcom / sc8180x-lenovo-flex-5g.dts
1 // SPDX-License-Identifier: BSD-3-Clause
2 /*
3  * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
4  * Copyright (c) 2020-2023, Linaro Limited
5  */
6
7 /dts-v1/;
8
9 #include <dt-bindings/firmware/qcom,scm.h>
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 "sc8180x.dtsi"
15 #include "sc8180x-pmics.dtsi"
16
17 / {
18         model = "Lenovo Flex 5G";
19         compatible = "lenovo,flex-5g", "qcom,sc8180x";
20
21         aliases {
22                 serial0 = &uart13;
23         };
24
25         backlight: backlight {
26                 compatible = "pwm-backlight";
27                 pwms = <&pmc8180c_lpg 4 1000000>;
28                 enable-gpios = <&pmc8180c_gpios 8 GPIO_ACTIVE_HIGH>;
29
30                 pinctrl-0 = <&bl_pwm_default>;
31                 pinctrl-names = "default";
32         };
33
34         gpio-keys {
35                 compatible = "gpio-keys";
36
37                 pinctrl-0 = <&hall_int_active_state>;
38                 pinctrl-names = "default";
39
40                 lid-switch {
41                         gpios = <&tlmm 121 GPIO_ACTIVE_LOW>;
42                         linux,input-type = <EV_SW>;
43                         linux,code = <SW_LID>;
44                         wakeup-source;
45                         wakeup-event-action = <EV_ACT_DEASSERTED>;
46                 };
47         };
48
49         pmic-glink {
50                 compatible = "qcom,sc8180x-pmic-glink", "qcom,pmic-glink";
51
52                 #address-cells = <1>;
53                 #size-cells = <0>;
54
55                 connector@0 {
56                         compatible = "usb-c-connector";
57                         reg = <0>;
58                         power-role = "dual";
59                         data-role = "dual";
60
61                         ports {
62                                 #address-cells = <1>;
63                                 #size-cells = <0>;
64
65                                 port@0 {
66                                         reg = <0>;
67
68                                         pmic_glink_con0_hs: endpoint {
69                                                 remote-endpoint = <&usb_prim_role_switch>;
70                                         };
71                                 };
72
73                                 port@1 {
74                                         reg = <1>;
75
76                                         pmic_glink_con0_ss: endpoint {
77                                                 remote-endpoint = <&usb_prim_qmpphy_out>;
78                                         };
79                                 };
80
81                                 port@2 {
82                                         reg = <2>;
83
84                                         pmic_glink_con0_sbu: endpoint {
85                                                 remote-endpoint = <&usbprim_sbu_mux>;
86                                         };
87                                 };
88                         };
89                 };
90
91                 connector@1 {
92                         compatible = "usb-c-connector";
93                         reg = <1>;
94                         power-role = "dual";
95                         data-role = "dual";
96
97                         ports {
98                                 #address-cells = <1>;
99                                 #size-cells = <0>;
100                                 port@0 {
101                                         reg = <0>;
102
103                                         pmic_glink_con1_hs: endpoint {
104                                                 remote-endpoint = <&usb_sec_role_switch>;
105                                         };
106                                 };
107
108                                 port@1 {
109                                         reg = <1>;
110
111                                         pmic_glink_con1_ss: endpoint {
112                                                 remote-endpoint = <&usb_sec_qmpphy_out>;
113                                         };
114                                 };
115
116                                 port@2 {
117                                         reg = <2>;
118
119                                         pmic_glink_con1_sbu: endpoint {
120                                                 remote-endpoint = <&usbsec_sbu_mux>;
121                                         };
122                                 };
123                         };
124                 };
125         };
126
127         reserved-memory {
128                 rmtfs_mem: rmtfs-region@85500000 {
129                         compatible = "qcom,rmtfs-mem";
130                         reg = <0x0 0x85500000 0x0 0x200000>;
131                         no-map;
132
133                         qcom,client-id = <1>;
134                         qcom,vmid = <QCOM_SCM_VMID_MSS_MSA>;
135                 };
136
137                 wlan_mem: wlan-region@8bc00000 {
138                         reg = <0x0 0x8bc00000 0x0 0x180000>;
139                         no-map;
140                 };
141
142                 mpss_mem: mpss-region@8d800000 {
143                         reg = <0x0 0x8d800000 0x0 0x3000000>;
144                         no-map;
145                 };
146
147                 adsp_mem: adsp-region@90800000 {
148                         reg = <0x0 0x90800000 0x0 0x1c00000>;
149                         no-map;
150                 };
151
152                 gpu_mem: gpu-region@98715000 {
153                         reg = <0x0 0x98715000 0x0 0x2000>;
154                         no-map;
155                 };
156
157                 cdsp_mem: cdsp-region@98900000 {
158                         reg = <0x0 0x98900000 0x0 0x1400000>;
159                         no-map;
160                 };
161         };
162
163         vph_pwr: vph-pwr-regulator {
164                 compatible = "regulator-fixed";
165                 regulator-name = "vph_pwr";
166                 regulator-min-microvolt = <3700000>;
167                 regulator-max-microvolt = <3700000>;
168         };
169
170         vreg_s4a_1p8: pm8150-s4-regulator {
171                 compatible = "regulator-fixed";
172                 regulator-name = "vreg_s4a_1p8";
173
174                 regulator-min-microvolt = <1800000>;
175                 regulator-max-microvolt = <1800000>;
176
177                 regulator-always-on;
178                 regulator-boot-on;
179
180                 vin-supply = <&vph_pwr>;
181         };
182
183         usbprim-sbu-mux {
184                 compatible = "pericom,pi3usb102", "gpio-sbu-mux";
185
186                 enable-gpios = <&tlmm 152 GPIO_ACTIVE_LOW>;
187                 select-gpios = <&tlmm 100 GPIO_ACTIVE_HIGH>;
188
189                 pinctrl-names = "default";
190                 pinctrl-0 = <&usbprim_sbu_default>;
191
192                 mode-switch;
193                 orientation-switch;
194
195                 port {
196                         usbprim_sbu_mux: endpoint {
197                                 remote-endpoint = <&pmic_glink_con0_sbu>;
198                         };
199                 };
200         };
201
202         usbsec-sbu-mux {
203                 compatible = "pericom,pi3usb102", "gpio-sbu-mux";
204
205                 enable-gpios = <&tlmm 188 GPIO_ACTIVE_LOW>;
206                 select-gpios = <&tlmm 187 GPIO_ACTIVE_HIGH>;
207
208                 pinctrl-names = "default";
209                 pinctrl-0 = <&usbsec_sbu_default>;
210
211                 mode-switch;
212                 orientation-switch;
213
214                 port {
215                         usbsec_sbu_mux: endpoint {
216                                 remote-endpoint = <&pmic_glink_con1_sbu>;
217                         };
218                 };
219         };
220 };
221
222 &apps_rsc {
223         regulators-0 {
224                 compatible = "qcom,pmc8180-rpmh-regulators";
225                 qcom,pmic-id = "a";
226
227                 vdd-s5-supply = <&vph_pwr>;
228                 vdd-l7-l12-l14-l15-supply = <&vreg_s5a_2p0>;
229
230                 vreg_s5a_2p0: smps5 {
231                         regulator-min-microvolt = <2040000>;
232                         regulator-max-microvolt = <2100000>;
233                 };
234
235                 vreg_l7a_1p8: ldo7 {
236                         regulator-min-microvolt = <1800000>;
237                         regulator-max-microvolt = <1800000>;
238                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
239                 };
240
241                 vreg_l9a_1p3: ldo9 {
242                         regulator-min-microvolt = <1296000>;
243                         regulator-max-microvolt = <1304000>;
244                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
245                 };
246
247                 vreg_l12a_1p8: ldo12 {
248                         regulator-min-microvolt = <1800000>;
249                         regulator-max-microvolt = <1800000>;
250                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
251                 };
252         };
253
254         regulators-1 {
255                 compatible = "qcom,pmc8180c-rpmh-regulators";
256                 qcom,pmic-id = "c";
257
258                 vdd-s6-supply = <&vph_pwr>;
259                 vdd-l2-l3-supply = <&vreg_s6c_1p35>;
260                 vdd-bob-supply = <&vph_pwr>;
261
262                 vreg_s6c_1p35: smps6 {
263                         regulator-min-microvolt = <1350000>;
264                         regulator-max-microvolt = <1372000>;
265                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
266                 };
267
268                 vreg_l3c_1p2: ldo3 {
269                         regulator-min-microvolt = <1200000>;
270                         regulator-max-microvolt = <1200000>;
271                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
272                 };
273
274                 vreg_l10c_3p3: ldo10 {
275                         regulator-min-microvolt = <3000000>;
276                         regulator-max-microvolt = <3312000>;
277                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
278                 };
279
280                 vreg_l11c_3p3: ldo11 {
281                         regulator-min-microvolt = <3296000>;
282                         regulator-max-microvolt = <3304000>;
283                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
284                 };
285
286                 vreg_bob: bob {
287                         regulator-min-microvolt = <3296000>;
288                         regulator-max-microvolt = <3350000>;
289                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
290                 };
291         };
292
293         regulators-2 {
294                 compatible = "qcom,pmc8180-rpmh-regulators";
295                 qcom,pmic-id = "e";
296
297                 vdd-s4-supply = <&vph_pwr>;
298                 vdd-s5-supply = <&vph_pwr>;
299                 vdd-l2-l10-supply = <&vreg_bob>;
300                 vdd-l3-l4-l5-l18-supply = <&vreg_s4e_0p98>;
301                 vdd-l7-l12-l14-l15-supply = <&vreg_s5e_2p05>;
302                 vdd-l13-l16-l17-supply = <&vreg_bob>;
303
304                 vreg_s4e_0p98: smps4 {
305                         regulator-min-microvolt = <992000>;
306                         regulator-max-microvolt = <992000>;
307                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
308                 };
309
310                 vreg_s5e_2p05: smps5 {
311                         regulator-min-microvolt = <2040000>;
312                         regulator-max-microvolt = <2040000>;
313                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
314                 };
315
316                 vreg_l1e_0p75: ldo1 {
317                         regulator-min-microvolt = <752000>;
318                         regulator-max-microvolt = <752000>;
319                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
320                 };
321
322                 vreg_l5e_0p88: ldo5 {
323                         regulator-min-microvolt = <880000>;
324                         regulator-max-microvolt = <880000>;
325                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
326                 };
327
328                 vreg_l7e_1p8: ldo7 {
329                         regulator-min-microvolt = <1800000>;
330                         regulator-max-microvolt = <1800000>;
331                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
332                 };
333
334                 vreg_l10e_2p9: ldo10 {
335                         regulator-min-microvolt = <2904000>;
336                         regulator-max-microvolt = <2904000>;
337                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
338                 };
339
340                 vreg_l16e_3p0: ldo16 {
341                         regulator-min-microvolt = <3072000>;
342                         regulator-max-microvolt = <3072000>;
343                         regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
344                 };
345         };
346 };
347
348 &gpu {
349         status = "okay";
350
351         zap-shader {
352                 memory-region = <&gpu_mem>;
353                 firmware-name = "/*(DEBLOBBED)*/";
354         };
355 };
356
357 &i2c1 {
358         clock-frequency = <100000>;
359
360         pinctrl-0 = <&i2c1_active>, <&i2c1_hid_active>;
361         pinctrl-names = "default";
362
363         status = "okay";
364
365         hid@10 {
366                 compatible = "hid-over-i2c";
367                 reg = <0x10>;
368                 hid-descr-addr = <0x1>;
369
370                 interrupts-extended = <&tlmm 122 IRQ_TYPE_LEVEL_LOW>;
371         };
372 };
373
374 &i2c7 {
375         clock-frequency = <100000>;
376
377         pinctrl-0 = <&i2c7_active>, <&i2c7_hid_active>;
378         pinctrl-names = "default";
379
380         status = "okay";
381
382         hid@5 {
383                 compatible = "hid-over-i2c";
384                 reg = <0x5>;
385                 hid-descr-addr = <0x20>;
386
387                 interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_LOW>;
388         };
389
390         hid@2c {
391                 compatible = "hid-over-i2c";
392                 reg = <0x2c>;
393                 hid-descr-addr = <0x20>;
394
395                 interrupts-extended = <&tlmm 24 IRQ_TYPE_LEVEL_LOW>;
396         };
397 };
398
399 &mdss {
400         status = "okay";
401 };
402
403 &mdss_dp0 {
404         status = "okay";
405 };
406
407 &mdss_dp0_out {
408         data-lanes = <0 1>;
409         remote-endpoint = <&usb_prim_qmpphy_dp_in>;
410 };
411
412 &mdss_dp1 {
413         status = "okay";
414 };
415
416 &mdss_dp1_out {
417         data-lanes = <0 1>;
418         remote-endpoint = <&usb_sec_qmpphy_dp_in>;
419 };
420
421 &mdss_edp {
422         data-lanes = <0 1 2 3>;
423
424         pinctrl-0 = <&edp_hpd_active>;
425         pinctrl-names = "default";
426
427         status = "okay";
428
429         aux-bus {
430                 panel {
431                         compatible = "edp-panel";
432                         no-hpd;
433
434                         backlight = <&backlight>;
435
436                         port {
437                                 auo_b140han06_in: endpoint {
438                                         remote-endpoint = <&mdss_edp_out>;
439                                 };
440                         };
441                 };
442         };
443
444         ports {
445                 port@1 {
446                         reg = <1>;
447                         mdss_edp_out: endpoint {
448                                 remote-endpoint = <&auo_b140han06_in>;
449                         };
450                 };
451         };
452 };
453
454 &pcie3 {
455         perst-gpio = <&tlmm 178 GPIO_ACTIVE_LOW>;
456         wake-gpio = <&tlmm 180 GPIO_ACTIVE_HIGH>;
457         pinctrl-0 = <&pcie3_default_state>;
458         pinctrl-names = "default";
459
460         status = "okay";
461 };
462
463 &pcie3_phy {
464         vdda-phy-supply = <&vreg_l5e_0p88>;
465         vdda-pll-supply = <&vreg_l3c_1p2>;
466
467         status = "okay";
468 };
469
470 &pmc8180c_lpg {
471         status = "okay";
472 };
473
474 &qupv3_id_0 {
475         status = "okay";
476 };
477
478 &qupv3_id_1 {
479         status = "okay";
480 };
481
482 &qupv3_id_2 {
483         status = "okay";
484 };
485
486 &remoteproc_adsp {
487         memory-region = <&adsp_mem>;
488         firmware-name = "/*(DEBLOBBED)*/";
489
490         status = "okay";
491 };
492
493 &remoteproc_cdsp {
494         memory-region = <&cdsp_mem>;
495         firmware-name = "/*(DEBLOBBED)*/";
496
497         status = "okay";
498 };
499
500 &remoteproc_mpss {
501         memory-region = <&mpss_mem>;
502         firmware-name = "/*(DEBLOBBED)*/";
503
504         status = "okay";
505 };
506
507 &uart13 {
508         pinctrl-0 = <&uart13_state>;
509         pinctrl-names = "default";
510
511         status = "okay";
512
513         bluetooth {
514                 compatible = "qcom,wcn3998-bt";
515
516                 vddio-supply = <&vreg_s4a_1p8>;
517                 vddxo-supply = <&vreg_l7a_1p8>;
518                 vddrf-supply = <&vreg_l9a_1p3>;
519                 vddch0-supply = <&vreg_l11c_3p3>;
520                 max-speed = <3200000>;
521         };
522 };
523
524 &ufs_mem_hc {
525         reset-gpios = <&tlmm 190 GPIO_ACTIVE_LOW>;
526
527         vcc-supply = <&vreg_l10e_2p9>;
528         vcc-max-microamp = <155000>;
529
530         vccq2-supply = <&vreg_l7e_1p8>;
531         vccq2-max-microamp = <425000>;
532
533         status = "okay";
534 };
535
536 &ufs_mem_phy {
537         vdda-phy-supply = <&vreg_l5e_0p88>;
538         vdda-pll-supply = <&vreg_l3c_1p2>;
539
540         status = "okay";
541 };
542
543 &usb_prim_hsphy {
544         vdda-pll-supply = <&vreg_l5e_0p88>;
545         vdda18-supply = <&vreg_l12a_1p8>;
546         vdda33-supply = <&vreg_l16e_3p0>;
547
548         status = "okay";
549 };
550
551 &usb_prim_qmpphy {
552         vdda-phy-supply = <&vreg_l3c_1p2>;
553         vdda-pll-supply = <&vreg_l5e_0p88>;
554
555         orientation-switch;
556
557         status = "okay";
558 };
559
560 &usb_prim {
561         status = "okay";
562 };
563
564 &usb_prim_dwc3 {
565         dr_mode = "host";
566 };
567
568 &usb_prim_qmpphy_dp_in {
569         remote-endpoint = <&mdss_dp0_out>;
570 };
571
572 &usb_prim_qmpphy_out {
573         remote-endpoint = <&pmic_glink_con0_ss>;
574 };
575
576 &usb_prim_role_switch {
577         remote-endpoint = <&pmic_glink_con0_hs>;
578 };
579
580 &usb_sec_hsphy {
581         vdda-pll-supply = <&vreg_l5e_0p88>;
582         vdda18-supply = <&vreg_l12a_1p8>;
583         vdda33-supply = <&vreg_l16e_3p0>;
584
585         status = "okay";
586 };
587
588 &usb_sec_qmpphy {
589         vdda-phy-supply = <&vreg_l3c_1p2>;
590         vdda-pll-supply = <&vreg_l5e_0p88>;
591
592         orientation-switch;
593
594         status = "okay";
595 };
596
597 &usb_sec_qmpphy_dp_in {
598         remote-endpoint = <&mdss_dp1_out>;
599 };
600
601 &usb_sec_qmpphy_out {
602         remote-endpoint = <&pmic_glink_con1_ss>;
603 };
604
605 &usb_sec_role_switch {
606         remote-endpoint = <&pmic_glink_con1_hs>;
607 };
608
609 &usb_sec {
610         status = "okay";
611 };
612
613 &usb_sec_dwc3 {
614         dr_mode = "host";
615 };
616
617 &wifi {
618         memory-region = <&wlan_mem>;
619
620         vdd-0.8-cx-mx-supply = <&vreg_l1e_0p75>;
621         vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
622         vdd-1.3-rfa-supply = <&vreg_l9a_1p3>;
623         vdd-3.3-ch0-supply = <&vreg_l11c_3p3>;
624         vdd-3.3-ch1-supply = <&vreg_l10c_3p3>;
625
626         status = "okay";
627 };
628
629 &xo_board_clk {
630         clock-frequency = <38400000>;
631 };
632
633 /* PINCTRL */
634
635 &pmc8180c_gpios {
636         bl_pwm_default: bl-pwm-default-state {
637                 en-pins {
638                         pins = "gpio8";
639                         function = "normal";
640                 };
641
642                 pwm-pins {
643                         pins = "gpio10";
644                         function = "func1";
645                 };
646         };
647 };
648
649 &tlmm {
650         gpio-reserved-ranges = <0 4>, <47 4>, <126 4>;
651
652         edp_hpd_active: epd-hpd-active-state {
653                 pins = "gpio10";
654                 function = "edp_hot";
655         };
656
657         hall_int_active_state: hall-int-active-state {
658                 pins = "gpio121";
659                 function = "gpio";
660
661                 bias-disable;
662         };
663
664         i2c1_active: i2c1-active-state {
665                 pins = "gpio114", "gpio115";
666                 function = "qup1";
667
668                 bias-pull-up = <1>;
669                 drive-strength = <2>;
670         };
671
672         i2c1_hid_active: i2c1-hid-active-state {
673                 pins = "gpio122";
674                 function = "gpio";
675
676                 bias-pull-up;
677                 drive-strength = <2>;
678         };
679
680         i2c7_active: i2c7-active-state {
681                 pins = "gpio98", "gpio99";
682                 function = "qup7";
683
684                 bias-pull-up;
685                 drive-strength = <2>;
686         };
687
688         i2c7_hid_active: i2c7-hid-active-state {
689                 pins = "gpio37", "gpio24";
690                 function = "gpio";
691
692                 bias-pull-up;
693                 drive-strength = <2>;
694         };
695
696         pcie3_default_state: pcie3-default-state {
697                 clkreq-pins {
698                         pins = "gpio179";
699                         function = "pci_e3";
700                         bias-pull-up;
701                 };
702
703                 reset-n-pins {
704                         pins = "gpio178";
705                         function = "gpio";
706
707                         drive-strength = <2>;
708                         output-low;
709                         bias-pull-down;
710                 };
711
712                 wake-n-pins {
713                         pins = "gpio180";
714                         function = "gpio";
715
716                         drive-strength = <2>;
717                         bias-pull-up;
718                 };
719         };
720
721         usbprim_sbu_default: usbprim-sbu-state {
722                 oe-n-pins {
723                         pins = "gpio152";
724                         function = "gpio";
725                         bias-disable;
726                         drive-strength = <16>;
727                         output-high;
728                 };
729
730                 sel-pins {
731                         pins = "gpio100";
732                         function = "gpio";
733                         bias-disable;
734                         drive-strength = <16>;
735                 };
736         };
737
738         usbsec_sbu_default: usbsec-sbu-state {
739                 oe-n-pins {
740                         pins = "gpio188";
741                         function = "gpio";
742                         bias-disable;
743                         drive-strength = <16>;
744                         output-high;
745                 };
746
747                 sel-pins {
748                         pins = "gpio187";
749                         function = "gpio";
750                         bias-disable;
751                         drive-strength = <16>;
752                 };
753         };
754
755         uart13_state: uart13-state {
756                 cts-pins {
757                         pins = "gpio43";
758                         function = "qup13";
759                         bias-pull-down;
760                 };
761
762                 rts-tx-pins {
763                         pins = "gpio44", "gpio45";
764                         function = "qup13";
765                         drive-strength = <2>;
766                         bias-disable;
767                 };
768
769                 rx-pins {
770                         pins = "gpio46";
771                         function = "qup13";
772                         bias-pull-up;
773                 };
774         };
775 };