xref: /freebsd/sys/contrib/device-tree/src/arm64/qcom/sm7225-fairphone-fp4.dts (revision 525fe93dc7487a1e63a90f6a2b956abc601963c1)
1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, Luca Weiss <luca@z3ntu.xyz>
4 */
5
6/dts-v1/;
7
8/* PMK8350 (in reality a PMK8003) is configured to use SID6 instead of 0 */
9#define PMK8350_SID 6
10
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
13#include <dt-bindings/input/input.h>
14#include <dt-bindings/leds/common.h>
15#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
16#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
17#include "sm7225.dtsi"
18#include "pm6150l.dtsi"
19#include "pm6350.dtsi"
20#include "pm7250b.dtsi"
21#include "pmk8350.dtsi"
22
23/ {
24	model = "Fairphone 4";
25	compatible = "fairphone,fp4", "qcom,sm7225";
26	chassis-type = "handset";
27
28	/* required for bootloader to select correct board */
29	qcom,msm-id = <434 0x10000>, <459 0x10000>;
30	qcom,board-id = <8 32>;
31
32	aliases {
33		serial0 = &uart9;
34	};
35
36	chosen {
37		#address-cells = <2>;
38		#size-cells = <2>;
39		ranges;
40
41		stdout-path = "serial0:115200n8";
42
43		framebuffer0: framebuffer@a000000 {
44			compatible = "simple-framebuffer";
45			reg = <0 0xa0000000 0 (2340 * 1080 * 4)>;
46			width = <1080>;
47			height = <2340>;
48			stride = <(1080 * 4)>;
49			format = "a8r8g8b8";
50		};
51	};
52
53	gpio-keys {
54		compatible = "gpio-keys";
55		pinctrl-names = "default";
56		pinctrl-0 = <&gpio_keys_pin>;
57
58		key-volume-up {
59			label = "volume_up";
60			linux,code = <KEY_VOLUMEUP>;
61			gpios = <&pm6350_gpios 2 GPIO_ACTIVE_LOW>;
62		};
63	};
64
65	reserved-memory {
66		/*
67		 * The rmtfs memory region in downstream is 'dynamically allocated'
68		 * but given the same address every time. Hard code it as this address is
69		 * where the modem firmware expects it to be.
70		 */
71		memory@efe01000 {
72			compatible = "qcom,rmtfs-mem";
73			reg = <0 0xefe01000 0 0x600000>;
74			no-map;
75
76			qcom,client-id = <1>;
77			qcom,vmid = <15>;
78		};
79	};
80
81	thermal-zones {
82		chg-skin-thermal {
83			polling-delay-passive = <0>;
84			polling-delay = <0>;
85			thermal-sensors = <&pm7250b_adc_tm 0>;
86
87			trips {
88				active-config0 {
89					temperature = <125000>;
90					hysteresis = <1000>;
91					type = "passive";
92				};
93			};
94		};
95
96		conn-thermal {
97			polling-delay-passive = <0>;
98			polling-delay = <0>;
99			thermal-sensors = <&pm7250b_adc_tm 1>;
100
101			trips {
102				active-config0 {
103					temperature = <125000>;
104					hysteresis = <1000>;
105					type = "passive";
106				};
107			};
108		};
109	};
110};
111
112&adsp {
113	firmware-name = "qcom/sm7225/fairphone4/adsp.mdt";
114	status = "okay";
115};
116
117&apps_rsc {
118	regulators-0 {
119		compatible = "qcom,pm6350-rpmh-regulators";
120		qcom,pmic-id = "a";
121
122		vreg_s1a: smps1 {
123			regulator-min-microvolt = <1000000>;
124			regulator-max-microvolt = <1200000>;
125		};
126
127		vreg_s2a: smps2 {
128			regulator-min-microvolt = <1503000>;
129			regulator-max-microvolt = <2048000>;
130		};
131
132		vreg_l2a: ldo2 {
133			regulator-min-microvolt = <1503000>;
134			regulator-max-microvolt = <1980000>;
135			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
136		};
137
138		vreg_l3a: ldo3 {
139			regulator-min-microvolt = <2700000>;
140			regulator-max-microvolt = <3300000>;
141			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
142		};
143
144		vreg_l4a: ldo4 {
145			regulator-min-microvolt = <352000>;
146			regulator-max-microvolt = <801000>;
147			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
148		};
149
150		vreg_l5a: ldo5 {
151			regulator-min-microvolt = <1503000>;
152			regulator-max-microvolt = <1980000>;
153			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
154		};
155
156		vreg_l6a: ldo6 {
157			regulator-min-microvolt = <1710000>;
158			regulator-max-microvolt = <3544000>;
159			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
160		};
161
162		vreg_l7a: ldo7 {
163			regulator-min-microvolt = <1620000>;
164			regulator-max-microvolt = <1980000>;
165			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
166		};
167
168		vreg_l8a: ldo8 {
169			regulator-min-microvolt = <2800000>;
170			regulator-max-microvolt = <2800000>;
171			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
172		};
173
174		vreg_l9a: ldo9 {
175			regulator-min-microvolt = <1650000>;
176			regulator-max-microvolt = <3401000>;
177			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
178		};
179
180		vreg_l11a: ldo11 {
181			regulator-min-microvolt = <1800000>;
182			regulator-max-microvolt = <2000000>;
183			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
184		};
185
186		vreg_l12a: ldo12 {
187			regulator-min-microvolt = <1620000>;
188			regulator-max-microvolt = <1980000>;
189			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
190		};
191
192		vreg_l13a: ldo13 {
193			regulator-min-microvolt = <570000>;
194			regulator-max-microvolt = <650000>;
195			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
196		};
197
198		vreg_l14a: ldo14 {
199			regulator-min-microvolt = <1700000>;
200			regulator-max-microvolt = <1900000>;
201			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
202		};
203
204		vreg_l15a: ldo15 {
205			regulator-min-microvolt = <1100000>;
206			regulator-max-microvolt = <1305000>;
207			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
208		};
209
210		vreg_l16a: ldo16 {
211			regulator-min-microvolt = <830000>;
212			regulator-max-microvolt = <921000>;
213			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
214		};
215
216		vreg_l18a: ldo18 {
217			regulator-min-microvolt = <788000>;
218			regulator-max-microvolt = <1049000>;
219			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
220		};
221
222		vreg_l19a: ldo19 {
223			regulator-min-microvolt = <1080000>;
224			regulator-max-microvolt = <1305000>;
225			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
226		};
227
228		vreg_l20a: ldo20 {
229			regulator-min-microvolt = <530000>;
230			regulator-max-microvolt = <801000>;
231			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
232		};
233
234		vreg_l21a: ldo21 {
235			regulator-min-microvolt = <751000>;
236			regulator-max-microvolt = <825000>;
237			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
238		};
239
240		vreg_l22a: ldo22 {
241			regulator-min-microvolt = <1080000>;
242			regulator-max-microvolt = <1305000>;
243			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
244		};
245	};
246
247	regulators-1 {
248		compatible = "qcom,pm6150l-rpmh-regulators";
249		qcom,pmic-id = "e";
250
251		vreg_s8e: smps8 {
252			regulator-min-microvolt = <313000>;
253			regulator-max-microvolt = <1395000>;
254		};
255
256		vreg_l1e: ldo1 {
257			regulator-min-microvolt = <1620000>;
258			regulator-max-microvolt = <1980000>;
259			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
260		};
261
262		vreg_l2e: ldo2 {
263			regulator-min-microvolt = <1170000>;
264			regulator-max-microvolt = <1305000>;
265			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
266		};
267
268		vreg_l3e: ldo3 {
269			regulator-min-microvolt = <1100000>;
270			regulator-max-microvolt = <1299000>;
271			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
272		};
273
274		vreg_l4e: ldo4 {
275			regulator-min-microvolt = <1620000>;
276			regulator-max-microvolt = <3300000>;
277			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
278		};
279
280		vreg_l5e: ldo5 {
281			regulator-min-microvolt = <1620000>;
282			regulator-max-microvolt = <3300000>;
283			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
284		};
285
286		vreg_l6e: ldo6 {
287			regulator-min-microvolt = <1700000>;
288			regulator-max-microvolt = <2950000>;
289			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
290			regulator-allow-set-load;
291			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
292						   RPMH_REGULATOR_MODE_HPM>;
293		};
294
295		vreg_l7e: ldo7 {
296			regulator-min-microvolt = <2700000>;
297			regulator-max-microvolt = <3544000>;
298			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
299		};
300
301		vreg_l8e: ldo8 {
302			regulator-min-microvolt = <1620000>;
303			regulator-max-microvolt = <2000000>;
304			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
305		};
306
307		vreg_l9e: ldo9 {
308			regulator-min-microvolt = <2700000>;
309			regulator-max-microvolt = <2960000>;
310			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
311			regulator-allow-set-load;
312			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
313						   RPMH_REGULATOR_MODE_HPM>;
314		};
315
316		vreg_l10e: ldo10 {
317			regulator-min-microvolt = <3000000>;
318			regulator-max-microvolt = <3401000>;
319			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
320		};
321
322		vreg_l11e: ldo11 {
323			regulator-min-microvolt = <3000000>;
324			regulator-max-microvolt = <3401000>;
325			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
326		};
327
328		vreg_bob: bob {
329			regulator-min-microvolt = <1620000>;
330			regulator-max-microvolt = <5492000>;
331			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
332			regulator-allow-bypass;
333		};
334	};
335};
336
337&cci0 {
338	status = "okay";
339};
340
341&cci0_i2c0 {
342	/* IMX582 @ 0x1a */
343};
344
345&cci0_i2c1 {
346	/* IMX582 @ 0x1a */
347};
348
349&cci1 {
350	status = "okay";
351};
352
353&cci1_i2c0 {
354	/* IMX576 @ 0x10 */
355};
356
357&cdsp {
358	firmware-name = "qcom/sm7225/fairphone4/cdsp.mdt";
359	status = "okay";
360};
361
362&gpi_dma0 {
363	status = "okay";
364};
365
366&gpi_dma1 {
367	status = "okay";
368};
369
370&i2c0 {
371	clock-frequency = <400000>;
372	status = "okay";
373
374	/* ST21NFCD NFC @ 8 */
375	/* VL53L3 ToF @ 29 */
376	/* AW88264A amplifier @ 34 */
377	/* AW88264A amplifier @ 35 */
378};
379
380&i2c8 {
381	clock-frequency = <400000>;
382	status = "okay";
383
384	/* HX83112A touchscreen @ 48 */
385};
386
387&i2c10 {
388	clock-frequency = <400000>;
389	status = "okay";
390
391	/* PM8008 PMIC @ 8 and 9 */
392	/* PX8618 @ 26 */
393	/* SMB1395 PMIC @ 34 */
394
395	haptics@5a {
396		compatible = "awinic,aw8695";
397		reg = <0x5a>;
398		interrupts-extended = <&tlmm 85 IRQ_TYPE_EDGE_FALLING>;
399		reset-gpios = <&tlmm 90 GPIO_ACTIVE_HIGH>;
400
401		awinic,f0-preset = <2350>;
402		awinic,f0-coefficient = <260>;
403		awinic,f0-calibration-percent = <7>;
404		awinic,drive-level = <125>;
405
406		awinic,f0-detection-play-time = <5>;
407		awinic,f0-detection-wait-time = <3>;
408		awinic,f0-detection-repeat = <2>;
409		awinic,f0-detection-trace = <15>;
410
411		awinic,boost-debug = /bits/ 8 <0x30 0xeb 0xd4>;
412		awinic,tset = /bits/ 8 <0x12>;
413		awinic,r-spare = /bits/ 8 <0x68>;
414
415		awinic,bemf-upper-threshold = <4104>;
416		awinic,bemf-lower-threshold = <1016>;
417	};
418};
419
420&ipa {
421	qcom,gsi-loader = "self";
422	memory-region = <&pil_ipa_fw_mem>;
423	firmware-name = "qcom/sm7225/fairphone4/ipa_fws.mdt";
424	status = "okay";
425};
426
427&mpss {
428	firmware-name = "qcom/sm7225/fairphone4/modem.mdt";
429	status = "okay";
430};
431
432&pm6150l_flash {
433	status = "okay";
434
435	led-0 {
436		function = LED_FUNCTION_FLASH;
437		color = <LED_COLOR_ID_YELLOW>;
438		led-sources = <1>;
439		led-max-microamp = <180000>;
440		flash-max-microamp = <1000000>;
441		flash-max-timeout-us = <1280000>;
442	};
443
444	led-1 {
445		function = LED_FUNCTION_FLASH;
446		color = <LED_COLOR_ID_WHITE>;
447		led-sources = <2>;
448		led-max-microamp = <180000>;
449		flash-max-microamp = <1000000>;
450		flash-max-timeout-us = <1280000>;
451	};
452};
453
454&pm6150l_wled {
455	qcom,switching-freq = <800>;
456	qcom,current-limit-microamp = <20000>;
457	qcom,num-strings = <2>;
458
459	status = "okay";
460};
461
462&pm6350_gpios {
463	gpio_keys_pin: gpio-keys-state {
464		pins = "gpio2";
465		function = PMIC_GPIO_FUNC_NORMAL;
466		bias-pull-up;
467		input-enable;
468		power-source = <0>;
469	};
470};
471
472&pm6350_resin {
473	linux,code = <KEY_VOLUMEDOWN>;
474	status = "okay";
475};
476
477&pm7250b_adc {
478	adc-chan@4d {
479		reg = <ADC5_AMUX_THM1_100K_PU>;
480		qcom,ratiometric;
481		qcom,hw-settle-time = <200>;
482		qcom,pre-scaling = <1 1>;
483		label = "charger_skin_therm";
484	};
485
486	adc-chan@4f {
487		reg = <ADC5_AMUX_THM3_100K_PU>;
488		qcom,ratiometric;
489		qcom,hw-settle-time = <200>;
490		qcom,pre-scaling = <1 1>;
491		label = "conn_therm";
492	};
493};
494
495&pm7250b_adc_tm {
496	status = "okay";
497
498	charger-skin-therm@0 {
499		reg = <0>;
500		io-channels = <&pm7250b_adc ADC5_AMUX_THM1_100K_PU>;
501		qcom,ratiometric;
502		qcom,hw-settle-time-us = <200>;
503	};
504
505	conn-therm@1 {
506		reg = <1>;
507		io-channels = <&pm7250b_adc ADC5_AMUX_THM3_100K_PU>;
508		qcom,ratiometric;
509		qcom,hw-settle-time-us = <200>;
510	};
511};
512
513&pmk8350_rtc {
514	status = "okay";
515};
516
517&pmk8350_vadc {
518	adc-chan@644 {
519		reg = <PMK8350_ADC7_AMUX_THM1_100K_PU>;
520		qcom,ratiometric;
521		qcom,hw-settle-time = <200>;
522		qcom,pre-scaling = <1 1>;
523		label = "xo_therm";
524	};
525};
526
527&qupv3_id_0 {
528	status = "okay";
529};
530
531&qupv3_id_1 {
532	status = "okay";
533};
534
535&sdc2_off_state {
536	sd-cd-pins {
537		pins = "gpio94";
538		function = "gpio";
539		drive-strength = <2>;
540		bias-disable;
541	};
542};
543
544&sdc2_on_state {
545	sd-cd-pins {
546		pins = "gpio94";
547		function = "gpio";
548		drive-strength = <2>;
549		bias-pull-up;
550	};
551};
552
553&sdhc_2 {
554	vmmc-supply = <&vreg_l9e>;
555	vqmmc-supply = <&vreg_l6e>;
556
557	cd-gpios = <&tlmm 94 GPIO_ACTIVE_LOW>;
558
559	status = "okay";
560};
561
562&tlmm {
563	gpio-reserved-ranges = <13 4>, <56 2>;
564};
565
566&uart9 {
567	status = "okay";
568};
569
570&ufs_mem_hc {
571	reset-gpios = <&tlmm 156 GPIO_ACTIVE_LOW>;
572
573	vcc-supply = <&vreg_l7e>;
574	vcc-max-microamp = <800000>;
575	vccq2-supply = <&vreg_l12a>;
576	vccq2-max-microamp = <800000>;
577
578	status = "okay";
579};
580
581&ufs_mem_phy {
582	vdda-phy-supply = <&vreg_l18a>;
583	vdda-pll-supply = <&vreg_l22a>;
584
585	status = "okay";
586};
587
588&usb_1 {
589	status = "okay";
590};
591
592&usb_1_dwc3 {
593	maximum-speed = "super-speed";
594	dr_mode = "peripheral";
595};
596
597&usb_1_hsphy {
598	vdd-supply = <&vreg_l18a>;
599	vdda-pll-supply = <&vreg_l2a>;
600	vdda-phy-dpdm-supply = <&vreg_l3a>;
601
602	status = "okay";
603};
604
605&usb_1_qmpphy {
606	vdda-phy-supply = <&vreg_l22a>;
607	vdda-pll-supply = <&vreg_l16a>;
608
609	status = "okay";
610};
611
612&wifi {
613	vdd-0.8-cx-mx-supply = <&vreg_l4a>;
614	vdd-1.8-xo-supply = <&vreg_l7a>;
615	vdd-1.3-rfa-supply = <&vreg_l2e>;
616	vdd-3.3-ch0-supply = <&vreg_l10e>;
617	vdd-3.3-ch1-supply = <&vreg_l11e>;
618
619	status = "okay";
620};
621