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&sdhc_1 {
256	status = "okay";
257
258	pinctrl-names = "default", "sleep";
259	pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
260	pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
261};
262
263&sdhc_2 {
264	status = "okay";
265
266	pinctrl-names = "default", "sleep";
267	pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on &sdc2_cd_on>;
268	pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;
269
270	cd-gpios = <&msmgpio 38 GPIO_ACTIVE_LOW>;
271};
272
273&usb {
274	status = "okay";
275	extcon = <&muic>, <&muic>;
276};
277
278&usb_hs_phy {
279	extcon = <&muic>;
280};
281
282&smd_rpm_regulators {
283	vdd_l1_l2_l3-supply = <&pm8916_s3>;
284	vdd_l4_l5_l6-supply = <&pm8916_s4>;
285	vdd_l7-supply = <&pm8916_s4>;
286
287	s3 {
288		regulator-min-microvolt = <1200000>;
289		regulator-max-microvolt = <1300000>;
290	};
291
292	s4 {
293		regulator-min-microvolt = <1800000>;
294		regulator-max-microvolt = <2100000>;
295	};
296
297	l1 {
298		regulator-min-microvolt = <1225000>;
299		regulator-max-microvolt = <1225000>;
300	};
301
302	l2 {
303		regulator-min-microvolt = <1200000>;
304		regulator-max-microvolt = <1200000>;
305	};
306
307	l4 {
308		regulator-min-microvolt = <2050000>;
309		regulator-max-microvolt = <2050000>;
310	};
311
312	l5 {
313		regulator-min-microvolt = <1800000>;
314		regulator-max-microvolt = <1800000>;
315	};
316
317	l6 {
318		regulator-min-microvolt = <1800000>;
319		regulator-max-microvolt = <1800000>;
320	};
321
322	l7 {
323		regulator-min-microvolt = <1800000>;
324		regulator-max-microvolt = <1800000>;
325	};
326
327	l8 {
328		regulator-min-microvolt = <2850000>;
329		regulator-max-microvolt = <2900000>;
330	};
331
332	l9 {
333		regulator-min-microvolt = <3300000>;
334		regulator-max-microvolt = <3300000>;
335	};
336
337	l10 {
338		regulator-min-microvolt = <2700000>;
339		regulator-max-microvolt = <2800000>;
340	};
341
342	l11 {
343		regulator-min-microvolt = <1800000>;
344		regulator-max-microvolt = <2950000>;
345		regulator-allow-set-load;
346		regulator-system-load = <200000>;
347	};
348
349	l12 {
350		regulator-min-microvolt = <1800000>;
351		regulator-max-microvolt = <2950000>;
352	};
353
354	l13 {
355		regulator-min-microvolt = <3075000>;
356		regulator-max-microvolt = <3075000>;
357	};
358
359	l14 {
360		regulator-min-microvolt = <1800000>;
361		regulator-max-microvolt = <3300000>;
362	};
363
364	l15 {
365		regulator-min-microvolt = <1800000>;
366		regulator-max-microvolt = <3300000>;
367	};
368
369	l16 {
370		regulator-min-microvolt = <1800000>;
371		regulator-max-microvolt = <3300000>;
372	};
373
374	l17 {
375		regulator-min-microvolt = <2850000>;
376		regulator-max-microvolt = <2850000>;
377	};
378
379	l18 {
380		regulator-min-microvolt = <2700000>;
381		regulator-max-microvolt = <2700000>;
382	};
383};
384
385&msmgpio {
386	accel_int_default: accel-int-default-state {
387		pins = "gpio115";
388		function = "gpio";
389
390		drive-strength = <2>;
391		bias-disable;
392	};
393
394	fg_alert_default: fg-alert-default-state {
395		pins = "gpio121";
396		function = "gpio";
397
398		drive-strength = <2>;
399		bias-disable;
400	};
401
402	gpio_keys_default: gpio-keys-default-state {
403		pins = "gpio107", "gpio109";
404		function = "gpio";
405
406		drive-strength = <2>;
407		bias-pull-up;
408	};
409
410	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
411		pins = "gpio52";
412		function = "gpio";
413
414		drive-strength = <2>;
415		bias-disable;
416	};
417
418	mdss_default: mdss-default-state {
419		pins = "gpio25";
420		function = "gpio";
421
422		drive-strength = <8>;
423		bias-disable;
424	};
425	mdss_sleep: mdss-sleep-state {
426		pins = "gpio25";
427		function = "gpio";
428
429		drive-strength = <2>;
430		bias-pull-down;
431	};
432
433	motor_en_default: motor-en-default-state {
434		pins = "gpio76";
435		function = "gpio";
436
437		drive-strength = <2>;
438		bias-disable;
439	};
440
441	motor_pwm_default: motor-pwm-default-state {
442		pins = "gpio50";
443		function = "gcc_gp2_clk_a";
444	};
445
446	muic_i2c_default: muic-i2c-default-state {
447		pins = "gpio105", "gpio106";
448		function = "gpio";
449
450		drive-strength = <2>;
451		bias-disable;
452	};
453
454	muic_int_default: muic-int-default-state {
455		pins = "gpio12";
456		function = "gpio";
457
458		drive-strength = <2>;
459		bias-disable;
460	};
461
462	nfc_default: nfc-default-state {
463		nfc-pins {
464			pins = "gpio20", "gpio49";
465			function = "gpio";
466
467			drive-strength = <2>;
468			bias-disable;
469		};
470
471		irq-pins {
472			pins = "gpio21";
473			function = "gpio";
474
475			drive-strength = <2>;
476			bias-pull-down;
477		};
478	};
479
480	nfc_i2c_default: nfc-i2c-default-state {
481		pins = "gpio0", "gpio1";
482		function = "gpio";
483
484		drive-strength = <2>;
485		bias-disable;
486	};
487
488	tkey_default: tkey-default-state {
489		pins = "gpio98";
490		function = "gpio";
491
492		drive-strength = <2>;
493		bias-disable;
494	};
495
496	tkey_i2c_default: tkey-i2c-default-state {
497		pins = "gpio16", "gpio17";
498		function = "gpio";
499
500		drive-strength = <2>;
501		bias-disable;
502	};
503
504	tsp_en_default: tsp-en-default-state {
505		pins = "gpio73";
506		function = "gpio";
507
508		drive-strength = <2>;
509		bias-disable;
510	};
511
512	ts_int_default: ts-int-default-state {
513		pins = "gpio13";
514		function = "gpio";
515
516		drive-strength = <2>;
517		bias-disable;
518	};
519};
520
521&pm8916_gpios {
522	nfc_clk_req: nfc-clk-req-state {
523		pins = "gpio2";
524		function = "func1";
525
526		input-enable;
527		bias-disable;
528		power-source = <PM8916_GPIO_L2>;
529	};
530};
531