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