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