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