1// SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2// Copyright (C) 2019 Icenowy Zheng <icenowy@aosc.xyz> 3// Copyright (C) 2020 Martijn Braam <martijn@brixit.nl> 4// Copyright (C) 2020 Ondrej Jirman <megous@megous.com> 5 6#include "sun50i-a64.dtsi" 7#include "sun50i-a64-cpu-opp.dtsi" 8 9#include <dt-bindings/gpio/gpio.h> 10#include <dt-bindings/input/input.h> 11#include <dt-bindings/leds/common.h> 12#include <dt-bindings/pwm/pwm.h> 13 14/ { 15 chassis-type = "handset"; 16 17 aliases { 18 ethernet0 = &rtl8723cs; 19 serial0 = &uart0; 20 }; 21 22 backlight: backlight { 23 compatible = "pwm-backlight"; 24 pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>; 25 enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */ 26 power-supply = <®_ps>; 27 /* Backlight configuration differs per PinePhone revision. */ 28 }; 29 30 bt_sco_codec: bt-sco-codec { 31 #sound-dai-cells = <1>; 32 compatible = "linux,bt-sco"; 33 }; 34 35 chosen { 36 stdout-path = "serial0:115200n8"; 37 }; 38 39 leds { 40 compatible = "gpio-leds"; 41 42 led0: led-0 { 43 function = LED_FUNCTION_INDICATOR; 44 color = <LED_COLOR_ID_BLUE>; 45 gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */ 46 retain-state-suspended; 47 }; 48 49 led1: led-1 { 50 function = LED_FUNCTION_INDICATOR; 51 color = <LED_COLOR_ID_GREEN>; 52 gpios = <&pio 3 18 GPIO_ACTIVE_HIGH>; /* PD18 */ 53 retain-state-suspended; 54 }; 55 56 led2: led-2 { 57 function = LED_FUNCTION_INDICATOR; 58 color = <LED_COLOR_ID_RED>; 59 gpios = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */ 60 retain-state-suspended; 61 }; 62 }; 63 64 multi-led { 65 compatible = "leds-group-multicolor"; 66 color = <LED_COLOR_ID_RGB>; 67 function = LED_FUNCTION_INDICATOR; 68 leds = <&led0>, <&led1>, <&led2>; 69 }; 70 71 reg_ps: ps-regulator { 72 compatible = "regulator-fixed"; 73 regulator-name = "ps"; 74 regulator-min-microvolt = <5000000>; 75 regulator-max-microvolt = <5000000>; 76 regulator-boot-on; 77 }; 78 79 reg_vbat_wifi: vbat-wifi { 80 compatible = "regulator-fixed"; 81 regulator-min-microvolt = <3300000>; 82 regulator-max-microvolt = <3300000>; 83 regulator-name = "vbat-wifi"; 84 }; 85 86 sgm3140: led-controller { 87 compatible = "sgmicro,sgm3140"; 88 vin-supply = <®_dcdc1>; 89 90 sgm3140_flash: led { 91 function = LED_FUNCTION_FLASH; 92 color = <LED_COLOR_ID_WHITE>; 93 flash-max-timeout-us = <250000>; 94 }; 95 }; 96 97 speaker_amp: audio-amplifier { 98 compatible = "simple-audio-amplifier"; 99 enable-gpios = <&pio 2 7 GPIO_ACTIVE_HIGH>; /* PC7 */ 100 sound-name-prefix = "Speaker Amp"; 101 }; 102 103 vibrator { 104 compatible = "gpio-vibrator"; 105 enable-gpios = <&pio 3 2 GPIO_ACTIVE_HIGH>; /* PD2 */ 106 vcc-supply = <®_dcdc1>; 107 }; 108}; 109 110&codec { 111 pinctrl-names = "default"; 112 pinctrl-0 = <&aif3_pins>; 113 status = "okay"; 114}; 115 116&codec_analog { 117 cpvdd-supply = <®_eldo1>; 118 status = "okay"; 119}; 120 121&cpu0 { 122 cpu-supply = <®_dcdc2>; 123}; 124 125&cpu1 { 126 cpu-supply = <®_dcdc2>; 127}; 128 129&cpu2 { 130 cpu-supply = <®_dcdc2>; 131}; 132 133&cpu3 { 134 cpu-supply = <®_dcdc2>; 135}; 136 137&dai { 138 status = "okay"; 139}; 140 141&de { 142 status = "okay"; 143}; 144 145&dphy { 146 status = "okay"; 147}; 148 149&dsi { 150 vcc-dsi-supply = <®_dldo1>; 151 status = "okay"; 152 153 panel@0 { 154 compatible = "xingbangda,xbd599"; 155 reg = <0>; 156 reset-gpios = <&pio 3 23 GPIO_ACTIVE_LOW>; /* PD23 */ 157 iovcc-supply = <®_dldo2>; 158 vcc-supply = <®_ldo_io0>; 159 backlight = <&backlight>; 160 }; 161}; 162 163&ehci0 { 164 status = "okay"; 165}; 166 167&ehci1 { 168 status = "okay"; 169}; 170 171&i2c0 { 172 status = "okay"; 173 174 touchscreen@5d { 175 compatible = "goodix,gt917s"; 176 reg = <0x5d>; 177 interrupt-parent = <&pio>; 178 interrupts = <7 4 IRQ_TYPE_LEVEL_HIGH>; /* PH4 */ 179 irq-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */ 180 reset-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */ 181 AVDD28-supply = <®_ldo_io0>; 182 VDDIO-supply = <®_ldo_io0>; 183 touchscreen-size-x = <720>; 184 touchscreen-size-y = <1440>; 185 }; 186}; 187 188&i2c1 { 189 status = "okay"; 190 191 /* Alternative magnetometer */ 192 af8133j: magnetometer@1c { 193 compatible = "voltafield,af8133j"; 194 reg = <0x1c>; 195 reset-gpios = <&pio 1 1 GPIO_ACTIVE_LOW>; 196 avdd-supply = <®_dldo1>; 197 dvdd-supply = <®_dldo1>; 198 mount-matrix = "0", "-1", "0", 199 "-1", "0", "0", 200 "0", "0", "-1"; 201 202 /* status will be fixed up in firmware */ 203 status = "disabled"; 204 }; 205 206 /* Magnetometer */ 207 lis3mdl: magnetometer@1e { 208 compatible = "st,lis3mdl-magn"; 209 reg = <0x1e>; 210 vdd-supply = <®_dldo1>; 211 vddio-supply = <®_dldo1>; 212 mount-matrix = "0", "1", "0", 213 "-1", "0", "0", 214 "0", "0", "1"; 215 }; 216 217 /* Light/proximity sensor */ 218 light-sensor@48 { 219 compatible = "sensortek,stk3311"; 220 reg = <0x48>; 221 interrupt-parent = <&pio>; 222 interrupts = <1 0 IRQ_TYPE_EDGE_FALLING>; /* PB0 */ 223 }; 224 225 /* Accelerometer/gyroscope */ 226 accelerometer@68 { 227 compatible = "invensense,mpu6050"; 228 reg = <0x68>; 229 interrupt-parent = <&pio>; 230 interrupts = <7 5 IRQ_TYPE_EDGE_RISING>; /* PH5 */ 231 vdd-supply = <®_dldo1>; 232 vddio-supply = <®_dldo1>; 233 mount-matrix = "0", "1", "0", 234 "-1", "0", "0", 235 "0", "0", "1"; 236 }; 237}; 238 239/* Connected to pogo pins (external spring based pinheader for user addons) */ 240&i2c2 { 241 status = "okay"; 242}; 243 244&lradc { 245 vref-supply = <®_aldo3>; 246 wakeup-source; 247 status = "okay"; 248 249 button-200 { 250 label = "Volume Up"; 251 linux,code = <KEY_VOLUMEUP>; 252 channel = <0>; 253 voltage = <200000>; 254 }; 255 256 button-400 { 257 label = "Volume Down"; 258 linux,code = <KEY_VOLUMEDOWN>; 259 channel = <0>; 260 voltage = <400000>; 261 }; 262}; 263 264&mmc0 { 265 pinctrl-names = "default"; 266 pinctrl-0 = <&mmc0_pins>; 267 vmmc-supply = <®_dcdc1>; 268 vqmmc-supply = <®_dcdc1>; 269 cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ 270 disable-wp; 271 bus-width = <4>; 272 status = "okay"; 273}; 274 275&mmc1 { 276 pinctrl-names = "default"; 277 pinctrl-0 = <&mmc1_pins>; 278 vmmc-supply = <®_vbat_wifi>; 279 vqmmc-supply = <®_dldo4>; 280 bus-width = <4>; 281 non-removable; 282 status = "okay"; 283 284 rtl8723cs: wifi@1 { 285 reg = <1>; 286 }; 287}; 288 289&mmc2 { 290 pinctrl-names = "default"; 291 pinctrl-0 = <&mmc2_pins>; 292 vmmc-supply = <®_dcdc1>; 293 vqmmc-supply = <®_dcdc1>; 294 bus-width = <8>; 295 non-removable; 296 cap-mmc-hw-reset; 297 status = "okay"; 298}; 299 300&ohci0 { 301 status = "okay"; 302}; 303 304&ohci1 { 305 status = "okay"; 306}; 307 308&pio { 309 vcc-pb-supply = <®_dcdc1>; 310 vcc-pc-supply = <®_dcdc1>; 311 vcc-pd-supply = <®_dcdc1>; 312 vcc-pe-supply = <®_aldo1>; 313 vcc-pf-supply = <®_dcdc1>; 314 vcc-pg-supply = <®_dldo4>; 315 vcc-ph-supply = <®_dcdc1>; 316}; 317 318&r_pio { 319 /* 320 * FIXME: We can't add that supply for now since it would 321 * create a circular dependency between pinctrl, the regulator 322 * and the RSB Bus. 323 * 324 * vcc-pl-supply = <®_aldo2>; 325 */ 326}; 327 328&r_pwm { 329 status = "okay"; 330}; 331 332&r_rsb { 333 status = "okay"; 334 335 axp803: pmic@3a3 { 336 compatible = "x-powers,axp803"; 337 reg = <0x3a3>; 338 interrupt-parent = <&r_intc>; 339 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>; 340 }; 341}; 342 343#include "axp803.dtsi" 344 345&battery_power_supply { 346 status = "okay"; 347}; 348 349®_aldo1 { 350 regulator-min-microvolt = <1800000>; 351 regulator-max-microvolt = <1800000>; 352 regulator-name = "dovdd-csi"; 353}; 354 355®_aldo2 { 356 regulator-always-on; 357 regulator-min-microvolt = <1800000>; 358 regulator-max-microvolt = <1800000>; 359 regulator-name = "vcc-pl"; 360}; 361 362®_aldo3 { 363 regulator-always-on; 364 regulator-min-microvolt = <3000000>; 365 regulator-max-microvolt = <3000000>; 366 regulator-name = "vcc-pll-avcc"; 367}; 368 369®_dcdc1 { 370 regulator-always-on; 371 regulator-min-microvolt = <3300000>; 372 regulator-max-microvolt = <3300000>; 373 regulator-name = "vcc-3v3"; 374}; 375 376®_dcdc2 { 377 regulator-always-on; 378 regulator-min-microvolt = <1000000>; 379 regulator-max-microvolt = <1300000>; 380 regulator-name = "vdd-cpux"; 381}; 382 383/* DCDC3 is polyphased with DCDC2 */ 384 385®_dcdc5 { 386 regulator-always-on; 387 regulator-min-microvolt = <1200000>; 388 regulator-max-microvolt = <1200000>; 389 regulator-name = "vcc-dram"; 390}; 391 392®_dcdc6 { 393 regulator-always-on; 394 regulator-min-microvolt = <1100000>; 395 regulator-max-microvolt = <1100000>; 396 regulator-name = "vdd-sys"; 397}; 398 399®_dldo1 { 400 regulator-min-microvolt = <3300000>; 401 regulator-max-microvolt = <3300000>; 402 regulator-name = "vcc-dsi-sensor"; 403}; 404 405®_dldo2 { 406 regulator-min-microvolt = <1800000>; 407 regulator-max-microvolt = <1800000>; 408 regulator-name = "vcc-mipi-io"; 409}; 410 411®_dldo3 { 412 regulator-min-microvolt = <2800000>; 413 regulator-max-microvolt = <2800000>; 414 regulator-name = "avdd-csi"; 415}; 416 417®_dldo4 { 418 regulator-min-microvolt = <1800000>; 419 regulator-max-microvolt = <1800000>; 420 regulator-name = "vcc-wifi-io"; 421}; 422 423®_eldo1 { 424 regulator-always-on; 425 regulator-min-microvolt = <1800000>; 426 regulator-max-microvolt = <1800000>; 427 regulator-name = "vcc-lpddr"; 428}; 429 430®_eldo3 { 431 regulator-min-microvolt = <1800000>; 432 regulator-max-microvolt = <1800000>; 433 regulator-name = "dvdd-1v8-csi"; 434}; 435 436®_fldo1 { 437 regulator-min-microvolt = <1200000>; 438 regulator-max-microvolt = <1200000>; 439 regulator-name = "vcc-1v2-hsic"; 440}; 441 442®_fldo2 { 443 regulator-always-on; 444 regulator-min-microvolt = <1100000>; 445 regulator-max-microvolt = <1100000>; 446 regulator-name = "vdd-cpus"; 447}; 448 449®_ldo_io0 { 450 regulator-min-microvolt = <3300000>; 451 regulator-max-microvolt = <3300000>; 452 regulator-name = "vcc-lcd-ctp-stk"; 453 status = "okay"; 454}; 455 456®_ldo_io1 { 457 regulator-min-microvolt = <1800000>; 458 regulator-max-microvolt = <1800000>; 459 regulator-name = "vcc-1v8-typec"; 460 status = "okay"; 461}; 462 463®_rtc_ldo { 464 regulator-name = "vcc-rtc"; 465}; 466 467&sound { 468 status = "okay"; 469 simple-audio-card,name = "PinePhone"; 470 simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>; 471 simple-audio-card,widgets = "Microphone", "Headset Microphone", 472 "Microphone", "Internal Microphone", 473 "Headphone", "Headphone Jack", 474 "Speaker", "Internal Earpiece", 475 "Speaker", "Internal Speaker"; 476 simple-audio-card,routing = 477 "Headphone Jack", "HP", 478 "Internal Earpiece", "EARPIECE", 479 "Internal Speaker", "Speaker Amp OUTL", 480 "Internal Speaker", "Speaker Amp OUTR", 481 "Speaker Amp INL", "LINEOUT", 482 "Speaker Amp INR", "LINEOUT", 483 "Left DAC", "DACL", 484 "Right DAC", "DACR", 485 "ADCL", "Left ADC", 486 "ADCR", "Right ADC", 487 "Internal Microphone", "MBIAS", 488 "MIC1", "Internal Microphone", 489 "Headset Microphone", "HBIAS", 490 "MIC2", "Headset Microphone"; 491 492 simple-audio-card,dai-link@2 { 493 format = "dsp_a"; 494 frame-master = <&link2_codec>; 495 bitclock-master = <&link2_codec>; 496 bitclock-inversion; 497 498 link2_cpu: cpu { 499 sound-dai = <&bt_sco_codec 0>; 500 }; 501 502 link2_codec: codec { 503 sound-dai = <&codec 2>; 504 dai-tdm-slot-num = <1>; 505 dai-tdm-slot-width = <32>; 506 }; 507 }; 508}; 509 510&uart0 { 511 pinctrl-names = "default"; 512 pinctrl-0 = <&uart0_pb_pins>; 513 status = "okay"; 514}; 515 516&uart1 { 517 pinctrl-names = "default"; 518 pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; 519 status = "okay"; 520 521 bluetooth { 522 compatible = "realtek,rtl8723cs-bt"; 523 device-wake-gpios = <&pio 7 6 GPIO_ACTIVE_LOW>; /* PH6 */ 524 enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */ 525 host-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */ 526 }; 527}; 528 529/* Connected to the modem (hardware flow control can't be used) */ 530&uart3 { 531 pinctrl-names = "default"; 532 pinctrl-0 = <&uart3_pins>; 533 status = "okay"; 534}; 535 536&usb_otg { 537 dr_mode = "peripheral"; 538 status = "okay"; 539}; 540 541&usb_power_supply { 542 status = "okay"; 543}; 544 545&usbphy { 546 status = "okay"; 547}; 548