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	pinctrl-names = "default", "sleep";
268	pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
269	pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
270};
271
272&sdhc_2 {
273	status = "okay";
274
275	pinctrl-names = "default", "sleep";
276	pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on &sdc2_cd_on>;
277	pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;
278
279	cd-gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
280};
281
282&usb {
283	status = "okay";
284	extcon = <&muic>, <&muic>;
285};
286
287&usb_hs_phy {
288	extcon = <&muic>;
289};
290
291&tlmm {
292	accel_int_default: accel-int-default-state {
293		pins = "gpio115";
294		function = "gpio";
295
296		drive-strength = <2>;
297		bias-disable;
298	};
299
300	fg_alert_default: fg-alert-default-state {
301		pins = "gpio121";
302		function = "gpio";
303
304		drive-strength = <2>;
305		bias-disable;
306	};
307
308	gpio_keys_default: gpio-keys-default-state {
309		pins = "gpio107", "gpio109";
310		function = "gpio";
311
312		drive-strength = <2>;
313		bias-pull-up;
314	};
315
316	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
317		pins = "gpio52";
318		function = "gpio";
319
320		drive-strength = <2>;
321		bias-disable;
322	};
323
324	mdss_default: mdss-default-state {
325		pins = "gpio25";
326		function = "gpio";
327
328		drive-strength = <8>;
329		bias-disable;
330	};
331	mdss_sleep: mdss-sleep-state {
332		pins = "gpio25";
333		function = "gpio";
334
335		drive-strength = <2>;
336		bias-pull-down;
337	};
338
339	motor_en_default: motor-en-default-state {
340		pins = "gpio76";
341		function = "gpio";
342
343		drive-strength = <2>;
344		bias-disable;
345	};
346
347	motor_pwm_default: motor-pwm-default-state {
348		pins = "gpio50";
349		function = "gcc_gp2_clk_a";
350	};
351
352	muic_i2c_default: muic-i2c-default-state {
353		pins = "gpio105", "gpio106";
354		function = "gpio";
355
356		drive-strength = <2>;
357		bias-disable;
358	};
359
360	muic_int_default: muic-int-default-state {
361		pins = "gpio12";
362		function = "gpio";
363
364		drive-strength = <2>;
365		bias-disable;
366	};
367
368	nfc_default: nfc-default-state {
369		nfc-pins {
370			pins = "gpio20", "gpio49";
371			function = "gpio";
372
373			drive-strength = <2>;
374			bias-disable;
375		};
376
377		irq-pins {
378			pins = "gpio21";
379			function = "gpio";
380
381			drive-strength = <2>;
382			bias-pull-down;
383		};
384	};
385
386	nfc_i2c_default: nfc-i2c-default-state {
387		pins = "gpio0", "gpio1";
388		function = "gpio";
389
390		drive-strength = <2>;
391		bias-disable;
392	};
393
394	tkey_default: tkey-default-state {
395		pins = "gpio98";
396		function = "gpio";
397
398		drive-strength = <2>;
399		bias-disable;
400	};
401
402	tkey_i2c_default: tkey-i2c-default-state {
403		pins = "gpio16", "gpio17";
404		function = "gpio";
405
406		drive-strength = <2>;
407		bias-disable;
408	};
409
410	tsp_en_default: tsp-en-default-state {
411		pins = "gpio73";
412		function = "gpio";
413
414		drive-strength = <2>;
415		bias-disable;
416	};
417
418	ts_int_default: ts-int-default-state {
419		pins = "gpio13";
420		function = "gpio";
421
422		drive-strength = <2>;
423		bias-disable;
424	};
425};
426
427&pm8916_gpios {
428	nfc_clk_req: nfc-clk-req-state {
429		pins = "gpio2";
430		function = "func1";
431
432		input-enable;
433		bias-disable;
434		power-source = <PM8916_GPIO_L2>;
435	};
436};
437