1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, The Linux Foundation. All rights reserved.
4 * Copyright (c) 2022, Linaro Limited
5 */
6
7/dts-v1/;
8
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
11
12#include "sc8280xp.dtsi"
13#include "sc8280xp-pmics.dtsi"
14
15/ {
16	model = "Lenovo ThinkPad X13s";
17	compatible = "lenovo,thinkpad-x13s", "qcom,sc8280xp";
18
19	backlight {
20		compatible = "pwm-backlight";
21		pwms = <&pmc8280c_lpg 3 1000000>;
22		enable-gpios = <&pmc8280_1_gpios 8 GPIO_ACTIVE_HIGH>;
23		power-supply = <&vreg_edp_bl>;
24
25		pinctrl-names = "default";
26		pinctrl-0 = <&edp_bl_en>, <&edp_bl_pwm>;
27	};
28
29	vreg_edp_bl: regulator-edp-bl {
30		compatible = "regulator-fixed";
31
32		regulator-name = "VBL9";
33		regulator-min-microvolt = <3600000>;
34		regulator-max-microvolt = <3600000>;
35
36		gpio = <&pmc8280_1_gpios 9 GPIO_ACTIVE_HIGH>;
37		enable-active-high;
38
39		pinctrl-names = "default";
40		pinctrl-0 = <&edp_bl_reg_en>;
41
42		regulator-boot-on;
43	};
44
45	vreg_misc_3p3: regulator-misc-3p3 {
46		compatible = "regulator-fixed";
47
48		regulator-name = "VCC3B";
49		regulator-min-microvolt = <3300000>;
50		regulator-max-microvolt = <3300000>;
51
52		gpio = <&pmc8280_1_gpios 1 GPIO_ACTIVE_HIGH>;
53		enable-active-high;
54
55		pinctrl-names = "default";
56		pinctrl-0 = <&misc_3p3_reg_en>;
57
58		regulator-boot-on;
59		regulator-always-on;
60	};
61};
62
63&apps_rsc {
64	pmc8280-1-rpmh-regulators {
65		compatible = "qcom,pm8350-rpmh-regulators";
66		qcom,pmic-id = "b";
67
68		vdd-l3-l5-supply = <&vreg_s11b>;
69
70		vreg_s11b: smps11 {
71			regulator-name = "vreg_s11b";
72			regulator-min-microvolt = <1272000>;
73			regulator-max-microvolt = <1272000>;
74			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
75		};
76
77		vreg_l3b: ldo3 {
78			regulator-name = "vreg_l3b";
79			regulator-min-microvolt = <1200000>;
80			regulator-max-microvolt = <1200000>;
81			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
82			regulator-boot-on;
83		};
84
85		vreg_l4b: ldo4 {
86			regulator-name = "vreg_l4b";
87			regulator-min-microvolt = <912000>;
88			regulator-max-microvolt = <912000>;
89			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
90		};
91
92		vreg_l6b: ldo6 {
93			regulator-name = "vreg_l6b";
94			regulator-min-microvolt = <880000>;
95			regulator-max-microvolt = <880000>;
96			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
97			regulator-boot-on;
98			regulator-always-on;	// FIXME: VDD_A_EDP_0_0P9
99		};
100	};
101
102	pmc8280c-rpmh-regulators {
103		compatible = "qcom,pm8350c-rpmh-regulators";
104		qcom,pmic-id = "c";
105
106		vreg_l1c: ldo1 {
107			regulator-name = "vreg_l1c";
108			regulator-min-microvolt = <1800000>;
109			regulator-max-microvolt = <1800000>;
110			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
111		};
112
113		vreg_l12c: ldo12 {
114			regulator-name = "vreg_l12c";
115			regulator-min-microvolt = <1800000>;
116			regulator-max-microvolt = <1800000>;
117			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
118		};
119
120		vreg_l13c: ldo13 {
121			regulator-name = "vreg_l13c";
122			regulator-min-microvolt = <3072000>;
123			regulator-max-microvolt = <3072000>;
124			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
125		};
126	};
127
128	pmc8280-2-rpmh-regulators {
129		compatible = "qcom,pm8350-rpmh-regulators";
130		qcom,pmic-id = "d";
131
132		vdd-l1-l4-supply = <&vreg_s11b>;
133
134		vreg_l3d: ldo3 {
135			regulator-name = "vreg_l3d";
136			regulator-min-microvolt = <1200000>;
137			regulator-max-microvolt = <1200000>;
138			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
139		};
140
141		vreg_l4d: ldo4 {
142			regulator-name = "vreg_l4d";
143			regulator-min-microvolt = <1200000>;
144			regulator-max-microvolt = <1200000>;
145			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
146		};
147
148		vreg_l7d: ldo7 {
149			regulator-name = "vreg_l7d";
150			regulator-min-microvolt = <3072000>;
151			regulator-max-microvolt = <3072000>;
152			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
153		};
154
155		vreg_l9d: ldo9 {
156			regulator-name = "vreg_l9d";
157			regulator-min-microvolt = <912000>;
158			regulator-max-microvolt = <912000>;
159			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
160		};
161	};
162};
163
164&pmc8280c_lpg {
165	status = "okay";
166};
167
168&pmk8280_pon_pwrkey {
169	status = "okay";
170};
171
172&qup0 {
173	status = "okay";
174};
175
176&qup0_i2c4 {
177	clock-frequency = <400000>;
178
179	pinctrl-names = "default";
180	pinctrl-0 = <&qup0_i2c4_default>;
181
182	status = "okay";
183
184	/* FIXME: verify */
185	touchscreen@10 {
186		compatible = "hid-over-i2c";
187		reg = <0x10>;
188
189		hid-descr-addr = <0x1>;
190		interrupts-extended = <&tlmm 175 IRQ_TYPE_LEVEL_LOW>;
191		vdd-supply = <&vreg_misc_3p3>;
192
193		pinctrl-names = "default";
194		pinctrl-0 = <&ts0_default>;
195	};
196};
197
198&qup1 {
199	status = "okay";
200};
201
202&qup2 {
203	status = "okay";
204};
205
206&qup2_i2c5 {
207	clock-frequency = <400000>;
208
209	pinctrl-names = "default";
210	pinctrl-0 = <&qup2_i2c5_default>;
211
212	status = "okay";
213
214	touchpad@15 {
215		compatible = "hid-over-i2c";
216		reg = <0x15>;
217
218		hid-descr-addr = <0x1>;
219		interrupts-extended = <&tlmm 182 IRQ_TYPE_LEVEL_LOW>;
220		vdd-supply = <&vreg_misc_3p3>;
221
222		pinctrl-names = "default";
223		pinctrl-0 = <&tpad_default>;
224
225		wakeup-source;
226
227		status = "disabled";
228	};
229
230	touchpad@2c {
231		compatible = "hid-over-i2c";
232		reg = <0x2c>;
233
234		hid-descr-addr = <0x20>;
235		interrupts-extended = <&tlmm 182 IRQ_TYPE_LEVEL_LOW>;
236		vdd-supply = <&vreg_misc_3p3>;
237
238		pinctrl-names = "default";
239		pinctrl-0 = <&tpad_default>;
240
241		wakeup-source;
242	};
243
244	keyboard@68 {
245		compatible = "hid-over-i2c";
246		reg = <0x68>;
247
248		hid-descr-addr = <0x1>;
249		interrupts-extended = <&tlmm 104 IRQ_TYPE_LEVEL_LOW>;
250		vdd-supply = <&vreg_misc_3p3>;
251
252		pinctrl-names = "default";
253		pinctrl-0 = <&kybd_default>;
254
255		wakeup-source;
256	};
257};
258
259&remoteproc_adsp {
260	firmware-name = "qcom/sc8280xp/LENOVO/21BX/qcadsp8280.mbn";
261
262	status = "okay";
263};
264
265&remoteproc_nsp0 {
266	firmware-name = "qcom/sc8280xp/LENOVO/21BX/qccdsp8280.mbn";
267
268	status = "okay";
269};
270
271&usb_0 {
272	status = "okay";
273};
274
275&usb_0_dwc3 {
276	/* TODO: Define USB-C connector properly */
277	dr_mode = "host";
278};
279
280&usb_0_hsphy {
281	vdda-pll-supply = <&vreg_l9d>;
282	vdda18-supply = <&vreg_l1c>;
283	vdda33-supply = <&vreg_l7d>;
284
285	status = "okay";
286};
287
288&usb_0_qmpphy {
289	vdda-phy-supply = <&vreg_l9d>;
290	vdda-pll-supply = <&vreg_l4d>;
291
292	status = "okay";
293};
294
295&usb_1 {
296	status = "okay";
297};
298
299&usb_1_dwc3 {
300	/* TODO: Define USB-C connector properly */
301	dr_mode = "host";
302};
303
304&usb_1_hsphy {
305	vdda-pll-supply = <&vreg_l4b>;
306	vdda18-supply = <&vreg_l1c>;
307	vdda33-supply = <&vreg_l13c>;
308
309	status = "okay";
310};
311
312&usb_1_qmpphy {
313	vdda-phy-supply = <&vreg_l4b>;
314	vdda-pll-supply = <&vreg_l3b>;
315
316	status = "okay";
317};
318
319&xo_board_clk {
320	clock-frequency = <38400000>;
321};
322
323/* PINCTRL */
324
325&pmc8280_1_gpios {
326	edp_bl_en: edp-bl-en-state {
327		pins = "gpio8";
328		function = "normal";
329	};
330
331	edp_bl_reg_en: edp-bl-reg-en-state {
332		pins = "gpio9";
333		function = "normal";
334	};
335
336	misc_3p3_reg_en: misc-3p3-reg-en-state {
337		pins = "gpio1";
338		function = "normal";
339	};
340};
341
342&pmc8280c_gpios {
343	edp_bl_pwm: edp-bl-pwm-state {
344		pins = "gpio8";
345		function = "func1";
346	};
347};
348
349&tlmm {
350	gpio-reserved-ranges = <70 2>, <74 6>, <83 4>, <125 2>, <128 2>, <154 7>;
351
352	kybd_default: kybd-default-state {
353		disable {
354			pins = "gpio102";
355			function = "gpio";
356			output-low;
357		};
358
359		int-n {
360			pins = "gpio104";
361			function = "gpio";
362			bias-disable;
363		};
364
365		reset {
366			pins = "gpio105";
367			function = "gpio";
368			bias-disable;
369		};
370	};
371
372	qup0_i2c4_default: qup0-i2c4-default-state {
373		pins = "gpio171", "gpio172";
374		function = "qup4";
375		bias-disable;
376		drive-strength = <16>;
377	};
378
379	qup2_i2c5_default: qup2-i2c5-default-state {
380		pins = "gpio81", "gpio82";
381		function = "qup21";
382		bias-disable;
383		drive-strength = <16>;
384	};
385
386	tpad_default: tpad-default-state {
387		int-n {
388			pins = "gpio182";
389			function = "gpio";
390			bias-disable;
391		};
392	};
393
394	ts0_default: ts0-default-state {
395		int-n {
396			pins = "gpio175";
397			function = "gpio";
398			bias-disable;
399		};
400
401		reset-n {
402			pins = "gpio99";
403			function = "gpio";
404			output-high;
405			drive-strength = <16>;
406		};
407	};
408};
409