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