1// SPDX-License-Identifier: GPL-2.0-only
2
3#include "msm8916-pm8916.dtsi"
4#include <dt-bindings/gpio/gpio.h>
5#include <dt-bindings/input/input.h>
6#include <dt-bindings/interrupt-controller/irq.h>
7#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
8
9/ {
10	aliases {
11		serial0 = &blsp1_uart2;
12	};
13
14	chosen {
15		stdout-path = "serial0";
16	};
17
18	reserved-memory {
19		/* Additional memory used by Samsung firmware modifications */
20		tz-apps@85500000 {
21			reg = <0x0 0x85500000 0x0 0xb00000>;
22			no-map;
23		};
24	};
25
26	clk_pwm: pwm {
27		compatible = "clk-pwm";
28		#pwm-cells = <2>;
29
30		clocks = <&gcc GCC_GP2_CLK>;
31
32		pinctrl-names = "default";
33		pinctrl-0 = <&motor_pwm_default>;
34		status = "disabled";
35	};
36
37	gpio-keys {
38		compatible = "gpio-keys";
39
40		pinctrl-names = "default";
41		pinctrl-0 = <&gpio_keys_default>;
42
43		label = "GPIO Buttons";
44
45		button-volume-up {
46			label = "Volume Up";
47			gpios = <&msmgpio 107 GPIO_ACTIVE_LOW>;
48			linux,code = <KEY_VOLUMEUP>;
49		};
50
51		button-home {
52			label = "Home";
53			gpios = <&msmgpio 109 GPIO_ACTIVE_LOW>;
54			linux,code = <KEY_HOMEPAGE>;
55		};
56	};
57
58	gpio-hall-sensor {
59		compatible = "gpio-keys";
60
61		pinctrl-names = "default";
62		pinctrl-0 = <&gpio_hall_sensor_default>;
63
64		label = "GPIO Hall Effect Sensor";
65
66		event-hall-sensor {
67			label = "Hall Effect Sensor";
68			gpios = <&msmgpio 52 GPIO_ACTIVE_LOW>;
69			linux,input-type = <EV_SW>;
70			linux,code = <SW_LID>;
71			linux,can-disable;
72		};
73	};
74
75	/*
76	 * NOTE: A5 connects GPIO 76 to a reglator powering the motor
77	 * driver IC but A3 connects the same signal to an ENABLE pin of
78	 * the driver.
79	 */
80	reg_motor_vdd: regulator-motor-vdd {
81		compatible = "regulator-fixed";
82		regulator-name = "motor_vdd";
83		regulator-min-microvolt = <3000000>;
84		regulator-max-microvolt = <3000000>;
85
86		gpio = <&msmgpio 76 GPIO_ACTIVE_HIGH>;
87		enable-active-high;
88
89		pinctrl-names = "default";
90		pinctrl-0 = <&motor_en_default>;
91	};
92
93	reg_vdd_tsp_a: regulator-vdd-tsp-a {
94		compatible = "regulator-fixed";
95		regulator-name = "vdd_tsp_a";
96		regulator-min-microvolt = <3300000>;
97		regulator-max-microvolt = <3300000>;
98
99		gpio = <&msmgpio 73 GPIO_ACTIVE_HIGH>;
100		enable-active-high;
101
102		pinctrl-names = "default";
103		pinctrl-0 = <&tsp_en_default>;
104	};
105
106	i2c-muic {
107		compatible = "i2c-gpio";
108		sda-gpios = <&msmgpio 105 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
109		scl-gpios = <&msmgpio 106 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
110
111		pinctrl-names = "default";
112		pinctrl-0 = <&muic_i2c_default>;
113
114		#address-cells = <1>;
115		#size-cells = <0>;
116
117		muic: extcon@25 {
118			compatible = "siliconmitus,sm5502-muic";
119
120			reg = <0x25>;
121			interrupt-parent = <&msmgpio>;
122			interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
123
124			pinctrl-names = "default";
125			pinctrl-0 = <&muic_int_default>;
126		};
127	};
128
129	i2c-tkey {
130		compatible = "i2c-gpio";
131		sda-gpios = <&msmgpio 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
132		scl-gpios = <&msmgpio 17 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
133
134		pinctrl-names = "default";
135		pinctrl-0 = <&tkey_i2c_default>;
136
137		#address-cells = <1>;
138		#size-cells = <0>;
139
140		touchkey: touchkey@20 {
141			/* Note: Actually an ABOV MCU that implements same interface */
142			compatible = "coreriver,tc360-touchkey";
143			reg = <0x20>;
144
145			interrupt-parent = <&msmgpio>;
146			interrupts = <98 IRQ_TYPE_EDGE_FALLING>;
147
148			/* vcc/vdd-supply are board-specific */
149			vddio-supply = <&pm8916_l6>;
150
151			linux,keycodes = <KEY_APPSELECT KEY_BACK>;
152
153			pinctrl-names = "default";
154			pinctrl-0 = <&tkey_default>;
155		};
156	};
157
158	i2c-nfc {
159		compatible = "i2c-gpio";
160		sda-gpios = <&msmgpio 0 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
161		scl-gpios = <&msmgpio 1 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
162
163		pinctrl-names = "default";
164		pinctrl-0 = <&nfc_i2c_default>;
165
166		#address-cells = <1>;
167		#size-cells = <0>;
168
169		nfc@27 {
170			compatible = "samsung,s3fwrn5-i2c";
171			reg = <0x27>;
172
173			interrupt-parent = <&msmgpio>;
174			interrupts = <21 IRQ_TYPE_EDGE_RISING>;
175
176			en-gpios = <&msmgpio 20 GPIO_ACTIVE_LOW>;
177			wake-gpios = <&msmgpio 49 GPIO_ACTIVE_HIGH>;
178
179			clocks = <&rpmcc RPM_SMD_BB_CLK2_PIN>;
180
181			pinctrl-names = "default";
182			pinctrl-0 = <&nfc_default &nfc_clk_req>;
183		};
184	};
185
186	vibrator: vibrator {
187		compatible = "pwm-vibrator";
188
189		pwms = <&clk_pwm 0 100000>;
190		pwm-names = "enable";
191
192		vcc-supply = <&reg_motor_vdd>;
193		status = "disabled";
194	};
195};
196
197&blsp_i2c2 {
198	status = "okay";
199
200	accelerometer: accelerometer@10 {
201		compatible = "bosch,bmc150_accel";
202		reg = <0x10>;
203		interrupt-parent = <&msmgpio>;
204		interrupts = <115 IRQ_TYPE_EDGE_RISING>;
205
206		vdd-supply = <&pm8916_l17>;
207		vddio-supply = <&pm8916_l5>;
208
209		pinctrl-names = "default";
210		pinctrl-0 = <&accel_int_default>;
211	};
212
213	magnetometer@12 {
214		compatible = "bosch,bmc150_magn";
215		reg = <0x12>;
216
217		vdd-supply = <&pm8916_l17>;
218		vddio-supply = <&pm8916_l5>;
219	};
220};
221
222&blsp_i2c4 {
223	status = "okay";
224
225	battery@35 {
226		compatible = "richtek,rt5033-battery";
227		reg = <0x35>;
228		interrupt-parent = <&msmgpio>;
229		interrupts = <121 IRQ_TYPE_EDGE_BOTH>;
230
231		pinctrl-names = "default";
232		pinctrl-0 = <&fg_alert_default>;
233	};
234};
235
236&blsp1_uart2 {
237	status = "okay";
238};
239
240&dsi0 {
241	pinctrl-names = "default", "sleep";
242	pinctrl-0 = <&mdss_default>;
243	pinctrl-1 = <&mdss_sleep>;
244};
245
246&mdss {
247	status = "okay";
248};
249
250&pm8916_resin {
251	status = "okay";
252	linux,code = <KEY_VOLUMEDOWN>;
253};
254
255&pronto {
256	status = "okay";
257};
258
259&sdhc_1 {
260	status = "okay";
261
262	pinctrl-names = "default", "sleep";
263	pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
264	pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
265};
266
267&sdhc_2 {
268	status = "okay";
269
270	pinctrl-names = "default", "sleep";
271	pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on &sdc2_cd_on>;
272	pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;
273
274	cd-gpios = <&msmgpio 38 GPIO_ACTIVE_LOW>;
275};
276
277&usb {
278	status = "okay";
279	extcon = <&muic>, <&muic>;
280};
281
282&usb_hs_phy {
283	extcon = <&muic>;
284};
285
286&smd_rpm_regulators {
287	vdd_l1_l2_l3-supply = <&pm8916_s3>;
288	vdd_l4_l5_l6-supply = <&pm8916_s4>;
289	vdd_l7-supply = <&pm8916_s4>;
290
291	s3 {
292		regulator-min-microvolt = <1200000>;
293		regulator-max-microvolt = <1300000>;
294	};
295
296	s4 {
297		regulator-min-microvolt = <1800000>;
298		regulator-max-microvolt = <2100000>;
299	};
300
301	l1 {
302		regulator-min-microvolt = <1225000>;
303		regulator-max-microvolt = <1225000>;
304	};
305
306	l2 {
307		regulator-min-microvolt = <1200000>;
308		regulator-max-microvolt = <1200000>;
309	};
310
311	l4 {
312		regulator-min-microvolt = <2050000>;
313		regulator-max-microvolt = <2050000>;
314	};
315
316	l5 {
317		regulator-min-microvolt = <1800000>;
318		regulator-max-microvolt = <1800000>;
319	};
320
321	l6 {
322		regulator-min-microvolt = <1800000>;
323		regulator-max-microvolt = <1800000>;
324	};
325
326	l7 {
327		regulator-min-microvolt = <1800000>;
328		regulator-max-microvolt = <1800000>;
329	};
330
331	l8 {
332		regulator-min-microvolt = <2850000>;
333		regulator-max-microvolt = <2900000>;
334	};
335
336	l9 {
337		regulator-min-microvolt = <3300000>;
338		regulator-max-microvolt = <3300000>;
339	};
340
341	l10 {
342		regulator-min-microvolt = <2700000>;
343		regulator-max-microvolt = <2800000>;
344	};
345
346	l11 {
347		regulator-min-microvolt = <1800000>;
348		regulator-max-microvolt = <2950000>;
349		regulator-allow-set-load;
350		regulator-system-load = <200000>;
351	};
352
353	l12 {
354		regulator-min-microvolt = <1800000>;
355		regulator-max-microvolt = <2950000>;
356	};
357
358	l13 {
359		regulator-min-microvolt = <3075000>;
360		regulator-max-microvolt = <3075000>;
361	};
362
363	l14 {
364		regulator-min-microvolt = <1800000>;
365		regulator-max-microvolt = <3300000>;
366	};
367
368	l15 {
369		regulator-min-microvolt = <1800000>;
370		regulator-max-microvolt = <3300000>;
371	};
372
373	l16 {
374		regulator-min-microvolt = <1800000>;
375		regulator-max-microvolt = <3300000>;
376	};
377
378	l17 {
379		regulator-min-microvolt = <2850000>;
380		regulator-max-microvolt = <2850000>;
381	};
382
383	l18 {
384		regulator-min-microvolt = <2700000>;
385		regulator-max-microvolt = <2700000>;
386	};
387};
388
389&msmgpio {
390	accel_int_default: accel-int-default-state {
391		pins = "gpio115";
392		function = "gpio";
393
394		drive-strength = <2>;
395		bias-disable;
396	};
397
398	fg_alert_default: fg-alert-default-state {
399		pins = "gpio121";
400		function = "gpio";
401
402		drive-strength = <2>;
403		bias-disable;
404	};
405
406	gpio_keys_default: gpio-keys-default-state {
407		pins = "gpio107", "gpio109";
408		function = "gpio";
409
410		drive-strength = <2>;
411		bias-pull-up;
412	};
413
414	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
415		pins = "gpio52";
416		function = "gpio";
417
418		drive-strength = <2>;
419		bias-disable;
420	};
421
422	mdss_default: mdss-default-state {
423		pins = "gpio25";
424		function = "gpio";
425
426		drive-strength = <8>;
427		bias-disable;
428	};
429	mdss_sleep: mdss-sleep-state {
430		pins = "gpio25";
431		function = "gpio";
432
433		drive-strength = <2>;
434		bias-pull-down;
435	};
436
437	motor_en_default: motor-en-default-state {
438		pins = "gpio76";
439		function = "gpio";
440
441		drive-strength = <2>;
442		bias-disable;
443	};
444
445	motor_pwm_default: motor-pwm-default-state {
446		pins = "gpio50";
447		function = "gcc_gp2_clk_a";
448	};
449
450	muic_i2c_default: muic-i2c-default-state {
451		pins = "gpio105", "gpio106";
452		function = "gpio";
453
454		drive-strength = <2>;
455		bias-disable;
456	};
457
458	muic_int_default: muic-int-default-state {
459		pins = "gpio12";
460		function = "gpio";
461
462		drive-strength = <2>;
463		bias-disable;
464	};
465
466	nfc_default: nfc-default-state {
467		nfc-pins {
468			pins = "gpio20", "gpio49";
469			function = "gpio";
470
471			drive-strength = <2>;
472			bias-disable;
473		};
474
475		irq-pins {
476			pins = "gpio21";
477			function = "gpio";
478
479			drive-strength = <2>;
480			bias-pull-down;
481		};
482	};
483
484	nfc_i2c_default: nfc-i2c-default-state {
485		pins = "gpio0", "gpio1";
486		function = "gpio";
487
488		drive-strength = <2>;
489		bias-disable;
490	};
491
492	tkey_default: tkey-default-state {
493		pins = "gpio98";
494		function = "gpio";
495
496		drive-strength = <2>;
497		bias-disable;
498	};
499
500	tkey_i2c_default: tkey-i2c-default-state {
501		pins = "gpio16", "gpio17";
502		function = "gpio";
503
504		drive-strength = <2>;
505		bias-disable;
506	};
507
508	tsp_en_default: tsp-en-default-state {
509		pins = "gpio73";
510		function = "gpio";
511
512		drive-strength = <2>;
513		bias-disable;
514	};
515
516	ts_int_default: ts-int-default-state {
517		pins = "gpio13";
518		function = "gpio";
519
520		drive-strength = <2>;
521		bias-disable;
522	};
523};
524
525&pm8916_gpios {
526	nfc_clk_req: nfc-clk-req-state {
527		pins = "gpio2";
528		function = "func1";
529
530		input-enable;
531		bias-disable;
532		power-source = <PM8916_GPIO_L2>;
533	};
534};
535