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