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 /* Magnetometer */ 192 lis3mdl: magnetometer@1e { 193 compatible = "st,lis3mdl-magn"; 194 reg = <0x1e>; 195 vdd-supply = <®_dldo1>; 196 vddio-supply = <®_dldo1>; 197 }; 198 199 /* Light/proximity sensor */ 200 light-sensor@48 { 201 compatible = "sensortek,stk3311"; 202 reg = <0x48>; 203 interrupt-parent = <&pio>; 204 interrupts = <1 0 IRQ_TYPE_EDGE_FALLING>; /* PB0 */ 205 }; 206 207 /* Accelerometer/gyroscope */ 208 accelerometer@68 { 209 compatible = "invensense,mpu6050"; 210 reg = <0x68>; 211 interrupt-parent = <&pio>; 212 interrupts = <7 5 IRQ_TYPE_EDGE_RISING>; /* PH5 */ 213 vdd-supply = <®_dldo1>; 214 vddio-supply = <®_dldo1>; 215 mount-matrix = "0", "1", "0", 216 "-1", "0", "0", 217 "0", "0", "1"; 218 }; 219}; 220 221/* Connected to pogo pins (external spring based pinheader for user addons) */ 222&i2c2 { 223 status = "okay"; 224}; 225 226&lradc { 227 vref-supply = <®_aldo3>; 228 wakeup-source; 229 status = "okay"; 230 231 button-200 { 232 label = "Volume Up"; 233 linux,code = <KEY_VOLUMEUP>; 234 channel = <0>; 235 voltage = <200000>; 236 }; 237 238 button-400 { 239 label = "Volume Down"; 240 linux,code = <KEY_VOLUMEDOWN>; 241 channel = <0>; 242 voltage = <400000>; 243 }; 244}; 245 246&mmc0 { 247 pinctrl-names = "default"; 248 pinctrl-0 = <&mmc0_pins>; 249 vmmc-supply = <®_dcdc1>; 250 vqmmc-supply = <®_dcdc1>; 251 cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ 252 disable-wp; 253 bus-width = <4>; 254 status = "okay"; 255}; 256 257&mmc1 { 258 pinctrl-names = "default"; 259 pinctrl-0 = <&mmc1_pins>; 260 vmmc-supply = <®_vbat_wifi>; 261 vqmmc-supply = <®_dldo4>; 262 bus-width = <4>; 263 non-removable; 264 status = "okay"; 265 266 rtl8723cs: wifi@1 { 267 reg = <1>; 268 }; 269}; 270 271&mmc2 { 272 pinctrl-names = "default"; 273 pinctrl-0 = <&mmc2_pins>; 274 vmmc-supply = <®_dcdc1>; 275 vqmmc-supply = <®_dcdc1>; 276 bus-width = <8>; 277 non-removable; 278 cap-mmc-hw-reset; 279 status = "okay"; 280}; 281 282&ohci0 { 283 status = "okay"; 284}; 285 286&ohci1 { 287 status = "okay"; 288}; 289 290&pio { 291 vcc-pb-supply = <®_dcdc1>; 292 vcc-pc-supply = <®_dcdc1>; 293 vcc-pd-supply = <®_dcdc1>; 294 vcc-pe-supply = <®_aldo1>; 295 vcc-pf-supply = <®_dcdc1>; 296 vcc-pg-supply = <®_dldo4>; 297 vcc-ph-supply = <®_dcdc1>; 298}; 299 300&r_pio { 301 /* 302 * FIXME: We can't add that supply for now since it would 303 * create a circular dependency between pinctrl, the regulator 304 * and the RSB Bus. 305 * 306 * vcc-pl-supply = <®_aldo2>; 307 */ 308}; 309 310&r_pwm { 311 status = "okay"; 312}; 313 314&r_rsb { 315 status = "okay"; 316 317 axp803: pmic@3a3 { 318 compatible = "x-powers,axp803"; 319 reg = <0x3a3>; 320 interrupt-parent = <&r_intc>; 321 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>; 322 }; 323}; 324 325#include "axp803.dtsi" 326 327&battery_power_supply { 328 status = "okay"; 329}; 330 331®_aldo1 { 332 regulator-min-microvolt = <1800000>; 333 regulator-max-microvolt = <1800000>; 334 regulator-name = "dovdd-csi"; 335}; 336 337®_aldo2 { 338 regulator-always-on; 339 regulator-min-microvolt = <1800000>; 340 regulator-max-microvolt = <1800000>; 341 regulator-name = "vcc-pl"; 342}; 343 344®_aldo3 { 345 regulator-always-on; 346 regulator-min-microvolt = <3000000>; 347 regulator-max-microvolt = <3000000>; 348 regulator-name = "vcc-pll-avcc"; 349}; 350 351®_dcdc1 { 352 regulator-always-on; 353 regulator-min-microvolt = <3300000>; 354 regulator-max-microvolt = <3300000>; 355 regulator-name = "vcc-3v3"; 356}; 357 358®_dcdc2 { 359 regulator-always-on; 360 regulator-min-microvolt = <1000000>; 361 regulator-max-microvolt = <1300000>; 362 regulator-name = "vdd-cpux"; 363}; 364 365/* DCDC3 is polyphased with DCDC2 */ 366 367®_dcdc5 { 368 regulator-always-on; 369 regulator-min-microvolt = <1200000>; 370 regulator-max-microvolt = <1200000>; 371 regulator-name = "vcc-dram"; 372}; 373 374®_dcdc6 { 375 regulator-always-on; 376 regulator-min-microvolt = <1100000>; 377 regulator-max-microvolt = <1100000>; 378 regulator-name = "vdd-sys"; 379}; 380 381®_dldo1 { 382 regulator-min-microvolt = <3300000>; 383 regulator-max-microvolt = <3300000>; 384 regulator-name = "vcc-dsi-sensor"; 385}; 386 387®_dldo2 { 388 regulator-min-microvolt = <1800000>; 389 regulator-max-microvolt = <1800000>; 390 regulator-name = "vcc-mipi-io"; 391}; 392 393®_dldo3 { 394 regulator-min-microvolt = <2800000>; 395 regulator-max-microvolt = <2800000>; 396 regulator-name = "avdd-csi"; 397}; 398 399®_dldo4 { 400 regulator-min-microvolt = <1800000>; 401 regulator-max-microvolt = <1800000>; 402 regulator-name = "vcc-wifi-io"; 403}; 404 405®_eldo1 { 406 regulator-always-on; 407 regulator-min-microvolt = <1800000>; 408 regulator-max-microvolt = <1800000>; 409 regulator-name = "vcc-lpddr"; 410}; 411 412®_eldo3 { 413 regulator-min-microvolt = <1800000>; 414 regulator-max-microvolt = <1800000>; 415 regulator-name = "dvdd-1v8-csi"; 416}; 417 418®_fldo1 { 419 regulator-min-microvolt = <1200000>; 420 regulator-max-microvolt = <1200000>; 421 regulator-name = "vcc-1v2-hsic"; 422}; 423 424®_fldo2 { 425 regulator-always-on; 426 regulator-min-microvolt = <1100000>; 427 regulator-max-microvolt = <1100000>; 428 regulator-name = "vdd-cpus"; 429}; 430 431®_ldo_io0 { 432 regulator-min-microvolt = <3300000>; 433 regulator-max-microvolt = <3300000>; 434 regulator-name = "vcc-lcd-ctp-stk"; 435 status = "okay"; 436}; 437 438®_ldo_io1 { 439 regulator-min-microvolt = <1800000>; 440 regulator-max-microvolt = <1800000>; 441 regulator-name = "vcc-1v8-typec"; 442 status = "okay"; 443}; 444 445®_rtc_ldo { 446 regulator-name = "vcc-rtc"; 447}; 448 449&sound { 450 status = "okay"; 451 simple-audio-card,name = "PinePhone"; 452 simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>; 453 simple-audio-card,widgets = "Microphone", "Headset Microphone", 454 "Microphone", "Internal Microphone", 455 "Headphone", "Headphone Jack", 456 "Speaker", "Internal Earpiece", 457 "Speaker", "Internal Speaker"; 458 simple-audio-card,routing = 459 "Headphone Jack", "HP", 460 "Internal Earpiece", "EARPIECE", 461 "Internal Speaker", "Speaker Amp OUTL", 462 "Internal Speaker", "Speaker Amp OUTR", 463 "Speaker Amp INL", "LINEOUT", 464 "Speaker Amp INR", "LINEOUT", 465 "Left DAC", "DACL", 466 "Right DAC", "DACR", 467 "ADCL", "Left ADC", 468 "ADCR", "Right ADC", 469 "Internal Microphone", "MBIAS", 470 "MIC1", "Internal Microphone", 471 "Headset Microphone", "HBIAS", 472 "MIC2", "Headset Microphone"; 473 474 simple-audio-card,dai-link@2 { 475 format = "dsp_a"; 476 frame-master = <&link2_codec>; 477 bitclock-master = <&link2_codec>; 478 bitclock-inversion; 479 480 link2_cpu: cpu { 481 sound-dai = <&bt_sco_codec 0>; 482 }; 483 484 link2_codec: codec { 485 sound-dai = <&codec 2>; 486 dai-tdm-slot-num = <1>; 487 dai-tdm-slot-width = <32>; 488 }; 489 }; 490}; 491 492&uart0 { 493 pinctrl-names = "default"; 494 pinctrl-0 = <&uart0_pb_pins>; 495 status = "okay"; 496}; 497 498&uart1 { 499 pinctrl-names = "default"; 500 pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; 501 status = "okay"; 502 503 bluetooth { 504 compatible = "realtek,rtl8723cs-bt"; 505 device-wake-gpios = <&pio 7 6 GPIO_ACTIVE_LOW>; /* PH6 */ 506 enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */ 507 host-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */ 508 }; 509}; 510 511/* Connected to the modem (hardware flow control can't be used) */ 512&uart3 { 513 pinctrl-names = "default"; 514 pinctrl-0 = <&uart3_pins>; 515 status = "okay"; 516}; 517 518&usb_otg { 519 dr_mode = "peripheral"; 520 status = "okay"; 521}; 522 523&usb_power_supply { 524 status = "okay"; 525}; 526 527&usbphy { 528 status = "okay"; 529}; 530