1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright (C) 2021 Stephan Gerhold
3
4 /dts-v1/;
5
6 #include "msm8916-pm8916.dtsi"
7 #include <dt-bindings/gpio/gpio.h>
8 #include <dt-bindings/input/input.h>
9 #include <dt-bindings/interrupt-controller/irq.h>
10 #include <dt-bindings/leds/common.h>
11 #include <dt-bindings/sound/apq8016-lpass.h>
12
13 /*
14 * Note: The original firmware from Huawei can only boot 32-bit kernels.
15 * To boot this device tree using arm64 it is necessary to flash 64-bit TZ/HYP
16 * firmware (e.g. taken from the DragonBoard 410c).
17 * See https://wiki.postmarketos.org/wiki/Huawei_Ascend_G7_(huawei-g7)
18 * for suggested installation instructions.
19 */
20
21 / {
22 model = "Huawei Ascend G7";
23 compatible = "huawei,g7", "qcom,msm8916";
24 chassis-type = "handset";
25
26 aliases {
27 serial0 = &blsp1_uart2;
28 };
29
30 chosen {
31 stdout-path = "serial0";
32 };
33
34 gpio-keys {
35 compatible = "gpio-keys";
36
37 pinctrl-names = "default";
38 pinctrl-0 = <&gpio_keys_default>;
39
40 label = "GPIO Buttons";
41
42 button-volume-up {
43 label = "Volume Up";
44 gpios = <&msmgpio 107 GPIO_ACTIVE_LOW>;
45 linux,code = <KEY_VOLUMEUP>;
46 };
47 };
48
49 leds {
50 compatible = "gpio-leds";
51
52 pinctrl-names = "default";
53 pinctrl-0 = <&gpio_leds_default>;
54
55 led-0 {
56 gpios = <&msmgpio 8 GPIO_ACTIVE_HIGH>;
57 color = <LED_COLOR_ID_RED>;
58 default-state = "off";
59 function = LED_FUNCTION_INDICATOR;
60 };
61
62 led-1 {
63 gpios = <&msmgpio 9 GPIO_ACTIVE_HIGH>;
64 color = <LED_COLOR_ID_GREEN>;
65 default-state = "off";
66 function = LED_FUNCTION_INDICATOR;
67 };
68
69 led-2 {
70 gpios = <&msmgpio 10 GPIO_ACTIVE_HIGH>;
71 color = <LED_COLOR_ID_BLUE>;
72 default-state = "off";
73 function = LED_FUNCTION_INDICATOR;
74 };
75 };
76
77 usb_id: usb-id {
78 compatible = "linux,extcon-usb-gpio";
79 id-gpio = <&msmgpio 117 GPIO_ACTIVE_HIGH>;
80 pinctrl-names = "default";
81 pinctrl-0 = <&usb_id_default>;
82 };
83 };
84
85 &blsp_i2c2 {
86 status = "okay";
87
88 magnetometer@c {
89 compatible = "asahi-kasei,ak09911";
90 reg = <0x0c>;
91
92 vdd-supply = <&pm8916_l17>;
93 vid-supply = <&pm8916_l6>;
94
95 reset-gpios = <&msmgpio 36 GPIO_ACTIVE_LOW>;
96
97 pinctrl-names = "default";
98 pinctrl-0 = <&mag_reset_default>;
99 };
100
101 accelerometer@1e {
102 compatible = "kionix,kx023-1025";
103 reg = <0x1e>;
104
105 interrupt-parent = <&msmgpio>;
106 interrupts = <115 IRQ_TYPE_EDGE_RISING>;
107
108 vdd-supply = <&pm8916_l17>;
109 vddio-supply = <&pm8916_l6>;
110
111 pinctrl-names = "default";
112 pinctrl-0 = <&accel_irq_default>;
113
114 mount-matrix = "-1", "0", "0",
115 "0", "1", "0",
116 "0", "0", "1";
117 };
118
119 proximity@39 {
120 compatible = "avago,apds9930";
121 reg = <0x39>;
122
123 interrupt-parent = <&msmgpio>;
124 interrupts = <113 IRQ_TYPE_EDGE_FALLING>;
125
126 vdd-supply = <&pm8916_l17>;
127 vddio-supply = <&pm8916_l6>;
128
129 led-max-microamp = <100000>;
130 amstaos,proximity-diodes = <1>;
131
132 pinctrl-names = "default";
133 pinctrl-0 = <&prox_irq_default>;
134 };
135
136 regulator@3e {
137 compatible = "ti,tps65132";
138 reg = <0x3e>;
139
140 pinctrl-names = "default";
141 pinctrl-0 = <®_lcd_en_default>;
142
143 reg_lcd_pos: outp {
144 regulator-name = "outp";
145 regulator-min-microvolt = <5400000>;
146 regulator-max-microvolt = <5400000>;
147 enable-gpios = <&msmgpio 97 GPIO_ACTIVE_HIGH>;
148 regulator-active-discharge = <1>;
149 };
150
151 reg_lcd_neg: outn {
152 regulator-name = "outn";
153 regulator-min-microvolt = <5400000>;
154 regulator-max-microvolt = <5400000>;
155 enable-gpios = <&msmgpio 32 GPIO_ACTIVE_HIGH>;
156 regulator-active-discharge = <1>;
157 };
158 };
159 };
160
161 &blsp_i2c5 {
162 status = "okay";
163
164 rmi4@70 {
165 compatible = "syna,rmi4-i2c";
166 reg = <0x70>;
167 #address-cells = <1>;
168 #size-cells = <0>;
169
170 interrupt-parent = <&msmgpio>;
171 interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
172
173 vdd-supply = <&pm8916_l17>;
174 vio-supply = <&pm8916_l16>;
175
176 pinctrl-names = "default";
177 pinctrl-0 = <&ts_irq_default>;
178
179 syna,startup-delay-ms = <100>;
180
181 rmi4-f01@1 {
182 reg = <0x1>;
183 syna,nosleep-mode = <1>; /* Allow sleeping */
184 };
185
186 rmi4-f11@11 {
187 reg = <0x11>;
188 syna,sensor-type = <1>; /* Touchscreen */
189 };
190 };
191 };
192
193 &blsp_i2c6 {
194 status = "okay";
195
196 nfc@28 {
197 compatible = "nxp,pn547", "nxp,nxp-nci-i2c";
198 reg = <0x28>;
199
200 interrupt-parent = <&msmgpio>;
201 interrupts = <21 IRQ_TYPE_EDGE_RISING>;
202
203 enable-gpios = <&msmgpio 20 GPIO_ACTIVE_HIGH>;
204 firmware-gpios = <&msmgpio 2 GPIO_ACTIVE_HIGH>;
205
206 pinctrl-names = "default";
207 pinctrl-0 = <&nfc_default>;
208 };
209 };
210
211 &blsp1_uart2 {
212 status = "okay";
213 };
214
215 &lpass {
216 status = "okay";
217 };
218
219 &pm8916_resin {
220 status = "okay";
221 linux,code = <KEY_VOLUMEDOWN>;
222 };
223
224 &pm8916_vib {
225 status = "okay";
226 };
227
228 &pronto {
229 status = "okay";
230 };
231
232 &sdhc_1 {
233 status = "okay";
234
235 pinctrl-names = "default", "sleep";
236 pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
237 pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
238 };
239
240 &sdhc_2 {
241 status = "okay";
242
243 pinctrl-names = "default", "sleep";
244 pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on &sdhc2_cd_default>;
245 pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdhc2_cd_default>;
246
247 /*
248 * The Huawei device tree sets cd-gpios = <&msmgpio 38 GPIO_ACTIVE_HIGH>.
249 * However, gpio38 does not change its state when inserting/removing the
250 * SD card, it's just low all the time. The Huawei kernel seems to use
251 * polling for SD card detection instead.
252 *
253 * However, looking closer at the GPIO debug output it turns out that
254 * gpio56 switches its state when inserting/removing the SD card.
255 * It behaves just like gpio38 normally does. Usually GPIO56 is used as
256 * "UIM2_PRESENT", i.e. to check if a second SIM card is inserted.
257 * Maybe Huawei decided to replace the second SIM card slot with the
258 * SD card slot and forgot to re-route to gpio38.
259 */
260 cd-gpios = <&msmgpio 56 GPIO_ACTIVE_LOW>;
261 };
262
263 &sound {
264 status = "okay";
265
266 model = "msm8916";
267 audio-routing =
268 "AMIC1", "MIC BIAS External1",
269 "AMIC2", "MIC BIAS External2",
270 "AMIC3", "MIC BIAS External1";
271
272 pinctrl-names = "default", "sleep";
273 pinctrl-0 = <&cdc_pdm_lines_act>;
274 pinctrl-1 = <&cdc_pdm_lines_sus>;
275
276 primary-dai-link {
277 link-name = "WCD";
278 cpu {
279 sound-dai = <&lpass MI2S_PRIMARY>;
280 };
281 codec {
282 sound-dai = <&lpass_codec 0>, <&wcd_codec 0>;
283 };
284 };
285
286 tertiary-dai-link {
287 link-name = "WCD-Capture";
288 cpu {
289 sound-dai = <&lpass MI2S_TERTIARY>;
290 };
291 codec {
292 sound-dai = <&lpass_codec 1>, <&wcd_codec 1>;
293 };
294 };
295 };
296
297 &usb {
298 status = "okay";
299 extcon = <&usb_id>, <&usb_id>;
300 };
301
302 &usb_hs_phy {
303 extcon = <&usb_id>;
304 };
305
306 &wcd_codec {
307 qcom,micbias-lvl = <2800>;
308 qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
309 qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
310 qcom,hphl-jack-type-normally-open;
311 };
312
313 &smd_rpm_regulators {
314 vdd_l1_l2_l3-supply = <&pm8916_s3>;
315 vdd_l4_l5_l6-supply = <&pm8916_s4>;
316 vdd_l7-supply = <&pm8916_s4>;
317
318 s3 {
319 regulator-min-microvolt = <1200000>;
320 regulator-max-microvolt = <1300000>;
321 };
322
323 s4 {
324 regulator-min-microvolt = <1800000>;
325 regulator-max-microvolt = <2100000>;
326 };
327
328 l1 {
329 regulator-min-microvolt = <1225000>;
330 regulator-max-microvolt = <1225000>;
331 };
332
333 l2 {
334 regulator-min-microvolt = <1200000>;
335 regulator-max-microvolt = <1200000>;
336 };
337
338 l4 {
339 regulator-min-microvolt = <2050000>;
340 regulator-max-microvolt = <2050000>;
341 };
342
343 l5 {
344 regulator-min-microvolt = <1800000>;
345 regulator-max-microvolt = <1800000>;
346 };
347
348 l6 {
349 regulator-min-microvolt = <1800000>;
350 regulator-max-microvolt = <1800000>;
351 };
352
353 l7 {
354 regulator-min-microvolt = <1800000>;
355 regulator-max-microvolt = <1800000>;
356 };
357
358 l8 {
359 regulator-min-microvolt = <2950000>;
360 regulator-max-microvolt = <2950000>;
361 };
362
363 l9 {
364 regulator-min-microvolt = <3300000>;
365 regulator-max-microvolt = <3300000>;
366 };
367
368 l10 {
369 regulator-min-microvolt = <2700000>;
370 regulator-max-microvolt = <2800000>;
371 };
372
373 l11 {
374 regulator-min-microvolt = <1800000>;
375 regulator-max-microvolt = <2950000>;
376 regulator-allow-set-load;
377 regulator-system-load = <200000>;
378 };
379
380 l12 {
381 regulator-min-microvolt = <1800000>;
382 regulator-max-microvolt = <2950000>;
383 };
384
385 l13 {
386 regulator-min-microvolt = <3075000>;
387 regulator-max-microvolt = <3075000>;
388 };
389
390 l14 {
391 regulator-min-microvolt = <1800000>;
392 regulator-max-microvolt = <3300000>;
393 };
394
395 l15 {
396 regulator-min-microvolt = <1800000>;
397 regulator-max-microvolt = <3300000>;
398 };
399
400 l16 {
401 regulator-min-microvolt = <1800000>;
402 regulator-max-microvolt = <1800000>;
403 };
404
405 l17 {
406 regulator-min-microvolt = <2850000>;
407 regulator-max-microvolt = <2850000>;
408 };
409
410 l18 {
411 regulator-min-microvolt = <2700000>;
412 regulator-max-microvolt = <2700000>;
413 };
414 };
415
416 &msmgpio {
417 accel_irq_default: accel-irq-default {
418 pins = "gpio115";
419 function = "gpio";
420
421 drive-strength = <2>;
422 bias-disable;
423 };
424
425 gpio_keys_default: gpio-keys-default {
426 pins = "gpio107";
427 function = "gpio";
428
429 drive-strength = <2>;
430 bias-pull-up;
431 };
432
433 gpio_leds_default: gpio-leds-default {
434 pins = "gpio8", "gpio9", "gpio10";
435 function = "gpio";
436
437 drive-strength = <2>;
438 bias-disable;
439 };
440
441 nfc_default: nfc-default {
442 pins = "gpio2", "gpio20", "gpio21";
443 function = "gpio";
444
445 drive-strength = <2>;
446 bias-disable;
447 };
448
449 mag_reset_default: mag-reset-default {
450 pins = "gpio36";
451 function = "gpio";
452
453 drive-strength = <2>;
454 bias-disable;
455 };
456
457 prox_irq_default: prox-irq-default {
458 pins = "gpio113";
459 function = "gpio";
460
461 drive-strength = <2>;
462 bias-disable;
463 };
464
465 reg_lcd_en_default: reg-lcd-en-default {
466 pins = "gpio32", "gpio97";
467 function = "gpio";
468
469 drive-strength = <2>;
470 bias-disable;
471 };
472
473 sdhc2_cd_default: sdhc2-cd-default {
474 pins = "gpio56";
475 function = "gpio";
476
477 drive-strength = <2>;
478 bias-disable;
479 };
480
481 ts_irq_default: ts-irq-default {
482 pins = "gpio13";
483 function = "gpio";
484
485 drive-strength = <2>;
486 bias-disable;
487 };
488
489 usb_id_default: usb-id-default {
490 pins = "gpio117";
491 function = "gpio";
492
493 drive-strength = <8>;
494 bias-pull-up;
495 };
496 };
Cache object: 8860b6b5fade06812f2ef0db7e951c19
|