1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, Luca Weiss <luca@z3ntu.xyz>
4 */
5
6/dts-v1/;
7
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
11#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
12#include "sm7225.dtsi"
13#include "pm6350.dtsi"
14
15/ {
16	model = "Fairphone 4";
17	compatible = "fairphone,fp4", "qcom,sm7225";
18
19	/* required for bootloader to select correct board */
20	qcom,msm-id = <434 0x10000>, <459 0x10000>;
21	qcom,board-id = <8 32>;
22
23	aliases {
24		serial0 = &uart2;
25	};
26
27	chosen {
28		#address-cells = <2>;
29		#size-cells = <2>;
30		ranges;
31
32		stdout-path = "serial0:115200n8";
33
34		framebuffer0: framebuffer@a000000 {
35			compatible = "simple-framebuffer";
36			reg = <0 0xa0000000 0 (2340 * 1080 * 4)>;
37			width = <1080>;
38			height = <2340>;
39			stride = <(1080 * 4)>;
40			format = "a8r8g8b8";
41		};
42	};
43
44	gpio-keys {
45		compatible = "gpio-keys";
46		pinctrl-names = "default";
47		pinctrl-0 = <&gpio_keys_pin>;
48
49		volume-up {
50			label = "volume_up";
51			linux,code = <KEY_VOLUMEUP>;
52			gpios = <&pm6350_gpios 2 GPIO_ACTIVE_LOW>;
53		};
54	};
55};
56
57&apps_rsc {
58	pm6350-rpmh-regulators {
59		compatible = "qcom,pm6350-rpmh-regulators";
60		qcom,pmic-id = "a";
61
62		vreg_s1a: smps1 {
63			regulator-min-microvolt = <1000000>;
64			regulator-max-microvolt = <1200000>;
65		};
66
67		vreg_s2a: smps2 {
68			regulator-min-microvolt = <1503000>;
69			regulator-max-microvolt = <2048000>;
70		};
71
72		vreg_l2a: ldo2 {
73			regulator-min-microvolt = <1503000>;
74			regulator-max-microvolt = <1980000>;
75			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
76		};
77
78		vreg_l3a: ldo3 {
79			regulator-min-microvolt = <2700000>;
80			regulator-max-microvolt = <3300000>;
81			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
82		};
83
84		vreg_l4a: ldo4 {
85			regulator-min-microvolt = <352000>;
86			regulator-max-microvolt = <801000>;
87			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
88		};
89
90		vreg_l5a: ldo5 {
91			regulator-min-microvolt = <1503000>;
92			regulator-max-microvolt = <1980000>;
93			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
94		};
95
96		vreg_l6a: ldo6 {
97			regulator-min-microvolt = <1710000>;
98			regulator-max-microvolt = <3544000>;
99			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
100		};
101
102		vreg_l7a: ldo7 {
103			regulator-min-microvolt = <1620000>;
104			regulator-max-microvolt = <1980000>;
105			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
106		};
107
108		vreg_l8a: ldo8 {
109			regulator-min-microvolt = <2800000>;
110			regulator-max-microvolt = <2800000>;
111			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
112		};
113
114		vreg_l9a: ldo9 {
115			regulator-min-microvolt = <1650000>;
116			regulator-max-microvolt = <3401000>;
117			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
118		};
119
120		vreg_l11a: ldo11 {
121			regulator-min-microvolt = <1800000>;
122			regulator-max-microvolt = <2000000>;
123			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
124		};
125
126		vreg_l12a: ldo12 {
127			regulator-min-microvolt = <1620000>;
128			regulator-max-microvolt = <1980000>;
129			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
130		};
131
132		vreg_l13a: ldo13 {
133			regulator-min-microvolt = <570000>;
134			regulator-max-microvolt = <650000>;
135			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
136		};
137
138		vreg_l14a: ldo14 {
139			regulator-min-microvolt = <1700000>;
140			regulator-max-microvolt = <1900000>;
141			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
142		};
143
144		vreg_l15a: ldo15 {
145			regulator-min-microvolt = <1100000>;
146			regulator-max-microvolt = <1305000>;
147			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
148		};
149
150		vreg_l16a: ldo16 {
151			regulator-min-microvolt = <830000>;
152			regulator-max-microvolt = <921000>;
153			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
154		};
155
156		vreg_l18a: ldo18 {
157			regulator-min-microvolt = <788000>;
158			regulator-max-microvolt = <1049000>;
159			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
160		};
161
162		vreg_l19a: ldo19 {
163			regulator-min-microvolt = <1080000>;
164			regulator-max-microvolt = <1305000>;
165			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
166		};
167
168		vreg_l20a: ldo20 {
169			regulator-min-microvolt = <530000>;
170			regulator-max-microvolt = <801000>;
171			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
172		};
173
174		vreg_l21a: ldo21 {
175			regulator-min-microvolt = <751000>;
176			regulator-max-microvolt = <825000>;
177			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
178		};
179
180		vreg_l22a: ldo22 {
181			regulator-min-microvolt = <1080000>;
182			regulator-max-microvolt = <1305000>;
183			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
184		};
185	};
186
187	pm6150l-rpmh-regulators {
188		compatible = "qcom,pm6150l-rpmh-regulators";
189		qcom,pmic-id = "e";
190
191		vreg_s8e: smps8 {
192			regulator-min-microvolt = <313000>;
193			regulator-max-microvolt = <1395000>;
194		};
195
196		vreg_l1e: ldo1 {
197			regulator-min-microvolt = <1620000>;
198			regulator-max-microvolt = <1980000>;
199			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
200		};
201
202		vreg_l2e: ldo2 {
203			regulator-min-microvolt = <1170000>;
204			regulator-max-microvolt = <1305000>;
205			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
206		};
207
208		vreg_l3e: ldo3 {
209			regulator-min-microvolt = <1100000>;
210			regulator-max-microvolt = <1299000>;
211			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
212		};
213
214		vreg_l4e: ldo4 {
215			regulator-min-microvolt = <1620000>;
216			regulator-max-microvolt = <3300000>;
217			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
218		};
219
220		vreg_l5e: ldo5 {
221			regulator-min-microvolt = <1620000>;
222			regulator-max-microvolt = <3300000>;
223			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
224		};
225
226		vreg_l6e: ldo6 {
227			regulator-min-microvolt = <1700000>;
228			regulator-max-microvolt = <3544000>;
229			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
230		};
231
232		vreg_l7e: ldo7 {
233			regulator-min-microvolt = <2700000>;
234			regulator-max-microvolt = <3544000>;
235			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
236		};
237
238		vreg_l8e: ldo8 {
239			regulator-min-microvolt = <1620000>;
240			regulator-max-microvolt = <2000000>;
241			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
242		};
243
244		vreg_l9e: ldo9 {
245			regulator-min-microvolt = <2700000>;
246			regulator-max-microvolt = <3544000>;
247			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
248		};
249
250		vreg_l10e: ldo10 {
251			regulator-min-microvolt = <3000000>;
252			regulator-max-microvolt = <3401000>;
253			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
254		};
255
256		vreg_l11e: ldo11 {
257			regulator-min-microvolt = <3000000>;
258			regulator-max-microvolt = <3401000>;
259			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
260		};
261
262		vreg_bob: bob {
263			regulator-min-microvolt = <1620000>;
264			regulator-max-microvolt = <5492000>;
265			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
266			regulator-allow-bypass;
267		};
268	};
269};
270
271&pm6350_gpios {
272	gpio_keys_pin: gpio-keys-pin {
273		pins = "gpio2";
274		function = PMIC_GPIO_FUNC_NORMAL;
275		bias-pull-up;
276		input-enable;
277		power-source = <0>;
278	};
279};
280
281&pm6350_resin {
282	status = "okay";
283	linux,code = <KEY_VOLUMEDOWN>;
284};
285
286&qupv3_id_1 {
287	status = "okay";
288};
289
290&tlmm {
291	gpio-reserved-ranges = <13 4>, <56 2>;
292};
293
294&uart2 {
295	status = "okay";
296};
297
298&usb_1 {
299	status = "okay";
300};
301
302&usb_1_dwc3 {
303	maximum-speed = "super-speed";
304	dr_mode = "peripheral";
305};
306
307&usb_1_hsphy {
308	status = "okay";
309
310	vdd-supply = <&vreg_l18a>;
311	vdda-pll-supply = <&vreg_l2a>;
312	vdda-phy-dpdm-supply = <&vreg_l3a>;
313};
314
315&usb_1_qmpphy {
316	status = "okay";
317
318	vdda-phy-supply = <&vreg_l22a>;
319	vdda-pll-supply = <&vreg_l16a>;
320};
321