1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright (C) 2021 Stephan Gerhold
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>
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.
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.
22 * See: https://wiki.postmarketos.org/wiki/Huawei_Ascend_G7_(huawei-g7)
26 model = "Huawei Ascend G7";
27 compatible = "huawei,g7", "qcom,msm8916";
30 serial0 = &blsp1_uart2;
34 stdout-path = "serial0";
38 compatible = "gpio-keys";
40 pinctrl-names = "default";
41 pinctrl-0 = <&gpio_keys_default>;
43 label = "GPIO Buttons";
47 gpios = <&msmgpio 107 GPIO_ACTIVE_LOW>;
48 linux,code = <KEY_VOLUMEUP>;
53 compatible = "gpio-leds";
55 pinctrl-names = "default";
56 pinctrl-0 = <&gpio_leds_default>;
59 gpios = <&msmgpio 8 GPIO_ACTIVE_HIGH>;
60 color = <LED_COLOR_ID_RED>;
61 default-state = "off";
62 function = LED_FUNCTION_INDICATOR;
66 gpios = <&msmgpio 9 GPIO_ACTIVE_HIGH>;
67 color = <LED_COLOR_ID_GREEN>;
68 default-state = "off";
69 function = LED_FUNCTION_INDICATOR;
73 gpios = <&msmgpio 10 GPIO_ACTIVE_HIGH>;
74 color = <LED_COLOR_ID_BLUE>;
75 default-state = "off";
76 function = LED_FUNCTION_INDICATOR;
81 compatible = "linux,extcon-usb-gpio";
82 id-gpio = <&msmgpio 117 GPIO_ACTIVE_HIGH>;
83 pinctrl-names = "default";
84 pinctrl-0 = <&usb_id_default>;
92 compatible = "asahi-kasei,ak09911";
95 vdd-supply = <&pm8916_l17>;
96 vid-supply = <&pm8916_l6>;
98 reset-gpios = <&msmgpio 36 GPIO_ACTIVE_LOW>;
100 pinctrl-names = "default";
101 pinctrl-0 = <&mag_reset_default>;
105 compatible = "kionix,kx023-1025";
108 interrupt-parent = <&msmgpio>;
109 interrupts = <115 IRQ_TYPE_EDGE_RISING>;
111 vdd-supply = <&pm8916_l17>;
112 vddio-supply = <&pm8916_l6>;
114 pinctrl-names = "default";
115 pinctrl-0 = <&accel_irq_default>;
117 mount-matrix = "-1", "0", "0",
123 compatible = "avago,apds9930";
126 interrupt-parent = <&msmgpio>;
127 interrupts = <113 IRQ_TYPE_EDGE_FALLING>;
129 vdd-supply = <&pm8916_l17>;
130 vddio-supply = <&pm8916_l6>;
132 led-max-microamp = <100000>;
133 amstaos,proximity-diodes = <1>;
135 pinctrl-names = "default";
136 pinctrl-0 = <&prox_irq_default>;
140 compatible = "ti,tps65132";
143 pinctrl-names = "default";
144 pinctrl-0 = <®_lcd_en_default>;
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>;
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>;
168 compatible = "syna,rmi4-i2c";
170 #address-cells = <1>;
173 interrupt-parent = <&msmgpio>;
174 interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
176 vdd-supply = <&pm8916_l17>;
177 vio-supply = <&pm8916_l16>;
179 pinctrl-names = "default";
180 pinctrl-0 = <&ts_irq_default>;
182 syna,startup-delay-ms = <100>;
186 syna,nosleep-mode = <1>; /* Allow sleeping */
191 syna,sensor-type = <1>; /* Touchscreen */
200 compatible = "nxp,pn547", "nxp,nxp-nci-i2c";
203 interrupt-parent = <&msmgpio>;
204 interrupts = <21 IRQ_TYPE_EDGE_RISING>;
206 enable-gpios = <&msmgpio 20 GPIO_ACTIVE_HIGH>;
207 firmware-gpios = <&msmgpio 2 GPIO_ACTIVE_HIGH>;
209 pinctrl-names = "default";
210 pinctrl-0 = <&nfc_default>;
220 linux,code = <KEY_VOLUMEDOWN>;
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>;
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>;
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.
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.
259 cd-gpios = <&msmgpio 56 GPIO_ACTIVE_LOW>;
264 extcon = <&usb_id>, <&usb_id>;
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>;
277 regulator-min-microvolt = <1200000>;
278 regulator-max-microvolt = <1300000>;
282 regulator-min-microvolt = <1800000>;
283 regulator-max-microvolt = <2100000>;
287 regulator-min-microvolt = <1225000>;
288 regulator-max-microvolt = <1225000>;
292 regulator-min-microvolt = <1200000>;
293 regulator-max-microvolt = <1200000>;
297 regulator-min-microvolt = <2050000>;
298 regulator-max-microvolt = <2050000>;
302 regulator-min-microvolt = <1800000>;
303 regulator-max-microvolt = <1800000>;
307 regulator-min-microvolt = <1800000>;
308 regulator-max-microvolt = <1800000>;
312 regulator-min-microvolt = <1800000>;
313 regulator-max-microvolt = <1800000>;
317 regulator-min-microvolt = <2950000>;
318 regulator-max-microvolt = <2950000>;
322 regulator-min-microvolt = <3300000>;
323 regulator-max-microvolt = <3300000>;
327 regulator-min-microvolt = <2700000>;
328 regulator-max-microvolt = <2800000>;
332 regulator-min-microvolt = <1800000>;
333 regulator-max-microvolt = <2950000>;
334 regulator-allow-set-load;
335 regulator-system-load = <200000>;
339 regulator-min-microvolt = <1800000>;
340 regulator-max-microvolt = <2950000>;
344 regulator-min-microvolt = <3075000>;
345 regulator-max-microvolt = <3075000>;
349 regulator-min-microvolt = <1800000>;
350 regulator-max-microvolt = <3300000>;
354 regulator-min-microvolt = <1800000>;
355 regulator-max-microvolt = <3300000>;
359 regulator-min-microvolt = <1800000>;
360 regulator-max-microvolt = <1800000>;
364 regulator-min-microvolt = <2850000>;
365 regulator-max-microvolt = <2850000>;
369 regulator-min-microvolt = <2700000>;
370 regulator-max-microvolt = <2700000>;
375 accel_irq_default: accel-irq-default {
379 drive-strength = <2>;
383 gpio_keys_default: gpio-keys-default {
387 drive-strength = <2>;
391 gpio_leds_default: gpio-leds-default {
392 pins = "gpio8", "gpio9", "gpio10";
395 drive-strength = <2>;
399 nfc_default: nfc-default {
400 pins = "gpio2", "gpio20", "gpio21";
403 drive-strength = <2>;
407 mag_reset_default: mag-reset-default {
411 drive-strength = <2>;
415 prox_irq_default: prox-irq-default {
419 drive-strength = <2>;
423 reg_lcd_en_default: reg-lcd-en-default {
424 pins = "gpio32", "gpio97";
427 drive-strength = <2>;
431 sdhc2_cd_default: sdhc2-cd-default {
435 drive-strength = <2>;
439 ts_irq_default: ts-irq-default {
443 drive-strength = <2>;
447 usb_id_default: usb-id-default {
451 drive-strength = <8>;