1// SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2 3/dts-v1/; 4 5#include <dt-bindings/gpio/gpio.h> 6#include <dt-bindings/input/linux-event-codes.h> 7#include <dt-bindings/pinctrl/rockchip.h> 8#include "rk3566-anbernic-rgxx3.dtsi" 9 10/ { 11 model = "RG503"; 12 compatible = "anbernic,rg503", "rockchip,rk3566"; 13 14 aliases { 15 mmc0 = &sdmmc0; 16 mmc1 = &sdmmc1; 17 mmc2 = &sdmmc2; 18 }; 19 20 battery: battery { 21 compatible = "simple-battery"; 22 charge-full-design-microamp-hours = <3472000>; 23 charge-term-current-microamp = <300000>; 24 constant-charge-current-max-microamp = <2000000>; 25 constant-charge-voltage-max-microvolt = <4200000>; 26 factory-internal-resistance-micro-ohms = <117000>; 27 voltage-max-design-microvolt = <4172000>; 28 voltage-min-design-microvolt = <3400000>; 29 30 ocv-capacity-celsius = <20>; 31 ocv-capacity-table-0 = <4172000 100>, <4054000 95>, <3984000 90>, <3926000 85>, 32 <3874000 80>, <3826000 75>, <3783000 70>, <3746000 65>, 33 <3714000 60>, <3683000 55>, <3650000 50>, <3628000 45>, 34 <3612000 40>, <3600000 35>, <3587000 30>, <3571000 25>, 35 <3552000 20>, <3525000 15>, <3492000 10>, <3446000 5>, 36 <3400000 0>; 37 }; 38 39 gpio_spi: spi { 40 compatible = "spi-gpio"; 41 pinctrl-names = "default"; 42 pinctrl-0 = <&spi_pins>; 43 #address-cells = <1>; 44 #size-cells = <0>; 45 46 sck-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>; 47 mosi-gpios = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; 48 cs-gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; 49 num-chipselects = <0>; 50 51 panel@0 { 52 compatible = "samsung,ams495qa01"; 53 reg = <0>; 54 pinctrl-names = "default"; 55 pinctrl-0 = <&lcd_reset>; 56 reset-gpios = <&gpio4 RK_PA0 GPIO_ACTIVE_LOW>; 57 vdd-supply = <&vcc_3v3>; 58 59 port { 60 mipi_in_panel: endpoint { 61 remote-endpoint = <&mipi_out_panel>; 62 }; 63 }; 64 }; 65 }; 66 67 /* Channels reversed for both headphones and speakers. */ 68 sound { 69 compatible = "simple-audio-card"; 70 simple-audio-card,name = "rk817_ext"; 71 simple-audio-card,aux-devs = <&spk_amp>; 72 simple-audio-card,format = "i2s"; 73 simple-audio-card,hp-det-gpio = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>; 74 simple-audio-card,mclk-fs = <256>; 75 simple-audio-card,widgets = 76 "Microphone", "Mic Jack", 77 "Headphone", "Headphones", 78 "Speaker", "Internal Speakers"; 79 simple-audio-card,routing = 80 "MICL", "Mic Jack", 81 "Headphones", "HPOL", 82 "Headphones", "HPOR", 83 "Internal Speakers", "Speaker Amp OUTL", 84 "Internal Speakers", "Speaker Amp OUTR", 85 "Speaker Amp INL", "HPOL", 86 "Speaker Amp INR", "HPOR"; 87 simple-audio-card,pin-switches = "Internal Speakers"; 88 89 simple-audio-card,codec { 90 sound-dai = <&rk817>; 91 }; 92 93 simple-audio-card,cpu { 94 sound-dai = <&i2s1_8ch>; 95 }; 96 }; 97 98 spk_amp: audio-amplifier { 99 compatible = "simple-audio-amplifier"; 100 enable-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>; 101 pinctrl-0 = <&spk_amp_enable_h>; 102 pinctrl-names = "default"; 103 sound-name-prefix = "Speaker Amp"; 104 }; 105}; 106 107&cru { 108 assigned-clocks = <&cru PLL_GPLL>, <&pmucru PLL_PPLL>, <&cru PLL_VPLL>; 109 assigned-clock-rates = <1200000000>, <200000000>, <500000000>; 110}; 111 112&dsi_dphy0 { 113 status = "okay"; 114}; 115 116&dsi0 { 117 status = "okay"; 118 119 ports { 120 dsi0_in: port@0 { 121 reg = <0>; 122 123 dsi0_in_vp1: endpoint { 124 remote-endpoint = <&vp1_out_dsi0>; 125 }; 126 }; 127 128 dsi0_out: port@1 { 129 reg = <1>; 130 131 mipi_out_panel: endpoint { 132 remote-endpoint = <&mipi_in_panel>; 133 }; 134 }; 135 }; 136}; 137 138&gpio_keys_control { 139 button-a { 140 gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; 141 label = "EAST"; 142 linux,code = <BTN_EAST>; 143 }; 144 145 button-left { 146 gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>; 147 label = "DPAD-LEFT"; 148 linux,code = <BTN_DPAD_LEFT>; 149 }; 150 151 button-right { 152 gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; 153 label = "DPAD-RIGHT"; 154 linux,code = <BTN_DPAD_RIGHT>; 155 }; 156 157 button-r1 { 158 gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; 159 label = "TR"; 160 linux,code = <BTN_TR>; 161 }; 162 163 button-r2 { 164 gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; 165 label = "TR2"; 166 linux,code = <BTN_TR2>; 167 }; 168 169 button-right { 170 gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; 171 label = "DPAD-RIGHT"; 172 linux,code = <BTN_DPAD_RIGHT>; 173 }; 174 175 button-y { 176 gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; 177 label = "WEST"; 178 linux,code = <BTN_WEST>; 179 }; 180}; 181 182&pinctrl { 183 audio-amplifier { 184 spk_amp_enable_h: spk-amp-enable-h { 185 rockchip,pins = 186 <4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; 187 }; 188 }; 189 190 gpio-lcd { 191 lcd_reset: lcd-reset { 192 rockchip,pins = 193 <4 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; 194 }; 195 }; 196 197 gpio-spi { 198 spi_pins: spi-pins { 199 rockchip,pins = 200 <4 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>, 201 <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>, 202 <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; 203 }; 204 }; 205}; 206 207&rk817 { 208 rk817_charger: charger { 209 monitored-battery = <&battery>; 210 rockchip,resistor-sense-micro-ohms = <10000>; 211 rockchip,sleep-enter-current-microamp = <300000>; 212 rockchip,sleep-filter-current-microamp = <100000>; 213 }; 214}; 215 216&vp1 { 217 vp1_out_dsi0: endpoint@ROCKCHIP_VOP2_EP_MIPI0 { 218 reg = <ROCKCHIP_VOP2_EP_MIPI0>; 219 remote-endpoint = <&dsi0_in_vp1>; 220 }; 221}; 222