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/gpio/gpio.h>
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 "sc8180x.dtsi"
14#include "sc8180x-pmics.dtsi"
15
16/ {
17	model = "Lenovo Flex 5G";
18	compatible = "lenovo,flex-5g", "qcom,sc8180x";
19
20	aliases {
21		serial0 = &uart13;
22	};
23
24	backlight: backlight {
25		compatible = "pwm-backlight";
26		pwms = <&pmc8180c_lpg 4 1000000>;
27		enable-gpios = <&pmc8180c_gpios 8 GPIO_ACTIVE_HIGH>;
28
29		pinctrl-0 = <&bl_pwm_default>;
30		pinctrl-names = "default";
31	};
32
33	gpio-keys {
34		compatible = "gpio-keys";
35
36		pinctrl-0 = <&hall_int_active_state>;
37		pinctrl-names = "default";
38
39		lid {
40			gpios = <&tlmm 121 GPIO_ACTIVE_LOW>;
41			linux,input-type = <EV_SW>;
42			linux,code = <SW_LID>;
43			wakeup-source;
44			wakeup-event-action = <EV_ACT_DEASSERTED>;
45		};
46	};
47
48	reserved-memory {
49		rmtfs_mem: rmtfs-region@85500000 {
50			compatible = "qcom,rmtfs-mem";
51			reg = <0x0 0x85500000 0x0 0x200000>;
52			no-map;
53
54			qcom,client-id = <1>;
55			qcom,vmid = <15>;
56		};
57
58		wlan_mem: wlan-region@8bc00000 {
59			reg = <0x0 0x8bc00000 0x0 0x180000>;
60			no-map;
61		};
62
63		mpss_mem: mpss-region@8d800000 {
64			reg = <0x0 0x8d800000 0x0 0x3000000>;
65			no-map;
66		};
67
68		adsp_mem: adsp-region@90800000 {
69			reg = <0x0 0x90800000 0x0 0x1c00000>;
70			no-map;
71		};
72
73		gpu_mem: gpu-region@98715000 {
74			reg = <0x0 0x98715000 0x0 0x2000>;
75			no-map;
76		};
77
78		cdsp_mem: cdsp-region@98900000 {
79			reg = <0x0 0x98900000 0x0 0x1400000>;
80			no-map;
81		};
82	};
83
84	vph_pwr: vph-pwr-regulator {
85		compatible = "regulator-fixed";
86		regulator-name = "vph_pwr";
87		regulator-min-microvolt = <3700000>;
88		regulator-max-microvolt = <3700000>;
89	};
90
91	vreg_s4a_1p8: pm8150-s4-regulator {
92		compatible = "regulator-fixed";
93		regulator-name = "vreg_s4a_1p8";
94
95		regulator-min-microvolt = <1800000>;
96		regulator-max-microvolt = <1800000>;
97
98		regulator-always-on;
99		regulator-boot-on;
100
101		vin-supply = <&vph_pwr>;
102	};
103};
104
105&apps_rsc {
106	regulators-0 {
107		compatible = "qcom,pmc8180-rpmh-regulators";
108		qcom,pmic-id = "a";
109
110		vdd-s5-supply = <&vph_pwr>;
111		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_2p0>;
112
113		vreg_s5a_2p0: smps5 {
114			regulator-min-microvolt = <2040000>;
115			regulator-max-microvolt = <2100000>;
116		};
117
118		vreg_l7a_1p8: ldo7 {
119			regulator-min-microvolt = <1800000>;
120			regulator-max-microvolt = <1800000>;
121			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
122		};
123
124		vreg_l9a_1p3: ldo9 {
125			regulator-min-microvolt = <1296000>;
126			regulator-max-microvolt = <1304000>;
127			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
128		};
129
130		vreg_l12a_1p8: ldo12 {
131			regulator-min-microvolt = <1800000>;
132			regulator-max-microvolt = <1800000>;
133			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
134		};
135	};
136
137	regulators-1 {
138		compatible = "qcom,pmc8180c-rpmh-regulators";
139		qcom,pmic-id = "c";
140
141		vdd-s6-supply = <&vph_pwr>;
142		vdd-l2-l3-supply = <&vreg_s6c_1p35>;
143		vdd-bob-supply = <&vph_pwr>;
144
145		vreg_s6c_1p35: smps6 {
146			regulator-min-microvolt = <1350000>;
147			regulator-max-microvolt = <1372000>;
148			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
149		};
150
151		vreg_l3c_1p2: ldo3 {
152			regulator-min-microvolt = <1200000>;
153			regulator-max-microvolt = <1200000>;
154			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
155		};
156
157		vreg_l10c_3p3: ldo10 {
158			regulator-min-microvolt = <3000000>;
159			regulator-max-microvolt = <3312000>;
160			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
161		};
162
163		vreg_l11c_3p3: ldo11 {
164			regulator-min-microvolt = <3296000>;
165			regulator-max-microvolt = <3304000>;
166			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
167		};
168
169		vreg_bob: bob {
170			regulator-min-microvolt = <3296000>;
171			regulator-max-microvolt = <3350000>;
172			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
173		};
174	};
175
176	regulators-2 {
177		compatible = "qcom,pmc8180-rpmh-regulators";
178		qcom,pmic-id = "e";
179
180		vdd-s4-supply = <&vph_pwr>;
181		vdd-s5-supply = <&vph_pwr>;
182		vdd-l2-l10-supply = <&vreg_bob>;
183		vdd-l3-l4-l5-l18-supply = <&vreg_s4e_0p98>;
184		vdd-l7-l12-l14-l15-supply = <&vreg_s5e_2p05>;
185		vdd-l13-l16-l17-supply = <&vreg_bob>;
186
187		vreg_s4e_0p98: smps4 {
188			regulator-min-microvolt = <992000>;
189			regulator-max-microvolt = <992000>;
190			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
191		};
192
193		vreg_s5e_2p05: smps5 {
194			regulator-min-microvolt = <2040000>;
195			regulator-max-microvolt = <2040000>;
196			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
197		};
198
199		vreg_l1e_0p75: ldo1 {
200			regulator-min-microvolt = <752000>;
201			regulator-max-microvolt = <752000>;
202			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
203		};
204
205		vreg_l5e_0p88: ldo5 {
206			regulator-min-microvolt = <880000>;
207			regulator-max-microvolt = <880000>;
208			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
209		};
210
211		vreg_l7e_1p8: ldo7 {
212			regulator-min-microvolt = <1800000>;
213			regulator-max-microvolt = <1800000>;
214			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
215		};
216
217		vreg_l10e_2p9: ldo10 {
218			regulator-min-microvolt = <2904000>;
219			regulator-max-microvolt = <2904000>;
220			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
221		};
222
223		vreg_l16e_3p0: ldo16 {
224			regulator-min-microvolt = <3072000>;
225			regulator-max-microvolt = <3072000>;
226			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
227		};
228	};
229};
230
231&gpu {
232	status = "okay";
233
234	zap-shader {
235		memory-region = <&gpu_mem>;
236		firmware-name = "qcom/sc8180x/qcdxkmsuc8180.mbn";
237	};
238};
239
240&i2c1 {
241	clock-frequency = <100000>;
242
243	pinctrl-0 = <&i2c1_active>, <&i2c1_hid_active>;
244	pinctrl-names = "default";
245
246	status = "okay";
247
248	hid@10 {
249		compatible = "hid-over-i2c";
250		reg = <0x10>;
251		hid-descr-addr = <0x1>;
252
253		interrupts-extended = <&tlmm 122 IRQ_TYPE_LEVEL_LOW>;
254	};
255};
256
257&i2c7 {
258	clock-frequency = <100000>;
259
260	pinctrl-0 = <&i2c7_active>, <&i2c7_hid_active>;
261	pinctrl-names = "default";
262
263	status = "okay";
264
265	hid@5 {
266		compatible = "hid-over-i2c";
267		reg = <0x5>;
268		hid-descr-addr = <0x20>;
269
270		interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_LOW>;
271	};
272
273	hid@2c {
274		compatible = "hid-over-i2c";
275		reg = <0x2c>;
276		hid-descr-addr = <0x20>;
277
278		interrupts-extended = <&tlmm 24 IRQ_TYPE_LEVEL_LOW>;
279	};
280};
281
282&mdss {
283	status = "okay";
284};
285
286&mdss_edp {
287	data-lanes = <0 1 2 3>;
288
289	pinctrl-0 = <&edp_hpd_active>;
290	pinctrl-names = "default";
291
292	status = "okay";
293
294	aux-bus {
295		panel {
296			compatible = "edp-panel";
297			no-hpd;
298
299			backlight = <&backlight>;
300
301			ports {
302				port {
303					auo_b140han06_in: endpoint {
304						remote-endpoint = <&mdss_edp_out>;
305					};
306				};
307			};
308		};
309	};
310
311	ports {
312		port@1 {
313			reg = <1>;
314			mdss_edp_out: endpoint {
315				remote-endpoint = <&auo_b140han06_in>;
316			};
317		};
318	};
319};
320
321&pcie3 {
322	perst-gpio = <&tlmm 178 GPIO_ACTIVE_LOW>;
323	wake-gpio = <&tlmm 180 GPIO_ACTIVE_HIGH>;
324	pinctrl-0 = <&pcie3_default_state>;
325	pinctrl-names = "default";
326
327	status = "okay";
328};
329
330&pcie3_phy {
331	vdda-phy-supply = <&vreg_l5e_0p88>;
332	vdda-pll-supply = <&vreg_l3c_1p2>;
333
334	status = "okay";
335};
336
337&pmc8180c_lpg {
338	status = "okay";
339};
340
341&qupv3_id_0 {
342	status = "okay";
343};
344
345&qupv3_id_1 {
346	status = "okay";
347};
348
349&qupv3_id_2 {
350	status = "okay";
351};
352
353&remoteproc_adsp {
354	memory-region = <&adsp_mem>;
355	firmware-name = "qcom/sc8180x/LENOVO/82AK/qcadsp8180.mbn";
356
357	status = "okay";
358};
359
360&remoteproc_cdsp {
361	memory-region = <&cdsp_mem>;
362	firmware-name = "qcom/sc8180x/LENOVO/82AK/qccdsp8180.mbn";
363
364	status = "okay";
365};
366
367&remoteproc_mpss {
368	memory-region = <&mpss_mem>;
369	firmware-name = "qcom/sc8180x/LENOVO/82AK/qcmpss8180_nm.mbn";
370
371	status = "okay";
372};
373
374&uart13 {
375	pinctrl-0 = <&uart13_state>;
376	pinctrl-names = "default";
377
378	status = "okay";
379
380	bluetooth {
381		compatible = "qcom,wcn3998-bt";
382
383		vddio-supply = <&vreg_s4a_1p8>;
384		vddxo-supply = <&vreg_l7a_1p8>;
385		vddrf-supply = <&vreg_l9a_1p3>;
386		vddch0-supply = <&vreg_l11c_3p3>;
387		max-speed = <3200000>;
388	};
389};
390
391&ufs_mem_hc {
392	reset-gpios = <&tlmm 190 GPIO_ACTIVE_LOW>;
393
394	vcc-supply = <&vreg_l10e_2p9>;
395	vcc-max-microamp = <155000>;
396
397	vccq2-supply = <&vreg_l7e_1p8>;
398	vccq2-max-microamp = <425000>;
399
400	status = "okay";
401};
402
403&ufs_mem_phy {
404	vdda-phy-supply = <&vreg_l5e_0p88>;
405	vdda-pll-supply = <&vreg_l3c_1p2>;
406
407	status = "okay";
408};
409
410&usb_prim_hsphy {
411	vdda-pll-supply = <&vreg_l5e_0p88>;
412	vdda18-supply = <&vreg_l12a_1p8>;
413	vdda33-supply = <&vreg_l16e_3p0>;
414
415	status = "okay";
416};
417
418&usb_prim_qmpphy {
419	vdda-phy-supply = <&vreg_l3c_1p2>;
420	vdda-pll-supply = <&vreg_l5e_0p88>;
421
422	status = "okay";
423};
424
425&usb_prim {
426	status = "okay";
427};
428
429&usb_prim_dwc3 {
430	dr_mode = "host";
431};
432
433&usb_sec_hsphy {
434	vdda-pll-supply = <&vreg_l5e_0p88>;
435	vdda18-supply = <&vreg_l12a_1p8>;
436	vdda33-supply = <&vreg_l16e_3p0>;
437
438	status = "okay";
439};
440
441&usb_sec_qmpphy {
442	vdda-phy-supply = <&vreg_l3c_1p2>;
443	vdda-pll-supply = <&vreg_l5e_0p88>;
444
445	status = "okay";
446};
447
448&usb_sec {
449	status = "okay";
450};
451
452&usb_sec_dwc3 {
453	dr_mode = "host";
454};
455
456&wifi {
457	memory-region = <&wlan_mem>;
458
459	vdd-0.8-cx-mx-supply = <&vreg_l1e_0p75>;
460	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
461	vdd-1.3-rfa-supply = <&vreg_l9a_1p3>;
462	vdd-3.3-ch0-supply = <&vreg_l11c_3p3>;
463	vdd-3.3-ch1-supply = <&vreg_l10c_3p3>;
464
465	status = "okay";
466};
467
468&xo_board_clk {
469	clock-frequency = <38400000>;
470};
471
472/* PINCTRL */
473
474&pmc8180c_gpios {
475	bl_pwm_default: bl-pwm-default-state {
476		en-pins {
477			pins = "gpio8";
478			function = "normal";
479		};
480
481		pwm-pins {
482			pins = "gpio10";
483			function = "func1";
484		};
485	};
486};
487
488&tlmm {
489	gpio-reserved-ranges = <0 4>, <47 4>, <126 4>;
490
491	edp_hpd_active: epd-hpd-active-state {
492		pins = "gpio10";
493		function = "edp_hot";
494	};
495
496	hall_int_active_state: hall-int-active-state {
497		pins = "gpio121";
498		function = "gpio";
499
500		input-enable;
501		bias-disable;
502	};
503
504	i2c1_active: i2c1-active-state {
505		pins = "gpio114", "gpio115";
506		function = "qup1";
507
508		bias-pull-up = <1>;
509		drive-strength = <2>;
510	};
511
512	i2c1_hid_active: i2c1-hid-active-state {
513		pins = "gpio122";
514		function = "gpio";
515
516		input-enable;
517		bias-pull-up;
518		drive-strength = <2>;
519	};
520
521	i2c7_active: i2c7-active-state {
522		pins = "gpio98", "gpio99";
523		function = "qup7";
524
525		bias-pull-up;
526		drive-strength = <2>;
527	};
528
529	i2c7_hid_active: i2c7-hid-active-state {
530		pins = "gpio37", "gpio24";
531		function = "gpio";
532
533		input-enable;
534		bias-pull-up;
535		drive-strength = <2>;
536	};
537
538	pcie3_default_state: pcie3-default-state {
539		clkreq-pins {
540			pins = "gpio179";
541			function = "pci_e3";
542			bias-pull-up;
543		};
544
545		reset-n-pins {
546			pins = "gpio178";
547			function = "gpio";
548
549			drive-strength = <2>;
550			output-low;
551			bias-pull-down;
552		};
553
554		wake-n-pins {
555			pins = "gpio180";
556			function = "gpio";
557
558			drive-strength = <2>;
559			bias-pull-up;
560		};
561	};
562
563	uart13_state: uart13-state {
564		cts-pins {
565			pins = "gpio43";
566			function = "qup13";
567			bias-pull-down;
568		};
569
570		rts-tx-pins {
571			pins = "gpio44", "gpio45";
572			function = "qup13";
573			drive-strength = <2>;
574			bias-disable;
575		};
576
577		rx-pins {
578			pins = "gpio46";
579			function = "qup13";
580			bias-pull-up;
581		};
582	};
583};
584