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#include <dt-bindings/sound/apq8016-lpass.h>
11
12/ {
13	aliases {
14		mmc0 = &sdhc_1; /* eMMC */
15		mmc1 = &sdhc_2; /* SD card */
16		serial0 = &blsp_uart2;
17	};
18
19	chosen {
20		stdout-path = "serial0";
21	};
22
23	reserved-memory {
24		/* Additional memory used by Samsung firmware modifications */
25		tz-apps@85500000 {
26			reg = <0x0 0x85500000 0x0 0xb00000>;
27			no-map;
28		};
29	};
30
31	clk_pwm: pwm {
32		compatible = "clk-pwm";
33		#pwm-cells = <2>;
34
35		clocks = <&gcc GCC_GP2_CLK>;
36
37		pinctrl-names = "default";
38		pinctrl-0 = <&motor_pwm_default>;
39		status = "disabled";
40	};
41
42	gpio-keys {
43		compatible = "gpio-keys";
44
45		pinctrl-names = "default";
46		pinctrl-0 = <&gpio_keys_default>;
47
48		label = "GPIO Buttons";
49
50		button-volume-up {
51			label = "Volume Up";
52			gpios = <&tlmm 107 GPIO_ACTIVE_LOW>;
53			linux,code = <KEY_VOLUMEUP>;
54		};
55
56		button-home {
57			label = "Home";
58			gpios = <&tlmm 109 GPIO_ACTIVE_LOW>;
59			linux,code = <KEY_HOMEPAGE>;
60		};
61	};
62
63	gpio-hall-sensor {
64		compatible = "gpio-keys";
65
66		pinctrl-names = "default";
67		pinctrl-0 = <&gpio_hall_sensor_default>;
68
69		label = "GPIO Hall Effect Sensor";
70
71		event-hall-sensor {
72			label = "Hall Effect Sensor";
73			gpios = <&tlmm 52 GPIO_ACTIVE_LOW>;
74			linux,input-type = <EV_SW>;
75			linux,code = <SW_LID>;
76			linux,can-disable;
77		};
78	};
79
80	/*
81	 * NOTE: A5 connects GPIO 76 to a reglator powering the motor
82	 * driver IC but A3 connects the same signal to an ENABLE pin of
83	 * the driver.
84	 */
85	reg_motor_vdd: regulator-motor-vdd {
86		compatible = "regulator-fixed";
87		regulator-name = "motor_vdd";
88		regulator-min-microvolt = <3000000>;
89		regulator-max-microvolt = <3000000>;
90
91		gpio = <&tlmm 76 GPIO_ACTIVE_HIGH>;
92		enable-active-high;
93
94		pinctrl-names = "default";
95		pinctrl-0 = <&motor_en_default>;
96	};
97
98	reg_vdd_tsp_a: regulator-vdd-tsp-a {
99		compatible = "regulator-fixed";
100		regulator-name = "vdd_tsp_a";
101		regulator-min-microvolt = <3300000>;
102		regulator-max-microvolt = <3300000>;
103
104		gpio = <&tlmm 73 GPIO_ACTIVE_HIGH>;
105		enable-active-high;
106
107		pinctrl-names = "default";
108		pinctrl-0 = <&tsp_en_default>;
109	};
110
111	i2c-muic {
112		compatible = "i2c-gpio";
113		sda-gpios = <&tlmm 105 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
114		scl-gpios = <&tlmm 106 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
115
116		pinctrl-names = "default";
117		pinctrl-0 = <&muic_i2c_default>;
118
119		#address-cells = <1>;
120		#size-cells = <0>;
121
122		muic: extcon@25 {
123			compatible = "siliconmitus,sm5502-muic";
124
125			reg = <0x25>;
126			interrupt-parent = <&tlmm>;
127			interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
128
129			pinctrl-names = "default";
130			pinctrl-0 = <&muic_int_default>;
131		};
132	};
133
134	i2c-tkey {
135		compatible = "i2c-gpio";
136		sda-gpios = <&tlmm 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
137		scl-gpios = <&tlmm 17 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
138
139		pinctrl-names = "default";
140		pinctrl-0 = <&tkey_i2c_default>;
141
142		#address-cells = <1>;
143		#size-cells = <0>;
144
145		touchkey: touchkey@20 {
146			/* Note: Actually an ABOV MCU that implements same interface */
147			compatible = "coreriver,tc360-touchkey";
148			reg = <0x20>;
149
150			interrupt-parent = <&tlmm>;
151			interrupts = <98 IRQ_TYPE_EDGE_FALLING>;
152
153			/* vcc/vdd-supply are board-specific */
154			vddio-supply = <&pm8916_l6>;
155
156			linux,keycodes = <KEY_APPSELECT KEY_BACK>;
157
158			pinctrl-names = "default";
159			pinctrl-0 = <&tkey_default>;
160		};
161	};
162
163	i2c-nfc {
164		compatible = "i2c-gpio";
165		sda-gpios = <&tlmm 0 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
166		scl-gpios = <&tlmm 1 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
167
168		pinctrl-names = "default";
169		pinctrl-0 = <&nfc_i2c_default>;
170
171		#address-cells = <1>;
172		#size-cells = <0>;
173
174		nfc@27 {
175			compatible = "samsung,s3fwrn5-i2c";
176			reg = <0x27>;
177
178			interrupt-parent = <&tlmm>;
179			interrupts = <21 IRQ_TYPE_EDGE_RISING>;
180
181			en-gpios = <&tlmm 20 GPIO_ACTIVE_LOW>;
182			wake-gpios = <&tlmm 49 GPIO_ACTIVE_HIGH>;
183
184			clocks = <&rpmcc RPM_SMD_BB_CLK2_PIN>;
185
186			pinctrl-names = "default";
187			pinctrl-0 = <&nfc_default &nfc_clk_req>;
188		};
189	};
190
191	vibrator: vibrator {
192		compatible = "pwm-vibrator";
193
194		pwms = <&clk_pwm 0 100000>;
195		pwm-names = "enable";
196
197		vcc-supply = <&reg_motor_vdd>;
198		status = "disabled";
199	};
200};
201
202&blsp_i2c1 {
203	status = "okay";
204
205	speaker_codec: audio-codec@34 {
206		compatible = "nxp,tfa9895";
207		reg = <0x34>;
208		vddd-supply = <&pm8916_l5>;
209		sound-name-prefix = "Speaker";
210		#sound-dai-cells = <0>;
211	};
212};
213
214&blsp_i2c2 {
215	status = "okay";
216
217	accelerometer: accelerometer@10 {
218		compatible = "bosch,bmc150_accel";
219		reg = <0x10>;
220		interrupt-parent = <&tlmm>;
221		interrupts = <115 IRQ_TYPE_EDGE_RISING>;
222
223		vdd-supply = <&pm8916_l17>;
224		vddio-supply = <&pm8916_l5>;
225
226		pinctrl-names = "default";
227		pinctrl-0 = <&accel_int_default>;
228	};
229
230	magnetometer@12 {
231		compatible = "bosch,bmc150_magn";
232		reg = <0x12>;
233
234		vdd-supply = <&pm8916_l17>;
235		vddio-supply = <&pm8916_l5>;
236	};
237};
238
239&blsp_i2c4 {
240	status = "okay";
241
242	battery@35 {
243		compatible = "richtek,rt5033-battery";
244		reg = <0x35>;
245		interrupt-parent = <&tlmm>;
246		interrupts = <121 IRQ_TYPE_EDGE_BOTH>;
247
248		pinctrl-names = "default";
249		pinctrl-0 = <&fg_alert_default>;
250	};
251};
252
253&blsp_uart2 {
254	status = "okay";
255};
256
257&gpu {
258	status = "okay";
259};
260
261/*
262 * For some reason the speaker amplifier is connected to the second SD line
263 * (MI2S_2_D1) instead of the first (MI2S_2_D0). This must be configured in the
264 * device tree, otherwise audio will seemingly play fine on the wrong SD line
265 * but the speaker stays silent.
266 *
267 * When routing audio via QDSP6 (the default) the &lpass node is reserved and
268 * the definitions from &q6afedai are used. When the modem is disabled audio can
269 * be alternatively routed directly to the LPASS hardware with reduced latency.
270 * The definitions for &lpass are here for completeness to simplify changing the
271 * setup with minor changes to the DT (either manually or with DT overlays).
272 */
273&lpass {
274	dai-link@3 {
275		reg = <MI2S_QUATERNARY>;
276		qcom,playback-sd-lines = <1>;
277	};
278};
279
280&mdss {
281	status = "okay";
282};
283
284&mdss_dsi0 {
285	pinctrl-names = "default", "sleep";
286	pinctrl-0 = <&mdss_default>;
287	pinctrl-1 = <&mdss_sleep>;
288};
289
290&mpss_mem {
291	reg = <0x0 0x86800000 0x0 0x5400000>;
292};
293
294&pm8916_resin {
295	status = "okay";
296	linux,code = <KEY_VOLUMEDOWN>;
297};
298
299&pm8916_rpm_regulators {
300	pm8916_l17: l17 {
301		regulator-min-microvolt = <2850000>;
302		regulator-max-microvolt = <2850000>;
303	};
304};
305
306&q6afedai {
307	dai@22 {
308		reg = <QUATERNARY_MI2S_RX>;
309		qcom,sd-lines = <1>;
310	};
311};
312
313&sdhc_1 {
314	status = "okay";
315};
316
317&sdhc_2 {
318	status = "okay";
319
320	pinctrl-names = "default", "sleep";
321	pinctrl-0 = <&sdc2_default &sdc2_cd_default>;
322	pinctrl-1 = <&sdc2_sleep &sdc2_cd_default>;
323
324	cd-gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
325};
326
327&sound {
328	model = "samsung-a2015";
329	audio-routing =
330		"AMIC1", "MIC BIAS External1",
331		"AMIC2", "MIC BIAS Internal2",
332		"AMIC3", "MIC BIAS External1";
333
334	pinctrl-0 = <&cdc_pdm_default &sec_mi2s_default>;
335	pinctrl-1 = <&cdc_pdm_sleep &sec_mi2s_sleep>;
336	pinctrl-names = "default", "sleep";
337
338	sound_link_backend2: backend2-dai-link {
339		link-name = "Quaternary MI2S";
340
341		cpu {
342			sound-dai = <&q6afedai QUATERNARY_MI2S_RX>;
343		};
344		platform {
345			sound-dai = <&q6routing>;
346		};
347		codec {
348			sound-dai = <&speaker_codec>;
349		};
350	};
351};
352
353&usb {
354	status = "okay";
355	extcon = <&muic>, <&muic>;
356};
357
358&usb_hs_phy {
359	extcon = <&muic>;
360};
361
362&venus {
363	status = "okay";
364};
365
366&venus_mem {
367	status = "okay";
368};
369
370&tlmm {
371	accel_int_default: accel-int-default-state {
372		pins = "gpio115";
373		function = "gpio";
374
375		drive-strength = <2>;
376		bias-disable;
377	};
378
379	fg_alert_default: fg-alert-default-state {
380		pins = "gpio121";
381		function = "gpio";
382
383		drive-strength = <2>;
384		bias-disable;
385	};
386
387	gpio_keys_default: gpio-keys-default-state {
388		pins = "gpio107", "gpio109";
389		function = "gpio";
390
391		drive-strength = <2>;
392		bias-pull-up;
393	};
394
395	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
396		pins = "gpio52";
397		function = "gpio";
398
399		drive-strength = <2>;
400		bias-disable;
401	};
402
403	mdss_default: mdss-default-state {
404		pins = "gpio25";
405		function = "gpio";
406
407		drive-strength = <8>;
408		bias-disable;
409	};
410	mdss_sleep: mdss-sleep-state {
411		pins = "gpio25";
412		function = "gpio";
413
414		drive-strength = <2>;
415		bias-pull-down;
416	};
417
418	motor_en_default: motor-en-default-state {
419		pins = "gpio76";
420		function = "gpio";
421
422		drive-strength = <2>;
423		bias-disable;
424	};
425
426	motor_pwm_default: motor-pwm-default-state {
427		pins = "gpio50";
428		function = "gcc_gp2_clk_a";
429	};
430
431	muic_i2c_default: muic-i2c-default-state {
432		pins = "gpio105", "gpio106";
433		function = "gpio";
434
435		drive-strength = <2>;
436		bias-disable;
437	};
438
439	muic_int_default: muic-int-default-state {
440		pins = "gpio12";
441		function = "gpio";
442
443		drive-strength = <2>;
444		bias-disable;
445	};
446
447	nfc_default: nfc-default-state {
448		nfc-pins {
449			pins = "gpio20", "gpio49";
450			function = "gpio";
451
452			drive-strength = <2>;
453			bias-disable;
454		};
455
456		irq-pins {
457			pins = "gpio21";
458			function = "gpio";
459
460			drive-strength = <2>;
461			bias-pull-down;
462		};
463	};
464
465	nfc_i2c_default: nfc-i2c-default-state {
466		pins = "gpio0", "gpio1";
467		function = "gpio";
468
469		drive-strength = <2>;
470		bias-disable;
471	};
472
473	sdc2_cd_default: sdc2-cd-default-state {
474		pins = "gpio38";
475		function = "gpio";
476		drive-strength = <2>;
477		bias-disable;
478	};
479
480	tkey_default: tkey-default-state {
481		pins = "gpio98";
482		function = "gpio";
483
484		drive-strength = <2>;
485		bias-disable;
486	};
487
488	tkey_i2c_default: tkey-i2c-default-state {
489		pins = "gpio16", "gpio17";
490		function = "gpio";
491
492		drive-strength = <2>;
493		bias-disable;
494	};
495
496	tsp_en_default: tsp-en-default-state {
497		pins = "gpio73";
498		function = "gpio";
499
500		drive-strength = <2>;
501		bias-disable;
502	};
503
504	ts_int_default: ts-int-default-state {
505		pins = "gpio13";
506		function = "gpio";
507
508		drive-strength = <2>;
509		bias-disable;
510	};
511};
512
513&pm8916_gpios {
514	nfc_clk_req: nfc-clk-req-state {
515		pins = "gpio2";
516		function = "func1";
517
518		input-enable;
519		bias-disable;
520		power-source = <PM8916_GPIO_L2>;
521	};
522};
523