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