1// SPDX-License-Identifier: GPL-2.0-only
2
3/dts-v1/;
4
5#include "msm8916-pm8916.dtsi"
6#include "msm8916-modem-qdsp6.dtsi"
7
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/interrupt-controller/irq.h>
11#include <dt-bindings/sound/apq8016-lpass.h>
12
13/ {
14	aliases {
15		mmc0 = &sdhc_1; /* eMMC */
16		mmc1 = &sdhc_2; /* SD card */
17		serial0 = &blsp_uart2;
18	};
19
20	chosen {
21		stdout-path = "serial0";
22	};
23
24	reserved-memory {
25		/* Additional memory used by Samsung firmware modifications */
26		tz-apps@85500000 {
27			reg = <0x0 0x85500000 0x0 0xb00000>;
28			no-map;
29		};
30	};
31
32	gpio-keys {
33		compatible = "gpio-keys";
34
35		pinctrl-0 = <&gpio_keys_default>;
36		pinctrl-names = "default";
37
38		label = "GPIO Buttons";
39
40		volume-up-button {
41			label = "Volume Up";
42			gpios = <&tlmm 107 GPIO_ACTIVE_LOW>;
43			linux,code = <KEY_VOLUMEUP>;
44		};
45
46		home-button {
47			label = "Home";
48			gpios = <&tlmm 109 GPIO_ACTIVE_LOW>;
49			linux,code = <KEY_HOMEPAGE>;
50		};
51	};
52
53	gpio-hall-sensor {
54		compatible = "gpio-keys";
55
56		pinctrl-0 = <&gpio_hall_sensor_default>;
57		pinctrl-names = "default";
58
59		label = "GPIO Hall Effect Sensor";
60
61		hall-sensor-switch {
62			label = "Hall Effect Sensor";
63			gpios = <&tlmm 52 GPIO_ACTIVE_LOW>;
64			linux,input-type = <EV_SW>;
65			linux,code = <SW_LID>;
66			linux,can-disable;
67		};
68	};
69};
70
71&blsp_i2c2 {
72	status = "okay";
73
74	light-sensor@10 {
75		compatible = "capella,cm3323";
76		reg = <0x10>;
77	};
78
79	accelerometer@1d {
80		compatible = "st,lis2hh12";
81		reg = <0x1d>;
82
83		vdd-supply = <&pm8916_l17>;
84		vddio-supply = <&pm8916_l5>;
85
86		interrupt-parent = <&tlmm>;
87		interrupts = <115 IRQ_TYPE_LEVEL_HIGH>;
88
89		st,drdy-int-pin = <1>;
90		mount-matrix = "0", "1", "0",
91			      "-1", "0", "0",
92			       "0", "0", "1";
93
94		pinctrl-0 = <&accel_int_default>;
95		pinctrl-names = "default";
96	};
97};
98
99&blsp_i2c4 {
100	status = "okay";
101
102	fuelgauge@36 {
103		compatible = "maxim,max77849-battery";
104		reg = <0x36>;
105
106		maxim,rsns-microohm = <10000>;
107		maxim,over-heat-temp = <600>;
108		maxim,over-volt = <4400>;
109
110		interrupt-parent = <&tlmm>;
111		interrupts = <121 IRQ_TYPE_EDGE_FALLING>;
112
113		pinctrl-0 = <&fuelgauge_int_default>;
114		pinctrl-names = "default";
115	};
116};
117
118&blsp_uart2 {
119	status = "okay";
120};
121
122/*
123 * For some reason the speaker amplifier is connected to the second SD line
124 * (MI2S_2_D1) instead of the first (MI2S_2_D0). This must be configured in the
125 * device tree, otherwise audio will seemingly play fine on the wrong SD line
126 * but the speaker stays silent.
127 *
128 * When routing audio via QDSP6 (the default) the &lpass node is reserved and
129 * the definitions from &q6afedai are used. When the modem is disabled audio can
130 * be alternatively routed directly to the LPASS hardware with reduced latency.
131 * The definitions for &lpass are here for completeness to simplify changing the
132 * setup with minor changes to the DT (either manually or with DT overlays).
133 */
134&lpass {
135	dai-link@3 {
136		reg = <MI2S_QUATERNARY>;
137		qcom,playback-sd-lines = <1>;
138	};
139};
140
141&mpss_mem {
142	reg = <0x0 0x86800000 0x0 0x5400000>;
143};
144
145&pm8916_resin {
146	linux,code = <KEY_VOLUMEDOWN>;
147	status = "okay";
148};
149
150&pm8916_rpm_regulators {
151	pm8916_l17: l17 {
152		regulator-min-microvolt = <2850000>;
153		regulator-max-microvolt = <2850000>;
154	};
155};
156
157/* FIXME: Replace with MAX77849 MUIC when driver is available */
158&pm8916_usbin {
159	status = "okay";
160};
161
162&q6afedai {
163	dai@22 {
164		reg = <QUATERNARY_MI2S_RX>;
165		qcom,sd-lines = <1>;
166	};
167};
168
169&sdhc_1 {
170	status = "okay";
171};
172
173&sdhc_2 {
174	pinctrl-0 = <&sdc2_default &sdc2_cd_default>;
175	pinctrl-1 = <&sdc2_sleep &sdc2_cd_default>;
176	pinctrl-names = "default", "sleep";
177
178	cd-gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
179
180	status = "okay";
181};
182
183&sound {
184	audio-routing =
185		"AMIC1", "MIC BIAS External1",
186		"AMIC2", "MIC BIAS Internal2",
187		"AMIC3", "MIC BIAS External1";
188
189	sound_link_backend2: backend2-dai-link {
190		link-name = "Quaternary MI2S";
191
192		cpu {
193			sound-dai = <&q6afedai QUATERNARY_MI2S_RX>;
194		};
195		platform {
196			sound-dai = <&q6routing>;
197		};
198		codec {
199			sound-dai = <&speaker_codec>;
200		};
201	};
202};
203
204&usb {
205	dr_mode = "peripheral";
206	extcon = <&pm8916_usbin>;
207
208	status = "okay";
209};
210
211&usb_hs_phy {
212	extcon = <&pm8916_usbin>;
213};
214
215&venus {
216	status = "okay";
217};
218
219&venus_mem {
220	status = "okay";
221};
222
223&wcnss {
224	status = "okay";
225};
226
227&wcnss_iris {
228	compatible = "qcom,wcn3660b";
229};
230
231&wcnss_mem {
232	status = "okay";
233};
234
235&tlmm {
236	accel_int_default: accel-int-default-state {
237		pins = "gpio115";
238		function = "gpio";
239		drive-strength = <2>;
240		bias-disable;
241	};
242
243	fuelgauge_int_default: fuelgauge-int-default-state {
244		pins = "gpio121";
245		function = "gpio";
246		drive-strength = <2>;
247		bias-disable;
248	};
249
250	gpio_keys_default: gpio-keys-default-state {
251		pins = "gpio107", "gpio109";
252		function = "gpio";
253		drive-strength = <2>;
254		bias-pull-up;
255	};
256
257	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
258		pins = "gpio52";
259		function = "gpio";
260		drive-strength = <2>;
261		bias-disable;
262	};
263
264	sdc2_cd_default: sdc2-cd-default-state {
265		pins = "gpio38";
266		function = "gpio";
267		drive-strength = <2>;
268		bias-disable;
269	};
270};
271