1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, Konrad Dybcio <konrad.dybcio@somainline.org>
4 */
5
6#include "sm8350.dtsi"
7#include "pm8350.dtsi"
8#include "pm8350b.dtsi"
9#include "pm8350c.dtsi"
10#include "pmk8350.dtsi"
11#include "pmr735a.dtsi"
12#include "pmr735b.dtsi"
13
14/ {
15	/*
16	 * Yes, you are correct, there is NO MORE {msm,board,pmic}-id on SM8350!
17	 * Adding it will cause the bootloader to go crazy and randomly crash
18	 * shortly after closing UEFI boot services.. Perhaps that has something
19	 * to do with the OS running inside a VM now..?
20	 */
21
22	chassis-type = "handset";
23
24	chosen {
25		#address-cells = <2>;
26		#size-cells = <2>;
27		ranges;
28
29		framebuffer: framebuffer@e1000000 {
30			compatible = "simple-framebuffer";
31			reg = <0 0xe1000000 0 0x2300000>;
32
33			/* The display, even though it's 4K, initializes at 1080-ish p */
34			width = <1096>;
35			height = <2560>;
36			stride = <(1096 * 4)>;
37			format = "a8r8g8b8";
38			/*
39			 * That's (going to be) a lot of clocks, but it's necessary due
40			 * to unused clk cleanup & no panel driver yet
41			 */
42			clocks = <&gcc GCC_DISP_HF_AXI_CLK>,
43				 <&gcc GCC_DISP_SF_AXI_CLK>;
44		};
45	};
46
47	gpio-keys {
48		compatible = "gpio-keys";
49
50		/* For reasons still unknown, GAssist key and Camera Focus/Shutter don't work.. */
51
52		key-vol-down {
53			label = "Volume Down";
54			linux,code = <KEY_VOLUMEDOWN>;
55			gpios = <&pmk8350_gpios 3 GPIO_ACTIVE_LOW>;
56			debounce-interval = <15>;
57			linux,can-disable;
58			gpio-key,wakeup;
59		};
60	};
61
62	reserved-memory {
63		cont_splash_mem: memory@e1000000 {
64			reg = <0 0xe1000000 0 0x2300000>;
65			no-map;
66		};
67
68		ramoops@ffc00000 {
69			compatible = "ramoops";
70			reg = <0 0xffc00000 0 0x100000>;
71			console-size = <0x40000>;
72			record-size = <0x1000>;
73			no-map;
74		};
75	};
76};
77
78&adsp {
79	status = "okay";
80	firmware-name = "qcom/adsp.mbn";
81};
82
83&cdsp {
84	status = "okay";
85	firmware-name = "qcom/cdsp.mbn";
86};
87
88&i2c1 {
89	status = "okay";
90	clock-frequency = <1000000>;
91
92	/* Some subset of SONY IMX663 camera sensor @ 38 */
93};
94
95&i2c2 {
96	status = "okay";
97	clock-frequency = <400000>;
98
99	/* Richwave RTC6226 FM Radio Receiver @ 64 */
100};
101
102&i2c4 {
103	status = "okay";
104	clock-frequency = <400000>;
105
106	/* Samsung Touchscreen (needs I2C GPI DMA) @ 48 */
107};
108
109&i2c11 {
110	status = "okay";
111	clock-frequency = <1000000>;
112
113	cs35l41_l: cs35l41@40 {
114		compatible = "cirrus,cs35l41";
115		reg = <0x40>;
116		interrupt-parent = <&tlmm>;
117		interrupts = <36 IRQ_TYPE_LEVEL_LOW>;
118		reset-gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>;
119		cirrus,boost-peak-milliamp = <4000>;
120		cirrus,boost-ind-nanohenry = <1000>;
121		cirrus,boost-cap-microfarad = <15>;
122		cirrus,asp-sdout-hiz = <3>;
123		cirrus,gpio2-src-select = <2>;
124		cirrus,gpio2-output-enable;
125		#sound-dai-cells = <1>;
126	};
127
128	cs35l41_r: cs35l41@41 {
129		compatible = "cirrus,cs35l41";
130		reg = <0x41>;
131		interrupt-parent = <&tlmm>;
132		interrupts = <36 IRQ_TYPE_LEVEL_LOW>;
133		reset-gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>;
134		cirrus,boost-peak-milliamp = <4000>;
135		cirrus,boost-ind-nanohenry = <1000>;
136		cirrus,boost-cap-microfarad = <15>;
137		cirrus,asp-sdout-hiz = <3>;
138		cirrus,gpio2-src-select = <2>;
139		cirrus,gpio2-output-enable;
140		#sound-dai-cells = <1>;
141	};
142};
143
144&i2c12 {
145	status = "okay";
146	/* Clock frequency was not specified downstream, let's park it to 100 KHz */
147	clock-frequency = <100000>;
148
149	/* AMS TCS3490 RGB+IR color sensor @ 72 */
150};
151
152&i2c13 {
153	status = "okay";
154	/* Clock frequency was not specified downstream, let's park it to 100 KHz */
155	clock-frequency = <100000>;
156
157	/* Qualcomm PM8008i/PM8008j (?) @ 8, 9, c, d */
158	/* Dialog SLG51000 CMIC @ 75 */
159};
160
161&i2c15 {
162	status = "okay";
163	clock-frequency = <400000>;
164
165	/* NXP SN1X0 NFC @ 28 */
166};
167
168&i2c17 {
169	status = "okay";
170	clock-frequency = <1000000>;
171
172	/* Cirrus Logic CS40L25A boosted haptics driver @ 40 */
173};
174
175&ipa {
176	status = "okay";
177	memory-region = <&pil_ipa_fw_mem>;
178	firmware-name = "qcom/ipa_fws.mbn";
179};
180
181&mpss {
182	status = "okay";
183	firmware-name = "qcom/modem.mbn";
184};
185
186&pmk8350_rtc {
187	status = "okay";
188};
189
190&pon_pwrkey {
191	status = "okay";
192};
193
194&pon_resin {
195	status = "okay";
196	linux,code = <KEY_VOLUMEUP>;
197};
198
199&qupv3_id_0 {
200	status = "okay";
201};
202
203&qupv3_id_1 {
204	status = "okay";
205};
206
207&qupv3_id_2 {
208	status = "okay";
209};
210
211&slpi {
212	status = "okay";
213	firmware-name = "qcom/slpi.mbn";
214};
215
216&spi14 {
217	status = "okay";
218
219	/* NXP SN1X0 NFC Secure Element @ 0 */
220};
221
222&tlmm {
223	gpio-reserved-ranges = <44 4>;
224
225	ts_int_default: ts-int-default-state {
226		pins = "gpio23";
227		function = "gpio";
228		drive-strength = <2>;
229		bias-disable;
230		input-enable;
231	};
232};
233
234/* BIG WARNING! DO NOT TOUCH UFS, YOUR DEVICE WILL DIE! */
235&ufs_mem_hc { status = "disabled"; };
236&ufs_mem_phy { status = "disabled"; };
237
238/* TODO: Make USB3 work (perhaps needs regulators for higher-current operation?) */
239&usb_1 {
240	status = "okay";
241
242	qcom,select-utmi-as-pipe-clk;
243};
244
245&usb_1_dwc3 {
246	dr_mode = "peripheral";
247
248	maximum-speed = "high-speed";
249	phys = <&usb_1_hsphy>;
250	phy-names = "usb2-phy";
251};
252
253&usb_1_hsphy {
254	status = "okay";
255};
256
257&usb_1_qmpphy {
258	status = "okay";
259};
260