0001 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
0002 // Copyright (C) 2019 Icenowy Zheng <icenowy@aosc.xyz>
0003 // Copyright (C) 2020 Martijn Braam <martijn@brixit.nl>
0004 // Copyright (C) 2020 Ondrej Jirman <megous@megous.com>
0005
0006 #include "sun50i-a64.dtsi"
0007 #include "sun50i-a64-cpu-opp.dtsi"
0008
0009 #include <dt-bindings/gpio/gpio.h>
0010 #include <dt-bindings/input/input.h>
0011 #include <dt-bindings/leds/common.h>
0012 #include <dt-bindings/pwm/pwm.h>
0013
0014 / {
0015 chassis-type = "handset";
0016
0017 aliases {
0018 ethernet0 = &rtl8723cs;
0019 serial0 = &uart0;
0020 };
0021
0022 backlight: backlight {
0023 compatible = "pwm-backlight";
0024 pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
0025 enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */
0026 power-supply = <®_ps>;
0027 /* Backlight configuration differs per PinePhone revision. */
0028 };
0029
0030 bt_sco_codec: bt-sco-codec {
0031 #sound-dai-cells = <1>;
0032 compatible = "linux,bt-sco";
0033 };
0034
0035 chosen {
0036 stdout-path = "serial0:115200n8";
0037 };
0038
0039 leds {
0040 compatible = "gpio-leds";
0041
0042 led-0 {
0043 function = LED_FUNCTION_INDICATOR;
0044 color = <LED_COLOR_ID_BLUE>;
0045 gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
0046 };
0047
0048 led-1 {
0049 function = LED_FUNCTION_INDICATOR;
0050 color = <LED_COLOR_ID_GREEN>;
0051 gpios = <&pio 3 18 GPIO_ACTIVE_HIGH>; /* PD18 */
0052 };
0053
0054 led-2 {
0055 function = LED_FUNCTION_INDICATOR;
0056 color = <LED_COLOR_ID_RED>;
0057 gpios = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */
0058 };
0059 };
0060
0061 reg_ps: ps-regulator {
0062 compatible = "regulator-fixed";
0063 regulator-name = "ps";
0064 regulator-min-microvolt = <5000000>;
0065 regulator-max-microvolt = <5000000>;
0066 regulator-boot-on;
0067 };
0068
0069 reg_vbat_wifi: vbat-wifi {
0070 compatible = "regulator-fixed";
0071 regulator-min-microvolt = <3300000>;
0072 regulator-max-microvolt = <3300000>;
0073 regulator-name = "vbat-wifi";
0074 };
0075
0076 sgm3140: led-controller {
0077 compatible = "sgmicro,sgm3140";
0078 vin-supply = <®_dcdc1>;
0079
0080 sgm3140_flash: led {
0081 function = LED_FUNCTION_FLASH;
0082 color = <LED_COLOR_ID_WHITE>;
0083 flash-max-timeout-us = <250000>;
0084 };
0085 };
0086
0087 speaker_amp: audio-amplifier {
0088 compatible = "simple-audio-amplifier";
0089 enable-gpios = <&pio 2 7 GPIO_ACTIVE_HIGH>; /* PC7 */
0090 sound-name-prefix = "Speaker Amp";
0091 };
0092
0093 vibrator {
0094 compatible = "gpio-vibrator";
0095 enable-gpios = <&pio 3 2 GPIO_ACTIVE_HIGH>; /* PD2 */
0096 vcc-supply = <®_dcdc1>;
0097 };
0098 };
0099
0100 &codec {
0101 pinctrl-names = "default";
0102 pinctrl-0 = <&aif3_pins>;
0103 status = "okay";
0104 };
0105
0106 &codec_analog {
0107 cpvdd-supply = <®_eldo1>;
0108 status = "okay";
0109 };
0110
0111 &cpu0 {
0112 cpu-supply = <®_dcdc2>;
0113 };
0114
0115 &cpu1 {
0116 cpu-supply = <®_dcdc2>;
0117 };
0118
0119 &cpu2 {
0120 cpu-supply = <®_dcdc2>;
0121 };
0122
0123 &cpu3 {
0124 cpu-supply = <®_dcdc2>;
0125 };
0126
0127 &dai {
0128 status = "okay";
0129 };
0130
0131 &de {
0132 status = "okay";
0133 };
0134
0135 &dphy {
0136 status = "okay";
0137 };
0138
0139 &dsi {
0140 vcc-dsi-supply = <®_dldo1>;
0141 status = "okay";
0142
0143 panel@0 {
0144 compatible = "xingbangda,xbd599";
0145 reg = <0>;
0146 reset-gpios = <&pio 3 23 GPIO_ACTIVE_LOW>; /* PD23 */
0147 iovcc-supply = <®_dldo2>;
0148 vcc-supply = <®_ldo_io0>;
0149 backlight = <&backlight>;
0150 };
0151 };
0152
0153 &ehci0 {
0154 status = "okay";
0155 };
0156
0157 &ehci1 {
0158 status = "okay";
0159 };
0160
0161 &i2c0 {
0162 status = "okay";
0163
0164 touchscreen@5d {
0165 compatible = "goodix,gt917s";
0166 reg = <0x5d>;
0167 interrupt-parent = <&pio>;
0168 interrupts = <7 4 IRQ_TYPE_LEVEL_HIGH>; /* PH4 */
0169 irq-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
0170 reset-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
0171 AVDD28-supply = <®_ldo_io0>;
0172 VDDIO-supply = <®_ldo_io0>;
0173 touchscreen-size-x = <720>;
0174 touchscreen-size-y = <1440>;
0175 };
0176 };
0177
0178 &i2c1 {
0179 status = "okay";
0180
0181 /* Magnetometer */
0182 lis3mdl: magnetometer@1e {
0183 compatible = "st,lis3mdl-magn";
0184 reg = <0x1e>;
0185 vdd-supply = <®_dldo1>;
0186 vddio-supply = <®_dldo1>;
0187 };
0188
0189 /* Light/proximity sensor */
0190 light-sensor@48 {
0191 compatible = "sensortek,stk3311";
0192 reg = <0x48>;
0193 interrupt-parent = <&pio>;
0194 interrupts = <1 0 IRQ_TYPE_EDGE_FALLING>; /* PB0 */
0195 };
0196
0197 /* Accelerometer/gyroscope */
0198 accelerometer@68 {
0199 compatible = "invensense,mpu6050";
0200 reg = <0x68>;
0201 interrupt-parent = <&pio>;
0202 interrupts = <7 5 IRQ_TYPE_EDGE_RISING>; /* PH5 */
0203 vdd-supply = <®_dldo1>;
0204 vddio-supply = <®_dldo1>;
0205 };
0206 };
0207
0208 /* Connected to pogo pins (external spring based pinheader for user addons) */
0209 &i2c2 {
0210 status = "okay";
0211 };
0212
0213 &lradc {
0214 vref-supply = <®_aldo3>;
0215 wakeup-source;
0216 status = "okay";
0217
0218 button-200 {
0219 label = "Volume Up";
0220 linux,code = <KEY_VOLUMEUP>;
0221 channel = <0>;
0222 voltage = <200000>;
0223 };
0224
0225 button-400 {
0226 label = "Volume Down";
0227 linux,code = <KEY_VOLUMEDOWN>;
0228 channel = <0>;
0229 voltage = <400000>;
0230 };
0231 };
0232
0233 &mmc0 {
0234 pinctrl-names = "default";
0235 pinctrl-0 = <&mmc0_pins>;
0236 vmmc-supply = <®_dcdc1>;
0237 vqmmc-supply = <®_dcdc1>;
0238 cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
0239 disable-wp;
0240 bus-width = <4>;
0241 status = "okay";
0242 };
0243
0244 &mmc1 {
0245 pinctrl-names = "default";
0246 pinctrl-0 = <&mmc1_pins>;
0247 vmmc-supply = <®_vbat_wifi>;
0248 vqmmc-supply = <®_dldo4>;
0249 bus-width = <4>;
0250 non-removable;
0251 status = "okay";
0252
0253 rtl8723cs: wifi@1 {
0254 reg = <1>;
0255 };
0256 };
0257
0258 &mmc2 {
0259 pinctrl-names = "default";
0260 pinctrl-0 = <&mmc2_pins>;
0261 vmmc-supply = <®_dcdc1>;
0262 vqmmc-supply = <®_dcdc1>;
0263 bus-width = <8>;
0264 non-removable;
0265 cap-mmc-hw-reset;
0266 status = "okay";
0267 };
0268
0269 &ohci0 {
0270 status = "okay";
0271 };
0272
0273 &ohci1 {
0274 status = "okay";
0275 };
0276
0277 &pio {
0278 vcc-pb-supply = <®_dcdc1>;
0279 vcc-pc-supply = <®_dcdc1>;
0280 vcc-pd-supply = <®_dcdc1>;
0281 vcc-pe-supply = <®_aldo1>;
0282 vcc-pf-supply = <®_dcdc1>;
0283 vcc-pg-supply = <®_dldo4>;
0284 vcc-ph-supply = <®_dcdc1>;
0285 };
0286
0287 &r_pio {
0288 /*
0289 * FIXME: We can't add that supply for now since it would
0290 * create a circular dependency between pinctrl, the regulator
0291 * and the RSB Bus.
0292 *
0293 * vcc-pl-supply = <®_aldo2>;
0294 */
0295 };
0296
0297 &r_pwm {
0298 status = "okay";
0299 };
0300
0301 &r_rsb {
0302 status = "okay";
0303
0304 axp803: pmic@3a3 {
0305 compatible = "x-powers,axp803";
0306 reg = <0x3a3>;
0307 interrupt-parent = <&r_intc>;
0308 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
0309 };
0310 };
0311
0312 #include "axp803.dtsi"
0313
0314 &battery_power_supply {
0315 status = "okay";
0316 };
0317
0318 ®_aldo1 {
0319 regulator-min-microvolt = <1800000>;
0320 regulator-max-microvolt = <1800000>;
0321 regulator-name = "dovdd-csi";
0322 };
0323
0324 ®_aldo2 {
0325 regulator-always-on;
0326 regulator-min-microvolt = <1800000>;
0327 regulator-max-microvolt = <1800000>;
0328 regulator-name = "vcc-pl";
0329 };
0330
0331 ®_aldo3 {
0332 regulator-always-on;
0333 regulator-min-microvolt = <3000000>;
0334 regulator-max-microvolt = <3000000>;
0335 regulator-name = "vcc-pll-avcc";
0336 };
0337
0338 ®_dcdc1 {
0339 regulator-always-on;
0340 regulator-min-microvolt = <3300000>;
0341 regulator-max-microvolt = <3300000>;
0342 regulator-name = "vcc-3v3";
0343 };
0344
0345 ®_dcdc2 {
0346 regulator-always-on;
0347 regulator-min-microvolt = <1000000>;
0348 regulator-max-microvolt = <1300000>;
0349 regulator-name = "vdd-cpux";
0350 };
0351
0352 /* DCDC3 is polyphased with DCDC2 */
0353
0354 ®_dcdc5 {
0355 regulator-always-on;
0356 regulator-min-microvolt = <1200000>;
0357 regulator-max-microvolt = <1200000>;
0358 regulator-name = "vcc-dram";
0359 };
0360
0361 ®_dcdc6 {
0362 regulator-always-on;
0363 regulator-min-microvolt = <1100000>;
0364 regulator-max-microvolt = <1100000>;
0365 regulator-name = "vdd-sys";
0366 };
0367
0368 ®_dldo1 {
0369 regulator-min-microvolt = <3300000>;
0370 regulator-max-microvolt = <3300000>;
0371 regulator-name = "vcc-dsi-sensor";
0372 };
0373
0374 ®_dldo2 {
0375 regulator-min-microvolt = <1800000>;
0376 regulator-max-microvolt = <1800000>;
0377 regulator-name = "vcc-mipi-io";
0378 };
0379
0380 ®_dldo3 {
0381 regulator-min-microvolt = <2800000>;
0382 regulator-max-microvolt = <2800000>;
0383 regulator-name = "avdd-csi";
0384 };
0385
0386 ®_dldo4 {
0387 regulator-min-microvolt = <1800000>;
0388 regulator-max-microvolt = <1800000>;
0389 regulator-name = "vcc-wifi-io";
0390 };
0391
0392 ®_eldo1 {
0393 regulator-always-on;
0394 regulator-min-microvolt = <1800000>;
0395 regulator-max-microvolt = <1800000>;
0396 regulator-name = "vcc-lpddr";
0397 };
0398
0399 ®_eldo3 {
0400 regulator-min-microvolt = <1800000>;
0401 regulator-max-microvolt = <1800000>;
0402 regulator-name = "dvdd-1v8-csi";
0403 };
0404
0405 ®_fldo1 {
0406 regulator-min-microvolt = <1200000>;
0407 regulator-max-microvolt = <1200000>;
0408 regulator-name = "vcc-1v2-hsic";
0409 };
0410
0411 ®_fldo2 {
0412 regulator-always-on;
0413 regulator-min-microvolt = <1100000>;
0414 regulator-max-microvolt = <1100000>;
0415 regulator-name = "vdd-cpus";
0416 };
0417
0418 ®_ldo_io0 {
0419 regulator-min-microvolt = <3300000>;
0420 regulator-max-microvolt = <3300000>;
0421 regulator-name = "vcc-lcd-ctp-stk";
0422 status = "okay";
0423 };
0424
0425 ®_ldo_io1 {
0426 regulator-min-microvolt = <1800000>;
0427 regulator-max-microvolt = <1800000>;
0428 regulator-name = "vcc-1v8-typec";
0429 status = "okay";
0430 };
0431
0432 ®_rtc_ldo {
0433 regulator-name = "vcc-rtc";
0434 };
0435
0436 &sound {
0437 status = "okay";
0438 simple-audio-card,name = "PinePhone";
0439 simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
0440 simple-audio-card,widgets = "Microphone", "Headset Microphone",
0441 "Microphone", "Internal Microphone",
0442 "Headphone", "Headphone Jack",
0443 "Speaker", "Internal Earpiece",
0444 "Speaker", "Internal Speaker";
0445 simple-audio-card,routing =
0446 "Headphone Jack", "HP",
0447 "Internal Earpiece", "EARPIECE",
0448 "Internal Speaker", "Speaker Amp OUTL",
0449 "Internal Speaker", "Speaker Amp OUTR",
0450 "Speaker Amp INL", "LINEOUT",
0451 "Speaker Amp INR", "LINEOUT",
0452 "Left DAC", "DACL",
0453 "Right DAC", "DACR",
0454 "ADCL", "Left ADC",
0455 "ADCR", "Right ADC",
0456 "Internal Microphone", "MBIAS",
0457 "MIC1", "Internal Microphone",
0458 "Headset Microphone", "HBIAS",
0459 "MIC2", "Headset Microphone";
0460
0461 simple-audio-card,dai-link@2 {
0462 format = "dsp_a";
0463 frame-master = <&link2_codec>;
0464 bitclock-master = <&link2_codec>;
0465 bitclock-inversion;
0466
0467 link2_cpu: cpu {
0468 sound-dai = <&bt_sco_codec 0>;
0469 };
0470
0471 link2_codec: codec {
0472 sound-dai = <&codec 2>;
0473 dai-tdm-slot-num = <1>;
0474 dai-tdm-slot-width = <32>;
0475 };
0476 };
0477 };
0478
0479 &uart0 {
0480 pinctrl-names = "default";
0481 pinctrl-0 = <&uart0_pb_pins>;
0482 status = "okay";
0483 };
0484
0485 &uart1 {
0486 pinctrl-names = "default";
0487 pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
0488 status = "okay";
0489
0490 bluetooth {
0491 compatible = "realtek,rtl8723cs-bt";
0492 device-wake-gpios = <&pio 7 6 GPIO_ACTIVE_LOW>; /* PH6 */
0493 enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
0494 host-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
0495 };
0496 };
0497
0498 /* Connected to the modem (hardware flow control can't be used) */
0499 &uart3 {
0500 pinctrl-names = "default";
0501 pinctrl-0 = <&uart3_pins>;
0502 status = "okay";
0503 };
0504
0505 &usb_otg {
0506 dr_mode = "peripheral";
0507 status = "okay";
0508 };
0509
0510 &usb_power_supply {
0511 status = "okay";
0512 };
0513
0514 &usbphy {
0515 status = "okay";
0516 };