1// SPDX-License-Identifier: BSD-3-Clause 2/* 3 * Copyright (c) 2021, Luca Weiss <luca@z3ntu.xyz> 4 */ 5 6/dts-v1/; 7 8/* PM7250B is configured to use SID2/3 */ 9#define PM7250B_SID 2 10#define PM7250B_SID1 3 11 12/* PMK8350 (in reality a PMK8003) is configured to use SID6 instead of 0 */ 13#define PMK8350_SID 6 14 15#include <dt-bindings/firmware/qcom,scm.h> 16#include <dt-bindings/gpio/gpio.h> 17#include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> 18#include <dt-bindings/input/input.h> 19#include <dt-bindings/leds/common.h> 20#include <dt-bindings/pinctrl/qcom,pmic-gpio.h> 21#include <dt-bindings/regulator/qcom,rpmh-regulator.h> 22#include "sm7225.dtsi" 23#include "pm6150l.dtsi" 24#include "pm6350.dtsi" 25#include "pm7250b.dtsi" 26#include "pmk8350.dtsi" 27 28/ { 29 model = "Fairphone 4"; 30 compatible = "fairphone,fp4", "qcom,sm7225"; 31 chassis-type = "handset"; 32 33 /* required for bootloader to select correct board */ 34 qcom,msm-id = <434 0x10000>, <459 0x10000>; 35 qcom,board-id = <8 32>; 36 37 aliases { 38 serial0 = &uart9; 39 serial1 = &uart1; 40 }; 41 42 chosen { 43 #address-cells = <2>; 44 #size-cells = <2>; 45 ranges; 46 47 stdout-path = "serial0:115200n8"; 48 49 framebuffer0: framebuffer@a000000 { 50 compatible = "simple-framebuffer"; 51 reg = <0 0xa0000000 0 (2340 * 1080 * 4)>; 52 width = <1080>; 53 height = <2340>; 54 stride = <(1080 * 4)>; 55 format = "a8r8g8b8"; 56 }; 57 }; 58 59 gpio-keys { 60 compatible = "gpio-keys"; 61 pinctrl-names = "default"; 62 pinctrl-0 = <&gpio_keys_pin>; 63 64 key-volume-up { 65 label = "volume_up"; 66 linux,code = <KEY_VOLUMEUP>; 67 gpios = <&pm6350_gpios 2 GPIO_ACTIVE_LOW>; 68 }; 69 }; 70 71 /* Dummy regulator until PM6150L has LCDB VSP/VSN support */ 72 lcdb_dummy: regulator-lcdb-dummy { 73 compatible = "regulator-fixed"; 74 regulator-name = "lcdb_dummy"; 75 regulator-min-microvolt = <5500000>; 76 regulator-max-microvolt = <5500000>; 77 }; 78 79 reserved-memory { 80 /* 81 * The rmtfs memory region in downstream is 'dynamically allocated' 82 * but given the same address every time. Hard code it as this address is 83 * where the modem firmware expects it to be. 84 */ 85 memory@efe01000 { 86 compatible = "qcom,rmtfs-mem"; 87 reg = <0 0xefe01000 0 0x600000>; 88 no-map; 89 90 qcom,client-id = <1>; 91 qcom,vmid = <QCOM_SCM_VMID_MSS_MSA>; 92 }; 93 }; 94 95 thermal-zones { 96 chg-skin-thermal { 97 polling-delay-passive = <0>; 98 polling-delay = <0>; 99 thermal-sensors = <&pm7250b_adc_tm 0>; 100 101 trips { 102 active-config0 { 103 temperature = <125000>; 104 hysteresis = <1000>; 105 type = "passive"; 106 }; 107 }; 108 }; 109 110 conn-thermal { 111 polling-delay-passive = <0>; 112 polling-delay = <0>; 113 thermal-sensors = <&pm7250b_adc_tm 1>; 114 115 trips { 116 active-config0 { 117 temperature = <125000>; 118 hysteresis = <1000>; 119 type = "passive"; 120 }; 121 }; 122 }; 123 }; 124}; 125 126&adsp { 127 firmware-name = "qcom/sm7225/fairphone4/adsp.mbn"; 128 status = "okay"; 129}; 130 131&apps_rsc { 132 regulators-0 { 133 compatible = "qcom,pm6350-rpmh-regulators"; 134 qcom,pmic-id = "a"; 135 136 vreg_s1a: smps1 { 137 regulator-min-microvolt = <1000000>; 138 regulator-max-microvolt = <1200000>; 139 }; 140 141 vreg_s2a: smps2 { 142 regulator-min-microvolt = <1503000>; 143 regulator-max-microvolt = <2048000>; 144 }; 145 146 vreg_l2a: ldo2 { 147 regulator-min-microvolt = <1503000>; 148 regulator-max-microvolt = <1980000>; 149 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 150 }; 151 152 vreg_l3a: ldo3 { 153 regulator-min-microvolt = <2700000>; 154 regulator-max-microvolt = <3300000>; 155 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 156 }; 157 158 vreg_l4a: ldo4 { 159 regulator-min-microvolt = <352000>; 160 regulator-max-microvolt = <801000>; 161 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 162 }; 163 164 vreg_l5a: ldo5 { 165 regulator-min-microvolt = <1503000>; 166 regulator-max-microvolt = <1980000>; 167 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 168 }; 169 170 vreg_l6a: ldo6 { 171 regulator-min-microvolt = <1710000>; 172 regulator-max-microvolt = <3544000>; 173 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 174 }; 175 176 vreg_l7a: ldo7 { 177 regulator-min-microvolt = <1620000>; 178 regulator-max-microvolt = <1980000>; 179 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 180 }; 181 182 vreg_l8a: ldo8 { 183 regulator-min-microvolt = <2800000>; 184 regulator-max-microvolt = <2800000>; 185 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 186 }; 187 188 vreg_l9a: ldo9 { 189 regulator-min-microvolt = <1650000>; 190 regulator-max-microvolt = <3401000>; 191 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 192 }; 193 194 vreg_l11a: ldo11 { 195 regulator-min-microvolt = <1800000>; 196 regulator-max-microvolt = <2000000>; 197 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 198 }; 199 200 vreg_l12a: ldo12 { 201 regulator-min-microvolt = <1620000>; 202 regulator-max-microvolt = <1980000>; 203 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 204 }; 205 206 vreg_l13a: ldo13 { 207 regulator-min-microvolt = <570000>; 208 regulator-max-microvolt = <650000>; 209 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 210 }; 211 212 vreg_l14a: ldo14 { 213 regulator-min-microvolt = <1700000>; 214 regulator-max-microvolt = <1900000>; 215 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 216 }; 217 218 vreg_l15a: ldo15 { 219 regulator-min-microvolt = <1100000>; 220 regulator-max-microvolt = <1305000>; 221 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 222 }; 223 224 vreg_l16a: ldo16 { 225 regulator-min-microvolt = <830000>; 226 regulator-max-microvolt = <921000>; 227 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 228 }; 229 230 vreg_l18a: ldo18 { 231 regulator-min-microvolt = <788000>; 232 regulator-max-microvolt = <1049000>; 233 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 234 }; 235 236 vreg_l19a: ldo19 { 237 regulator-min-microvolt = <1080000>; 238 regulator-max-microvolt = <1305000>; 239 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 240 }; 241 242 vreg_l20a: ldo20 { 243 regulator-min-microvolt = <530000>; 244 regulator-max-microvolt = <801000>; 245 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 246 }; 247 248 vreg_l21a: ldo21 { 249 regulator-min-microvolt = <751000>; 250 regulator-max-microvolt = <825000>; 251 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 252 }; 253 254 vreg_l22a: ldo22 { 255 regulator-min-microvolt = <1080000>; 256 regulator-max-microvolt = <1305000>; 257 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 258 }; 259 }; 260 261 regulators-1 { 262 compatible = "qcom,pm6150l-rpmh-regulators"; 263 qcom,pmic-id = "e"; 264 265 vreg_s8e: smps8 { 266 regulator-min-microvolt = <313000>; 267 regulator-max-microvolt = <1395000>; 268 }; 269 270 vreg_l1e: ldo1 { 271 regulator-min-microvolt = <1620000>; 272 regulator-max-microvolt = <1980000>; 273 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 274 }; 275 276 vreg_l2e: ldo2 { 277 regulator-min-microvolt = <1170000>; 278 regulator-max-microvolt = <1305000>; 279 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 280 }; 281 282 vreg_l3e: ldo3 { 283 regulator-min-microvolt = <1100000>; 284 regulator-max-microvolt = <1299000>; 285 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 286 }; 287 288 vreg_l4e: ldo4 { 289 regulator-min-microvolt = <1620000>; 290 regulator-max-microvolt = <3300000>; 291 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 292 }; 293 294 vreg_l5e: ldo5 { 295 regulator-min-microvolt = <1620000>; 296 regulator-max-microvolt = <3300000>; 297 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 298 }; 299 300 vreg_l6e: ldo6 { 301 regulator-min-microvolt = <1700000>; 302 regulator-max-microvolt = <2950000>; 303 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 304 regulator-allow-set-load; 305 regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM 306 RPMH_REGULATOR_MODE_HPM>; 307 }; 308 309 vreg_l7e: ldo7 { 310 regulator-min-microvolt = <2700000>; 311 regulator-max-microvolt = <3544000>; 312 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 313 }; 314 315 vreg_l8e: ldo8 { 316 regulator-min-microvolt = <1620000>; 317 regulator-max-microvolt = <2000000>; 318 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 319 }; 320 321 vreg_l9e: ldo9 { 322 regulator-min-microvolt = <2700000>; 323 regulator-max-microvolt = <2960000>; 324 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 325 regulator-allow-set-load; 326 regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM 327 RPMH_REGULATOR_MODE_HPM>; 328 }; 329 330 vreg_l10e: ldo10 { 331 regulator-min-microvolt = <3000000>; 332 regulator-max-microvolt = <3401000>; 333 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 334 }; 335 336 vreg_l11e: ldo11 { 337 regulator-min-microvolt = <3000000>; 338 regulator-max-microvolt = <3401000>; 339 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 340 }; 341 342 vreg_bob: bob { 343 regulator-min-microvolt = <1620000>; 344 regulator-max-microvolt = <5492000>; 345 regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>; 346 regulator-allow-bypass; 347 }; 348 }; 349}; 350 351&cci0 { 352 status = "okay"; 353}; 354 355&cci0_i2c0 { 356 /* IMX582 @ 0x1a */ 357}; 358 359&cci0_i2c1 { 360 /* IMX582 @ 0x1a */ 361}; 362 363&cci1 { 364 status = "okay"; 365}; 366 367&cci1_i2c0 { 368 /* IMX576 @ 0x10 */ 369}; 370 371&cdsp { 372 firmware-name = "qcom/sm7225/fairphone4/cdsp.mbn"; 373 status = "okay"; 374}; 375 376&gpi_dma0 { 377 status = "okay"; 378}; 379 380&gpi_dma1 { 381 status = "okay"; 382}; 383 384&gpu { 385 status = "okay"; 386}; 387 388&gpu_zap_shader { 389 firmware-name = "qcom/sm7225/fairphone4/a615_zap.mbn"; 390}; 391 392&i2c0 { 393 clock-frequency = <400000>; 394 status = "okay"; 395 396 /* ST21NFCD NFC @ 8 */ 397 /* VL53L3 ToF @ 29 */ 398 /* AW88264A amplifier @ 34 */ 399 /* AW88264A amplifier @ 35 */ 400}; 401 402&i2c8 { 403 clock-frequency = <400000>; 404 status = "okay"; 405 406 /* HX83112A touchscreen @ 48 */ 407}; 408 409&i2c10 { 410 /* PM8008 PMIC @ 8 and 9 */ 411 /* PX8618 @ 26 */ 412 /* SMB1395 PMIC @ 34 */ 413 /* awinic,aw8695 @ 5a */ 414}; 415 416&ipa { 417 qcom,gsi-loader = "self"; 418 memory-region = <&pil_ipa_fw_mem>; 419 firmware-name = "qcom/sm7225/fairphone4/ipa_fws.mbn"; 420 status = "okay"; 421}; 422 423&mdss { 424 status = "okay"; 425}; 426 427&mdss_dsi0 { 428 vdda-supply = <&vreg_l22a>; 429 status = "okay"; 430 431 panel@0 { 432 compatible = "djn,9a-3r063-1102b"; 433 reg = <0>; 434 435 backlight = <&pm6150l_wled>; 436 reset-gpios = <&pm6150l_gpios 9 GPIO_ACTIVE_LOW>; 437 438 vdd1-supply = <&vreg_l1e>; 439 vsn-supply = <&lcdb_dummy>; 440 vsp-supply = <&lcdb_dummy>; 441 442 port { 443 panel_in: endpoint { 444 remote-endpoint = <&mdss_dsi0_out>; 445 }; 446 }; 447 }; 448}; 449 450&mdss_dsi0_out { 451 data-lanes = <0 1 2 3>; 452 remote-endpoint = <&panel_in>; 453}; 454 455&mdss_dsi0_phy { 456 vdds-supply = <&vreg_l18a>; 457 status = "okay"; 458}; 459 460&mpss { 461 firmware-name = "qcom/sm7225/fairphone4/modem.mbn"; 462 status = "okay"; 463}; 464 465&pm6150l_flash { 466 status = "okay"; 467 468 led-0 { 469 function = LED_FUNCTION_FLASH; 470 color = <LED_COLOR_ID_YELLOW>; 471 led-sources = <1>; 472 led-max-microamp = <180000>; 473 flash-max-microamp = <1000000>; 474 flash-max-timeout-us = <1280000>; 475 }; 476 477 led-1 { 478 function = LED_FUNCTION_FLASH; 479 color = <LED_COLOR_ID_WHITE>; 480 led-sources = <2>; 481 led-max-microamp = <180000>; 482 flash-max-microamp = <1000000>; 483 flash-max-timeout-us = <1280000>; 484 }; 485}; 486 487&pm6150l_wled { 488 qcom,switching-freq = <800>; 489 qcom,current-limit-microamp = <20000>; 490 qcom,num-strings = <2>; 491 492 status = "okay"; 493}; 494 495&pm6350_gpios { 496 gpio_keys_pin: gpio-keys-state { 497 pins = "gpio2"; 498 function = PMIC_GPIO_FUNC_NORMAL; 499 bias-pull-up; 500 input-enable; 501 power-source = <0>; 502 }; 503}; 504 505&pm6350_resin { 506 linux,code = <KEY_VOLUMEDOWN>; 507 status = "okay"; 508}; 509 510&pm7250b_adc { 511 channel@4d { 512 reg = <ADC5_AMUX_THM1_100K_PU>; 513 qcom,ratiometric; 514 qcom,hw-settle-time = <200>; 515 qcom,pre-scaling = <1 1>; 516 label = "charger_skin_therm"; 517 }; 518 519 channel@4f { 520 reg = <ADC5_AMUX_THM3_100K_PU>; 521 qcom,ratiometric; 522 qcom,hw-settle-time = <200>; 523 qcom,pre-scaling = <1 1>; 524 label = "conn_therm"; 525 }; 526}; 527 528&pm7250b_adc_tm { 529 status = "okay"; 530 531 charger-skin-therm@0 { 532 reg = <0>; 533 io-channels = <&pm7250b_adc ADC5_AMUX_THM1_100K_PU>; 534 qcom,ratiometric; 535 qcom,hw-settle-time-us = <200>; 536 }; 537 538 conn-therm@1 { 539 reg = <1>; 540 io-channels = <&pm7250b_adc ADC5_AMUX_THM3_100K_PU>; 541 qcom,ratiometric; 542 qcom,hw-settle-time-us = <200>; 543 }; 544}; 545 546&pmk8350_rtc { 547 status = "okay"; 548}; 549 550&pmk8350_vadc { 551 channel@644 { 552 reg = <PMK8350_ADC7_AMUX_THM1_100K_PU>; 553 qcom,ratiometric; 554 qcom,hw-settle-time = <200>; 555 qcom,pre-scaling = <1 1>; 556 label = "xo_therm"; 557 }; 558}; 559 560&qup_uart1_cts { 561 /* 562 * Configure a bias-bus-hold on CTS to lower power 563 * usage when Bluetooth is turned off. Bus hold will 564 * maintain a low power state regardless of whether 565 * the Bluetooth module drives the pin in either 566 * direction or leaves the pin fully unpowered. 567 */ 568 bias-bus-hold; 569}; 570 571&qup_uart1_rts { 572 /* We'll drive RTS, so no pull */ 573 drive-strength = <2>; 574 bias-disable; 575}; 576 577&qup_uart1_rx { 578 /* 579 * Configure a pull-up on RX. This is needed to avoid 580 * garbage data when the TX pin of the Bluetooth module is 581 * in tri-state (module powered off or not driving the 582 * signal yet). 583 */ 584 bias-pull-up; 585}; 586 587&qup_uart1_tx { 588 /* We'll drive TX, so no pull */ 589 drive-strength = <2>; 590 bias-disable; 591}; 592 593&qupv3_id_0 { 594 status = "okay"; 595}; 596 597&qupv3_id_1 { 598 status = "okay"; 599}; 600 601&sdc2_off_state { 602 sd-cd-pins { 603 pins = "gpio94"; 604 function = "gpio"; 605 drive-strength = <2>; 606 bias-disable; 607 }; 608}; 609 610&sdc2_on_state { 611 sd-cd-pins { 612 pins = "gpio94"; 613 function = "gpio"; 614 drive-strength = <2>; 615 bias-pull-up; 616 }; 617}; 618 619&sdhc_2 { 620 vmmc-supply = <&vreg_l9e>; 621 vqmmc-supply = <&vreg_l6e>; 622 623 cd-gpios = <&tlmm 94 GPIO_ACTIVE_LOW>; 624 625 status = "okay"; 626}; 627 628&tlmm { 629 gpio-reserved-ranges = <13 4>, <56 2>; 630 631 qup_uart1_sleep_cts: qup-uart1-sleep-cts-state { 632 pins = "gpio61"; 633 function = "gpio"; 634 /* 635 * Configure a bias-bus-hold on CTS to lower power 636 * usage when Bluetooth is turned off. Bus hold will 637 * maintain a low power state regardless of whether 638 * the Bluetooth module drives the pin in either 639 * direction or leaves the pin fully unpowered. 640 */ 641 bias-bus-hold; 642 }; 643 644 qup_uart1_sleep_rts: qup-uart1-sleep-rts-state { 645 pins = "gpio62"; 646 function = "gpio"; 647 /* 648 * Configure pull-down on RTS. As RTS is active low 649 * signal, pull it low to indicate the BT SoC that it 650 * can wakeup the system anytime from suspend state by 651 * pulling RX low (by sending wakeup bytes). 652 */ 653 bias-pull-down; 654 }; 655 656 qup_uart1_sleep_rx: qup-uart1-sleep-rx-state { 657 pins = "gpio64"; 658 function = "gpio"; 659 /* 660 * Configure a pull-up on RX. This is needed to avoid 661 * garbage data when the TX pin of the Bluetooth module 662 * is floating which may cause spurious wakeups. 663 */ 664 bias-pull-up; 665 }; 666 667 qup_uart1_sleep_tx: qup-uart1-sleep-tx-state { 668 pins = "gpio63"; 669 function = "gpio"; 670 /* 671 * Configure pull-up on TX when it isn't actively driven 672 * to prevent BT SoC from receiving garbage during sleep. 673 */ 674 bias-pull-up; 675 }; 676}; 677 678&uart1 { 679 /delete-property/ interrupts; 680 interrupts-extended = <&intc GIC_SPI 602 IRQ_TYPE_LEVEL_HIGH>, 681 <&tlmm 64 IRQ_TYPE_EDGE_FALLING>; 682 683 pinctrl-names = "default", "sleep"; 684 pinctrl-1 = <&qup_uart1_sleep_cts>, <&qup_uart1_sleep_rts>, <&qup_uart1_sleep_tx>, <&qup_uart1_sleep_rx>; 685 686 status = "okay"; 687 688 bluetooth { 689 compatible = "qcom,wcn3988-bt"; 690 691 vddio-supply = <&vreg_l11a>; 692 vddxo-supply = <&vreg_l7a>; 693 vddrf-supply = <&vreg_l2e>; 694 vddch0-supply = <&vreg_l10e>; 695 swctrl-gpios = <&tlmm 69 GPIO_ACTIVE_HIGH>; 696 697 max-speed = <3200000>; 698 }; 699}; 700 701&uart9 { 702 status = "okay"; 703}; 704 705&ufs_mem_hc { 706 reset-gpios = <&tlmm 156 GPIO_ACTIVE_LOW>; 707 708 vcc-supply = <&vreg_l7e>; 709 vcc-max-microamp = <800000>; 710 vccq2-supply = <&vreg_l12a>; 711 vccq2-max-microamp = <800000>; 712 713 status = "okay"; 714}; 715 716&ufs_mem_phy { 717 vdda-phy-supply = <&vreg_l18a>; 718 vdda-pll-supply = <&vreg_l22a>; 719 720 status = "okay"; 721}; 722 723&usb_1 { 724 status = "okay"; 725}; 726 727&usb_1_dwc3 { 728 maximum-speed = "super-speed"; 729 dr_mode = "peripheral"; 730}; 731 732&usb_1_hsphy { 733 vdd-supply = <&vreg_l18a>; 734 vdda-pll-supply = <&vreg_l2a>; 735 vdda-phy-dpdm-supply = <&vreg_l3a>; 736 737 status = "okay"; 738}; 739 740&usb_1_qmpphy { 741 vdda-phy-supply = <&vreg_l22a>; 742 vdda-pll-supply = <&vreg_l16a>; 743 744 status = "okay"; 745}; 746 747&wifi { 748 vdd-0.8-cx-mx-supply = <&vreg_l4a>; 749 vdd-1.8-xo-supply = <&vreg_l7a>; 750 vdd-1.3-rfa-supply = <&vreg_l2e>; 751 vdd-3.3-ch0-supply = <&vreg_l10e>; 752 vdd-3.3-ch1-supply = <&vreg_l11e>; 753 754 status = "okay"; 755}; 756