1// SPDX-License-Identifier: GPL-2.0-only
2
3#include "msm8916-pm8916.dtsi"
4#include "msm8916-modem-qdsp6.dtsi"
5
6#include <dt-bindings/gpio/gpio.h>
7#include <dt-bindings/input/input.h>
8#include <dt-bindings/interrupt-controller/irq.h>
9#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
10
11/ {
12	aliases {
13		mmc0 = &sdhc_1; /* eMMC */
14		mmc1 = &sdhc_2; /* SD card */
15		serial0 = &blsp_uart2;
16	};
17
18	chosen {
19		stdout-path = "serial0";
20	};
21
22	reserved-memory {
23		/* Additional memory used by Samsung firmware modifications */
24		tz-apps@85a00000 {
25			reg = <0x0 0x85a00000 0x0 0x600000>;
26			no-map;
27		};
28	};
29
30	battery: battery {
31		compatible = "simple-battery";
32		precharge-current-microamp = <450000>;
33		precharge-upper-limit-microvolt = <3500000>;
34	};
35
36	clk_pwm_backlight: backlight {
37		compatible = "pwm-backlight";
38		pwms = <&clk_pwm 0 100000>;
39
40		enable-gpios = <&tlmm 98 GPIO_ACTIVE_HIGH>;
41
42		brightness-levels = <0 255>;
43		num-interpolated-steps = <255>;
44		default-brightness-level = <128>;
45
46		pinctrl-0 = <&backlight_en_default>;
47		pinctrl-names = "default";
48	};
49
50	clk_pwm: pwm {
51		compatible = "clk-pwm";
52		#pwm-cells = <2>;
53
54		clocks = <&gcc GCC_GP2_CLK>;
55
56		pinctrl-0 = <&backlight_pwm_default>;
57		pinctrl-names = "default";
58	};
59
60	gpio-keys {
61		compatible = "gpio-keys";
62
63		pinctrl-0 = <&gpio_keys_default>;
64		pinctrl-names = "default";
65
66		label = "GPIO Buttons";
67
68		button-volume-up {
69			label = "Volume Up";
70			gpios = <&tlmm 107 GPIO_ACTIVE_LOW>;
71			linux,code = <KEY_VOLUMEUP>;
72		};
73
74		button-home {
75			label = "Home";
76			gpios = <&tlmm 109 GPIO_ACTIVE_LOW>;
77			linux,code = <KEY_HOMEPAGE>;
78		};
79	};
80
81	haptic {
82		compatible = "regulator-haptic";
83		haptic-supply = <&reg_motor_vdd>;
84		min-microvolt = <3300000>;
85		max-microvolt = <3300000>;
86	};
87
88	i2c_nfc: i2c-nfc {
89		compatible = "i2c-gpio";
90		sda-gpios = <&tlmm 0 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
91		scl-gpios = <&tlmm 1 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
92
93		pinctrl-0 = <&nfc_i2c_default>;
94		pinctrl-names = "default";
95
96		#address-cells = <1>;
97		#size-cells = <0>;
98
99		s3fwrn5_nfc: nfc@27 {
100			compatible = "samsung,s3fwrn5-i2c";
101			reg = <0x27>;
102
103			interrupts-extended = <&tlmm 21 IRQ_TYPE_EDGE_RISING>;
104
105			en-gpios = <&tlmm 20 GPIO_ACTIVE_HIGH>;
106			wake-gpios = <&tlmm 49 GPIO_ACTIVE_HIGH>;
107
108			clocks = <&rpmcc RPM_SMD_BB_CLK2_PIN>;
109
110			pinctrl-0 = <&nfc_default>, <&nfc_clk_req>;
111			pinctrl-names = "default";
112
113			status = "disabled";
114		};
115	};
116
117	reg_motor_vdd: regulator-motor-vdd {
118		compatible = "regulator-fixed";
119		regulator-name = "motor_vdd";
120		regulator-min-microvolt = <3300000>;
121		regulator-max-microvolt = <3300000>;
122
123		gpio = <&tlmm 72 GPIO_ACTIVE_HIGH>;
124		enable-active-high;
125
126		pinctrl-0 = <&motor_en_default>;
127		pinctrl-names = "default";
128	};
129
130	reg_vdd_tsp_a: regulator-vdd-tsp-a {
131		compatible = "regulator-fixed";
132		regulator-name = "vdd_tsp_a";
133		regulator-min-microvolt = <3000000>;
134		regulator-max-microvolt = <3000000>;
135
136		gpio = <&tlmm 73 GPIO_ACTIVE_HIGH>;
137		enable-active-high;
138
139		pinctrl-0 = <&tsp_en_default>;
140		pinctrl-names = "default";
141	};
142};
143
144&blsp_i2c1 {
145	status = "okay";
146
147	muic: extcon@25 {
148		compatible = "siliconmitus,sm5502-muic";
149		reg = <0x25>;
150		interrupts-extended = <&tlmm 12 IRQ_TYPE_EDGE_FALLING>;
151		pinctrl-0 = <&muic_int_default>;
152		pinctrl-names = "default";
153
154		usb_con: connector {
155			compatible = "usb-b-connector";
156			label = "micro-USB";
157			type = "micro";
158		};
159	};
160};
161
162&blsp_i2c2 {
163	/* Available sensors vary depending on model variant */
164	status = "okay";
165
166	bosch_accel: accelerometer@10 {
167		compatible = "bosch,bmc150_accel";
168		reg = <0x10>;
169		interrupts-extended = <&tlmm 115 IRQ_TYPE_EDGE_RISING>;
170
171		vdd-supply = <&pm8916_l5>;
172		vddio-supply = <&pm8916_l5>;
173
174		pinctrl-0 = <&accel_int_default>;
175		pinctrl-names = "default";
176
177		mount-matrix = "0", "-1", "0",
178			      "-1",  "0", "0",
179			       "0",  "0", "1";
180
181		status = "disabled";
182	};
183
184	bosch_magn: magnetometer@12 {
185		compatible = "bosch,bmc150_magn";
186		reg = <0x12>;
187
188		vdd-supply = <&pm8916_l5>;
189		vddio-supply = <&pm8916_l5>;
190
191		mount-matrix = "0", "-1", "0",
192			      "-1",  "0", "0",
193			       "0",  "0", "1";
194
195		status = "disabled";
196	};
197
198	st_accel: accelerometer@1d {
199		compatible = "st,lsm303c-accel";
200		reg = <0x1d>;
201		interrupts-extended = <&tlmm 115 IRQ_TYPE_LEVEL_HIGH>;
202
203		vdd-supply = <&pm8916_l17>;
204		vddio-supply = <&pm8916_l5>;
205
206		pinctrl-0 = <&accel_int_default>;
207		pinctrl-names = "default";
208
209		st,drdy-int-pin = <1>;
210		mount-matrix = "0", "-1",  "0",
211			       "1",  "0",  "0",
212			       "0",  "0", "-1";
213
214		status = "disabled";
215	};
216
217	st_magn: magnetometer@1e {
218		compatible = "st,lsm303c-magn";
219		reg = <0x1e>;
220
221		vdd-supply = <&pm8916_l17>;
222		vddio-supply = <&pm8916_l5>;
223
224		mount-matrix = "0", "-1",  "0",
225			       "1",  "0",  "0",
226			       "0",  "0", "-1";
227
228		status = "disabled";
229	};
230};
231
232&blsp_i2c4 {
233	status = "okay";
234
235	fuel-gauge@35 {
236		compatible = "richtek,rt5033-battery";
237		reg = <0x35>;
238
239		interrupts-extended = <&tlmm 121 IRQ_TYPE_EDGE_FALLING>;
240
241		pinctrl-0 = <&fg_alert_default>;
242		pinctrl-names = "default";
243
244		power-supplies = <&charger>;
245	};
246};
247
248&blsp_i2c5 {
249	status = "okay";
250
251	touchscreen: touchscreen@20 {
252		compatible = "zinitix,bt541";
253		reg = <0x20>;
254
255		interrupts-extended = <&tlmm 13 IRQ_TYPE_EDGE_FALLING>;
256
257		touchscreen-size-x = <540>;
258		touchscreen-size-y = <960>;
259
260		vcca-supply = <&reg_vdd_tsp_a>;
261		vdd-supply = <&pm8916_l6>;
262
263		pinctrl-0 = <&tsp_int_default>;
264		pinctrl-names = "default";
265
266		linux,keycodes = <KEY_APPSELECT KEY_BACK>;
267	};
268};
269
270&blsp_i2c6 {
271	status = "okay";
272
273	pmic@34 {
274		compatible = "richtek,rt5033";
275		reg = <0x34>;
276
277		interrupts-extended = <&tlmm 62 IRQ_TYPE_EDGE_FALLING>;
278
279		pinctrl-0 = <&pmic_int_default>;
280		pinctrl-names = "default";
281
282		regulators {
283			rt5033_reg_safe_ldo: SAFE_LDO {
284				regulator-min-microvolt = <4900000>;
285				regulator-max-microvolt = <4900000>;
286				regulator-always-on;
287			};
288
289			/*
290			 * Needed for camera, but not used yet.
291			 * Define empty nodes to allow disabling the unused
292			 * regulators.
293			 */
294			LDO {};
295			BUCK {};
296		};
297
298		charger: charger {
299			compatible = "richtek,rt5033-charger";
300			monitored-battery = <&battery>;
301			richtek,usb-connector = <&usb_con>;
302		};
303	};
304};
305
306&blsp_uart2 {
307	status = "okay";
308};
309
310&mpss_mem {
311	reg = <0x0 0x86800000 0x0 0x5000000>;
312};
313
314&pm8916_resin {
315	linux,code = <KEY_VOLUMEDOWN>;
316	status = "okay";
317};
318
319&pm8916_rpm_regulators {
320	pm8916_l17: l17 {
321		regulator-min-microvolt = <2850000>;
322		regulator-max-microvolt = <2850000>;
323	};
324};
325
326&sdhc_1 {
327	status = "okay";
328};
329
330&sdhc_2 {
331	pinctrl-0 = <&sdc2_default &sdc2_cd_default>;
332	pinctrl-1 = <&sdc2_sleep &sdc2_cd_default>;
333	pinctrl-names = "default", "sleep";
334
335	cd-gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
336
337	status = "okay";
338};
339
340&sound {
341	model = "msm8916-1mic";
342	audio-routing =
343		"AMIC1", "MIC BIAS External1",
344		"AMIC2", "MIC BIAS Internal2",
345		"AMIC3", "MIC BIAS External1";
346};
347
348&usb {
349	extcon = <&muic>, <&muic>;
350	status = "okay";
351};
352
353&usb_hs_phy {
354	extcon = <&muic>;
355};
356
357&venus {
358	status = "okay";
359};
360
361&venus_mem {
362	status = "okay";
363};
364
365&wcnss {
366	status = "okay";
367};
368
369&wcnss_iris {
370	compatible = "qcom,wcn3620";
371};
372
373&wcnss_mem {
374	status = "okay";
375};
376
377&tlmm {
378	accel_int_default: accel-int-default-state {
379		pins = "gpio115";
380		function = "gpio";
381		drive-strength = <2>;
382		bias-disable;
383	};
384
385	backlight_en_default: backlight-en-default-state {
386		pins = "gpio98";
387		function = "gpio";
388		drive-strength = <2>;
389		bias-disable;
390	};
391
392	backlight_pwm_default: backlight-pwm-default-state {
393		pins = "gpio50";
394		function = "gcc_gp2_clk_a";
395	};
396
397	fg_alert_default: fg-alert-default-state {
398		pins = "gpio121";
399		function = "gpio";
400		drive-strength = <2>;
401		bias-disable;
402	};
403
404	gpio_keys_default: gpio-keys-default-state {
405		pins = "gpio107", "gpio109";
406		function = "gpio";
407		drive-strength = <2>;
408		bias-pull-up;
409	};
410
411	motor_en_default: motor-en-default-state {
412		pins = "gpio72";
413		function = "gpio";
414		drive-strength = <2>;
415		bias-disable;
416	};
417
418	muic_int_default: muic-int-default-state {
419		pins = "gpio12";
420		function = "gpio";
421		drive-strength = <2>;
422		bias-disable;
423	};
424
425	nfc_default: nfc-default-state {
426		irq-pins {
427			pins = "gpio21";
428			function = "gpio";
429			drive-strength = <2>;
430			bias-pull-down;
431		};
432
433		nfc-pins {
434			pins = "gpio20", "gpio49";
435			function = "gpio";
436			drive-strength = <2>;
437			bias-disable;
438		};
439	};
440
441	nfc_i2c_default: nfc-i2c-default-state {
442		pins = "gpio0", "gpio1";
443		function = "gpio";
444		drive-strength = <2>;
445		bias-disable;
446	};
447
448	pmic_int_default: pmic-int-default-state {
449		pins = "gpio62";
450		function = "gpio";
451		drive-strength = <2>;
452		bias-disable;
453	};
454
455	sdc2_cd_default: sdc2-cd-default-state {
456		pins = "gpio38";
457		function = "gpio";
458		drive-strength = <2>;
459		bias-disable;
460	};
461
462	tsp_en_default: tsp-en-default-state {
463		pins = "gpio73";
464		function = "gpio";
465		drive-strength = <2>;
466		bias-disable;
467	};
468
469	tsp_int_default: tsp-int-default-state {
470		pins = "gpio13";
471		function = "gpio";
472		drive-strength = <2>;
473		bias-disable;
474	};
475};
476
477&pm8916_gpios {
478	nfc_clk_req: nfc-clk-req-state {
479		pins = "gpio2";
480		function = "func1";
481		power-source = <PM8916_GPIO_L2>;
482		bias-disable;
483		input-enable;
484	};
485};
486