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