0001 // SPDX-License-Identifier: GPL-2.0-only
0002 // Copyright (C) 2021 Stephan Gerhold
0003
0004 /dts-v1/;
0005
0006 #include "msm8916-pm8916.dtsi"
0007 #include <dt-bindings/gpio/gpio.h>
0008 #include <dt-bindings/input/input.h>
0009 #include <dt-bindings/interrupt-controller/irq.h>
0010 #include <dt-bindings/leds/common.h>
0011 #include <dt-bindings/sound/apq8016-lpass.h>
0012
0013 /*
0014 * Note: The original firmware from Huawei can only boot 32-bit kernels.
0015 * To boot this device tree using arm64 it is necessary to flash 64-bit TZ/HYP
0016 * firmware (e.g. taken from the DragonBoard 410c).
0017 * See https://wiki.postmarketos.org/wiki/Huawei_Ascend_G7_(huawei-g7)
0018 * for suggested installation instructions.
0019 */
0020
0021 / {
0022 model = "Huawei Ascend G7";
0023 compatible = "huawei,g7", "qcom,msm8916";
0024 chassis-type = "handset";
0025
0026 aliases {
0027 serial0 = &blsp1_uart2;
0028 };
0029
0030 chosen {
0031 stdout-path = "serial0";
0032 };
0033
0034 gpio-keys {
0035 compatible = "gpio-keys";
0036
0037 pinctrl-names = "default";
0038 pinctrl-0 = <&gpio_keys_default>;
0039
0040 label = "GPIO Buttons";
0041
0042 button-volume-up {
0043 label = "Volume Up";
0044 gpios = <&msmgpio 107 GPIO_ACTIVE_LOW>;
0045 linux,code = <KEY_VOLUMEUP>;
0046 };
0047 };
0048
0049 leds {
0050 compatible = "gpio-leds";
0051
0052 pinctrl-names = "default";
0053 pinctrl-0 = <&gpio_leds_default>;
0054
0055 led-0 {
0056 gpios = <&msmgpio 8 GPIO_ACTIVE_HIGH>;
0057 color = <LED_COLOR_ID_RED>;
0058 default-state = "off";
0059 function = LED_FUNCTION_INDICATOR;
0060 };
0061
0062 led-1 {
0063 gpios = <&msmgpio 9 GPIO_ACTIVE_HIGH>;
0064 color = <LED_COLOR_ID_GREEN>;
0065 default-state = "off";
0066 function = LED_FUNCTION_INDICATOR;
0067 };
0068
0069 led-2 {
0070 gpios = <&msmgpio 10 GPIO_ACTIVE_HIGH>;
0071 color = <LED_COLOR_ID_BLUE>;
0072 default-state = "off";
0073 function = LED_FUNCTION_INDICATOR;
0074 };
0075 };
0076
0077 usb_id: usb-id {
0078 compatible = "linux,extcon-usb-gpio";
0079 id-gpio = <&msmgpio 117 GPIO_ACTIVE_HIGH>;
0080 pinctrl-names = "default";
0081 pinctrl-0 = <&usb_id_default>;
0082 };
0083 };
0084
0085 &blsp_i2c2 {
0086 status = "okay";
0087
0088 magnetometer@c {
0089 compatible = "asahi-kasei,ak09911";
0090 reg = <0x0c>;
0091
0092 vdd-supply = <&pm8916_l17>;
0093 vid-supply = <&pm8916_l6>;
0094
0095 reset-gpios = <&msmgpio 36 GPIO_ACTIVE_LOW>;
0096
0097 pinctrl-names = "default";
0098 pinctrl-0 = <&mag_reset_default>;
0099 };
0100
0101 accelerometer@1e {
0102 compatible = "kionix,kx023-1025";
0103 reg = <0x1e>;
0104
0105 interrupt-parent = <&msmgpio>;
0106 interrupts = <115 IRQ_TYPE_EDGE_RISING>;
0107
0108 vdd-supply = <&pm8916_l17>;
0109 vddio-supply = <&pm8916_l6>;
0110
0111 pinctrl-names = "default";
0112 pinctrl-0 = <&accel_irq_default>;
0113
0114 mount-matrix = "-1", "0", "0",
0115 "0", "1", "0",
0116 "0", "0", "1";
0117 };
0118
0119 proximity@39 {
0120 compatible = "avago,apds9930";
0121 reg = <0x39>;
0122
0123 interrupt-parent = <&msmgpio>;
0124 interrupts = <113 IRQ_TYPE_EDGE_FALLING>;
0125
0126 vdd-supply = <&pm8916_l17>;
0127 vddio-supply = <&pm8916_l6>;
0128
0129 led-max-microamp = <100000>;
0130 amstaos,proximity-diodes = <1>;
0131
0132 pinctrl-names = "default";
0133 pinctrl-0 = <&prox_irq_default>;
0134 };
0135
0136 regulator@3e {
0137 compatible = "ti,tps65132";
0138 reg = <0x3e>;
0139
0140 pinctrl-names = "default";
0141 pinctrl-0 = <®_lcd_en_default>;
0142
0143 reg_lcd_pos: outp {
0144 regulator-name = "outp";
0145 regulator-min-microvolt = <5400000>;
0146 regulator-max-microvolt = <5400000>;
0147 enable-gpios = <&msmgpio 97 GPIO_ACTIVE_HIGH>;
0148 regulator-active-discharge = <1>;
0149 };
0150
0151 reg_lcd_neg: outn {
0152 regulator-name = "outn";
0153 regulator-min-microvolt = <5400000>;
0154 regulator-max-microvolt = <5400000>;
0155 enable-gpios = <&msmgpio 32 GPIO_ACTIVE_HIGH>;
0156 regulator-active-discharge = <1>;
0157 };
0158 };
0159 };
0160
0161 &blsp_i2c5 {
0162 status = "okay";
0163
0164 rmi4@70 {
0165 compatible = "syna,rmi4-i2c";
0166 reg = <0x70>;
0167 #address-cells = <1>;
0168 #size-cells = <0>;
0169
0170 interrupt-parent = <&msmgpio>;
0171 interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
0172
0173 vdd-supply = <&pm8916_l17>;
0174 vio-supply = <&pm8916_l16>;
0175
0176 pinctrl-names = "default";
0177 pinctrl-0 = <&ts_irq_default>;
0178
0179 syna,startup-delay-ms = <100>;
0180
0181 rmi4-f01@1 {
0182 reg = <0x1>;
0183 syna,nosleep-mode = <1>; /* Allow sleeping */
0184 };
0185
0186 rmi4-f11@11 {
0187 reg = <0x11>;
0188 syna,sensor-type = <1>; /* Touchscreen */
0189 };
0190 };
0191 };
0192
0193 &blsp_i2c6 {
0194 status = "okay";
0195
0196 nfc@28 {
0197 compatible = "nxp,pn547", "nxp,nxp-nci-i2c";
0198 reg = <0x28>;
0199
0200 interrupt-parent = <&msmgpio>;
0201 interrupts = <21 IRQ_TYPE_EDGE_RISING>;
0202
0203 enable-gpios = <&msmgpio 20 GPIO_ACTIVE_HIGH>;
0204 firmware-gpios = <&msmgpio 2 GPIO_ACTIVE_HIGH>;
0205
0206 pinctrl-names = "default";
0207 pinctrl-0 = <&nfc_default>;
0208 };
0209 };
0210
0211 &blsp1_uart2 {
0212 status = "okay";
0213 };
0214
0215 &lpass {
0216 status = "okay";
0217 };
0218
0219 &pm8916_resin {
0220 status = "okay";
0221 linux,code = <KEY_VOLUMEDOWN>;
0222 };
0223
0224 &pm8916_vib {
0225 status = "okay";
0226 };
0227
0228 &pronto {
0229 status = "okay";
0230 };
0231
0232 &sdhc_1 {
0233 status = "okay";
0234
0235 pinctrl-names = "default", "sleep";
0236 pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
0237 pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
0238 };
0239
0240 &sdhc_2 {
0241 status = "okay";
0242
0243 pinctrl-names = "default", "sleep";
0244 pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on &sdhc2_cd_default>;
0245 pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdhc2_cd_default>;
0246
0247 /*
0248 * The Huawei device tree sets cd-gpios = <&msmgpio 38 GPIO_ACTIVE_HIGH>.
0249 * However, gpio38 does not change its state when inserting/removing the
0250 * SD card, it's just low all the time. The Huawei kernel seems to use
0251 * polling for SD card detection instead.
0252 *
0253 * However, looking closer at the GPIO debug output it turns out that
0254 * gpio56 switches its state when inserting/removing the SD card.
0255 * It behaves just like gpio38 normally does. Usually GPIO56 is used as
0256 * "UIM2_PRESENT", i.e. to check if a second SIM card is inserted.
0257 * Maybe Huawei decided to replace the second SIM card slot with the
0258 * SD card slot and forgot to re-route to gpio38.
0259 */
0260 cd-gpios = <&msmgpio 56 GPIO_ACTIVE_LOW>;
0261 };
0262
0263 &sound {
0264 status = "okay";
0265
0266 model = "msm8916";
0267 audio-routing =
0268 "AMIC1", "MIC BIAS External1",
0269 "AMIC2", "MIC BIAS External2",
0270 "AMIC3", "MIC BIAS External1";
0271
0272 pinctrl-names = "default", "sleep";
0273 pinctrl-0 = <&cdc_pdm_lines_act>;
0274 pinctrl-1 = <&cdc_pdm_lines_sus>;
0275
0276 primary-dai-link {
0277 link-name = "WCD";
0278 cpu {
0279 sound-dai = <&lpass MI2S_PRIMARY>;
0280 };
0281 codec {
0282 sound-dai = <&lpass_codec 0>, <&wcd_codec 0>;
0283 };
0284 };
0285
0286 tertiary-dai-link {
0287 link-name = "WCD-Capture";
0288 cpu {
0289 sound-dai = <&lpass MI2S_TERTIARY>;
0290 };
0291 codec {
0292 sound-dai = <&lpass_codec 1>, <&wcd_codec 1>;
0293 };
0294 };
0295 };
0296
0297 &usb {
0298 status = "okay";
0299 extcon = <&usb_id>, <&usb_id>;
0300 };
0301
0302 &usb_hs_phy {
0303 extcon = <&usb_id>;
0304 };
0305
0306 &wcd_codec {
0307 qcom,micbias-lvl = <2800>;
0308 qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
0309 qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
0310 qcom,hphl-jack-type-normally-open;
0311 };
0312
0313 &smd_rpm_regulators {
0314 vdd_l1_l2_l3-supply = <&pm8916_s3>;
0315 vdd_l4_l5_l6-supply = <&pm8916_s4>;
0316 vdd_l7-supply = <&pm8916_s4>;
0317
0318 s3 {
0319 regulator-min-microvolt = <1200000>;
0320 regulator-max-microvolt = <1300000>;
0321 };
0322
0323 s4 {
0324 regulator-min-microvolt = <1800000>;
0325 regulator-max-microvolt = <2100000>;
0326 };
0327
0328 l1 {
0329 regulator-min-microvolt = <1225000>;
0330 regulator-max-microvolt = <1225000>;
0331 };
0332
0333 l2 {
0334 regulator-min-microvolt = <1200000>;
0335 regulator-max-microvolt = <1200000>;
0336 };
0337
0338 l4 {
0339 regulator-min-microvolt = <2050000>;
0340 regulator-max-microvolt = <2050000>;
0341 };
0342
0343 l5 {
0344 regulator-min-microvolt = <1800000>;
0345 regulator-max-microvolt = <1800000>;
0346 };
0347
0348 l6 {
0349 regulator-min-microvolt = <1800000>;
0350 regulator-max-microvolt = <1800000>;
0351 };
0352
0353 l7 {
0354 regulator-min-microvolt = <1800000>;
0355 regulator-max-microvolt = <1800000>;
0356 };
0357
0358 l8 {
0359 regulator-min-microvolt = <2950000>;
0360 regulator-max-microvolt = <2950000>;
0361 };
0362
0363 l9 {
0364 regulator-min-microvolt = <3300000>;
0365 regulator-max-microvolt = <3300000>;
0366 };
0367
0368 l10 {
0369 regulator-min-microvolt = <2700000>;
0370 regulator-max-microvolt = <2800000>;
0371 };
0372
0373 l11 {
0374 regulator-min-microvolt = <1800000>;
0375 regulator-max-microvolt = <2950000>;
0376 regulator-allow-set-load;
0377 regulator-system-load = <200000>;
0378 };
0379
0380 l12 {
0381 regulator-min-microvolt = <1800000>;
0382 regulator-max-microvolt = <2950000>;
0383 };
0384
0385 l13 {
0386 regulator-min-microvolt = <3075000>;
0387 regulator-max-microvolt = <3075000>;
0388 };
0389
0390 l14 {
0391 regulator-min-microvolt = <1800000>;
0392 regulator-max-microvolt = <3300000>;
0393 };
0394
0395 l15 {
0396 regulator-min-microvolt = <1800000>;
0397 regulator-max-microvolt = <3300000>;
0398 };
0399
0400 l16 {
0401 regulator-min-microvolt = <1800000>;
0402 regulator-max-microvolt = <1800000>;
0403 };
0404
0405 l17 {
0406 regulator-min-microvolt = <2850000>;
0407 regulator-max-microvolt = <2850000>;
0408 };
0409
0410 l18 {
0411 regulator-min-microvolt = <2700000>;
0412 regulator-max-microvolt = <2700000>;
0413 };
0414 };
0415
0416 &msmgpio {
0417 accel_irq_default: accel-irq-default {
0418 pins = "gpio115";
0419 function = "gpio";
0420
0421 drive-strength = <2>;
0422 bias-disable;
0423 };
0424
0425 gpio_keys_default: gpio-keys-default {
0426 pins = "gpio107";
0427 function = "gpio";
0428
0429 drive-strength = <2>;
0430 bias-pull-up;
0431 };
0432
0433 gpio_leds_default: gpio-leds-default {
0434 pins = "gpio8", "gpio9", "gpio10";
0435 function = "gpio";
0436
0437 drive-strength = <2>;
0438 bias-disable;
0439 };
0440
0441 nfc_default: nfc-default {
0442 pins = "gpio2", "gpio20", "gpio21";
0443 function = "gpio";
0444
0445 drive-strength = <2>;
0446 bias-disable;
0447 };
0448
0449 mag_reset_default: mag-reset-default {
0450 pins = "gpio36";
0451 function = "gpio";
0452
0453 drive-strength = <2>;
0454 bias-disable;
0455 };
0456
0457 prox_irq_default: prox-irq-default {
0458 pins = "gpio113";
0459 function = "gpio";
0460
0461 drive-strength = <2>;
0462 bias-disable;
0463 };
0464
0465 reg_lcd_en_default: reg-lcd-en-default {
0466 pins = "gpio32", "gpio97";
0467 function = "gpio";
0468
0469 drive-strength = <2>;
0470 bias-disable;
0471 };
0472
0473 sdhc2_cd_default: sdhc2-cd-default {
0474 pins = "gpio56";
0475 function = "gpio";
0476
0477 drive-strength = <2>;
0478 bias-disable;
0479 };
0480
0481 ts_irq_default: ts-irq-default {
0482 pins = "gpio13";
0483 function = "gpio";
0484
0485 drive-strength = <2>;
0486 bias-disable;
0487 };
0488
0489 usb_id_default: usb-id-default {
0490 pins = "gpio117";
0491 function = "gpio";
0492
0493 drive-strength = <8>;
0494 bias-pull-up;
0495 };
0496 };