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		mmc0 = &sdhc_1; /* eMMC */
12		mmc1 = &sdhc_2; /* SD card */
13		serial0 = &blsp_uart2;
14	};
15
16	chosen {
17		stdout-path = "serial0";
18	};
19
20	reserved-memory {
21		/* Additional memory used by Samsung firmware modifications */
22		tz-apps@85500000 {
23			reg = <0x0 0x85500000 0x0 0xb00000>;
24			no-map;
25		};
26	};
27
28	clk_pwm: pwm {
29		compatible = "clk-pwm";
30		#pwm-cells = <2>;
31
32		clocks = <&gcc GCC_GP2_CLK>;
33
34		pinctrl-names = "default";
35		pinctrl-0 = <&motor_pwm_default>;
36		status = "disabled";
37	};
38
39	gpio-keys {
40		compatible = "gpio-keys";
41
42		pinctrl-names = "default";
43		pinctrl-0 = <&gpio_keys_default>;
44
45		label = "GPIO Buttons";
46
47		button-volume-up {
48			label = "Volume Up";
49			gpios = <&tlmm 107 GPIO_ACTIVE_LOW>;
50			linux,code = <KEY_VOLUMEUP>;
51		};
52
53		button-home {
54			label = "Home";
55			gpios = <&tlmm 109 GPIO_ACTIVE_LOW>;
56			linux,code = <KEY_HOMEPAGE>;
57		};
58	};
59
60	gpio-hall-sensor {
61		compatible = "gpio-keys";
62
63		pinctrl-names = "default";
64		pinctrl-0 = <&gpio_hall_sensor_default>;
65
66		label = "GPIO Hall Effect Sensor";
67
68		event-hall-sensor {
69			label = "Hall Effect Sensor";
70			gpios = <&tlmm 52 GPIO_ACTIVE_LOW>;
71			linux,input-type = <EV_SW>;
72			linux,code = <SW_LID>;
73			linux,can-disable;
74		};
75	};
76
77	/*
78	 * NOTE: A5 connects GPIO 76 to a reglator powering the motor
79	 * driver IC but A3 connects the same signal to an ENABLE pin of
80	 * the driver.
81	 */
82	reg_motor_vdd: regulator-motor-vdd {
83		compatible = "regulator-fixed";
84		regulator-name = "motor_vdd";
85		regulator-min-microvolt = <3000000>;
86		regulator-max-microvolt = <3000000>;
87
88		gpio = <&tlmm 76 GPIO_ACTIVE_HIGH>;
89		enable-active-high;
90
91		pinctrl-names = "default";
92		pinctrl-0 = <&motor_en_default>;
93	};
94
95	reg_vdd_tsp_a: regulator-vdd-tsp-a {
96		compatible = "regulator-fixed";
97		regulator-name = "vdd_tsp_a";
98		regulator-min-microvolt = <3300000>;
99		regulator-max-microvolt = <3300000>;
100
101		gpio = <&tlmm 73 GPIO_ACTIVE_HIGH>;
102		enable-active-high;
103
104		pinctrl-names = "default";
105		pinctrl-0 = <&tsp_en_default>;
106	};
107
108	i2c-muic {
109		compatible = "i2c-gpio";
110		sda-gpios = <&tlmm 105 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
111		scl-gpios = <&tlmm 106 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
112
113		pinctrl-names = "default";
114		pinctrl-0 = <&muic_i2c_default>;
115
116		#address-cells = <1>;
117		#size-cells = <0>;
118
119		muic: extcon@25 {
120			compatible = "siliconmitus,sm5502-muic";
121
122			reg = <0x25>;
123			interrupt-parent = <&tlmm>;
124			interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
125
126			pinctrl-names = "default";
127			pinctrl-0 = <&muic_int_default>;
128		};
129	};
130
131	i2c-tkey {
132		compatible = "i2c-gpio";
133		sda-gpios = <&tlmm 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
134		scl-gpios = <&tlmm 17 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
135
136		pinctrl-names = "default";
137		pinctrl-0 = <&tkey_i2c_default>;
138
139		#address-cells = <1>;
140		#size-cells = <0>;
141
142		touchkey: touchkey@20 {
143			/* Note: Actually an ABOV MCU that implements same interface */
144			compatible = "coreriver,tc360-touchkey";
145			reg = <0x20>;
146
147			interrupt-parent = <&tlmm>;
148			interrupts = <98 IRQ_TYPE_EDGE_FALLING>;
149
150			/* vcc/vdd-supply are board-specific */
151			vddio-supply = <&pm8916_l6>;
152
153			linux,keycodes = <KEY_APPSELECT KEY_BACK>;
154
155			pinctrl-names = "default";
156			pinctrl-0 = <&tkey_default>;
157		};
158	};
159
160	i2c-nfc {
161		compatible = "i2c-gpio";
162		sda-gpios = <&tlmm 0 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
163		scl-gpios = <&tlmm 1 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
164
165		pinctrl-names = "default";
166		pinctrl-0 = <&nfc_i2c_default>;
167
168		#address-cells = <1>;
169		#size-cells = <0>;
170
171		nfc@27 {
172			compatible = "samsung,s3fwrn5-i2c";
173			reg = <0x27>;
174
175			interrupt-parent = <&tlmm>;
176			interrupts = <21 IRQ_TYPE_EDGE_RISING>;
177
178			en-gpios = <&tlmm 20 GPIO_ACTIVE_LOW>;
179			wake-gpios = <&tlmm 49 GPIO_ACTIVE_HIGH>;
180
181			clocks = <&rpmcc RPM_SMD_BB_CLK2_PIN>;
182
183			pinctrl-names = "default";
184			pinctrl-0 = <&nfc_default &nfc_clk_req>;
185		};
186	};
187
188	vibrator: vibrator {
189		compatible = "pwm-vibrator";
190
191		pwms = <&clk_pwm 0 100000>;
192		pwm-names = "enable";
193
194		vcc-supply = <&reg_motor_vdd>;
195		status = "disabled";
196	};
197};
198
199&blsp_i2c2 {
200	status = "okay";
201
202	accelerometer: accelerometer@10 {
203		compatible = "bosch,bmc150_accel";
204		reg = <0x10>;
205		interrupt-parent = <&tlmm>;
206		interrupts = <115 IRQ_TYPE_EDGE_RISING>;
207
208		vdd-supply = <&pm8916_l17>;
209		vddio-supply = <&pm8916_l5>;
210
211		pinctrl-names = "default";
212		pinctrl-0 = <&accel_int_default>;
213	};
214
215	magnetometer@12 {
216		compatible = "bosch,bmc150_magn";
217		reg = <0x12>;
218
219		vdd-supply = <&pm8916_l17>;
220		vddio-supply = <&pm8916_l5>;
221	};
222};
223
224&blsp_i2c4 {
225	status = "okay";
226
227	battery@35 {
228		compatible = "richtek,rt5033-battery";
229		reg = <0x35>;
230		interrupt-parent = <&tlmm>;
231		interrupts = <121 IRQ_TYPE_EDGE_BOTH>;
232
233		pinctrl-names = "default";
234		pinctrl-0 = <&fg_alert_default>;
235	};
236};
237
238&blsp_uart2 {
239	status = "okay";
240};
241
242&mdss {
243	status = "okay";
244};
245
246&mdss_dsi0 {
247	pinctrl-names = "default", "sleep";
248	pinctrl-0 = <&mdss_default>;
249	pinctrl-1 = <&mdss_sleep>;
250};
251
252&pm8916_resin {
253	status = "okay";
254	linux,code = <KEY_VOLUMEDOWN>;
255};
256
257&pm8916_rpm_regulators {
258	pm8916_l17: l17 {
259		regulator-min-microvolt = <2850000>;
260		regulator-max-microvolt = <2850000>;
261	};
262};
263
264&sdhc_1 {
265	status = "okay";
266};
267
268&sdhc_2 {
269	status = "okay";
270
271	pinctrl-names = "default", "sleep";
272	pinctrl-0 = <&sdc2_default &sdc2_cd_default>;
273	pinctrl-1 = <&sdc2_sleep &sdc2_cd_default>;
274
275	cd-gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
276};
277
278&usb {
279	status = "okay";
280	extcon = <&muic>, <&muic>;
281};
282
283&usb_hs_phy {
284	extcon = <&muic>;
285};
286
287&tlmm {
288	accel_int_default: accel-int-default-state {
289		pins = "gpio115";
290		function = "gpio";
291
292		drive-strength = <2>;
293		bias-disable;
294	};
295
296	fg_alert_default: fg-alert-default-state {
297		pins = "gpio121";
298		function = "gpio";
299
300		drive-strength = <2>;
301		bias-disable;
302	};
303
304	gpio_keys_default: gpio-keys-default-state {
305		pins = "gpio107", "gpio109";
306		function = "gpio";
307
308		drive-strength = <2>;
309		bias-pull-up;
310	};
311
312	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
313		pins = "gpio52";
314		function = "gpio";
315
316		drive-strength = <2>;
317		bias-disable;
318	};
319
320	mdss_default: mdss-default-state {
321		pins = "gpio25";
322		function = "gpio";
323
324		drive-strength = <8>;
325		bias-disable;
326	};
327	mdss_sleep: mdss-sleep-state {
328		pins = "gpio25";
329		function = "gpio";
330
331		drive-strength = <2>;
332		bias-pull-down;
333	};
334
335	motor_en_default: motor-en-default-state {
336		pins = "gpio76";
337		function = "gpio";
338
339		drive-strength = <2>;
340		bias-disable;
341	};
342
343	motor_pwm_default: motor-pwm-default-state {
344		pins = "gpio50";
345		function = "gcc_gp2_clk_a";
346	};
347
348	muic_i2c_default: muic-i2c-default-state {
349		pins = "gpio105", "gpio106";
350		function = "gpio";
351
352		drive-strength = <2>;
353		bias-disable;
354	};
355
356	muic_int_default: muic-int-default-state {
357		pins = "gpio12";
358		function = "gpio";
359
360		drive-strength = <2>;
361		bias-disable;
362	};
363
364	nfc_default: nfc-default-state {
365		nfc-pins {
366			pins = "gpio20", "gpio49";
367			function = "gpio";
368
369			drive-strength = <2>;
370			bias-disable;
371		};
372
373		irq-pins {
374			pins = "gpio21";
375			function = "gpio";
376
377			drive-strength = <2>;
378			bias-pull-down;
379		};
380	};
381
382	nfc_i2c_default: nfc-i2c-default-state {
383		pins = "gpio0", "gpio1";
384		function = "gpio";
385
386		drive-strength = <2>;
387		bias-disable;
388	};
389
390	sdc2_cd_default: sdc2-cd-default-state {
391		pins = "gpio38";
392		function = "gpio";
393		drive-strength = <2>;
394		bias-disable;
395	};
396
397	tkey_default: tkey-default-state {
398		pins = "gpio98";
399		function = "gpio";
400
401		drive-strength = <2>;
402		bias-disable;
403	};
404
405	tkey_i2c_default: tkey-i2c-default-state {
406		pins = "gpio16", "gpio17";
407		function = "gpio";
408
409		drive-strength = <2>;
410		bias-disable;
411	};
412
413	tsp_en_default: tsp-en-default-state {
414		pins = "gpio73";
415		function = "gpio";
416
417		drive-strength = <2>;
418		bias-disable;
419	};
420
421	ts_int_default: ts-int-default-state {
422		pins = "gpio13";
423		function = "gpio";
424
425		drive-strength = <2>;
426		bias-disable;
427	};
428};
429
430&pm8916_gpios {
431	nfc_clk_req: nfc-clk-req-state {
432		pins = "gpio2";
433		function = "func1";
434
435		input-enable;
436		bias-disable;
437		power-source = <PM8916_GPIO_L2>;
438	};
439};
440