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 = <&pmucru CLK_RTC_32K>, <&cru PLL_GPLL>, 109 <&pmucru PLL_PPLL>, <&cru PLL_VPLL>; 110 assigned-clock-rates = <32768>, <1200000000>, 111 <200000000>, <500000000>; 112}; 113 114&dsi_dphy0 { 115 status = "okay"; 116}; 117 118&dsi0 { 119 status = "okay"; 120 121 ports { 122 dsi0_in: port@0 { 123 reg = <0>; 124 125 dsi0_in_vp1: endpoint { 126 remote-endpoint = <&vp1_out_dsi0>; 127 }; 128 }; 129 130 dsi0_out: port@1 { 131 reg = <1>; 132 133 mipi_out_panel: endpoint { 134 remote-endpoint = <&mipi_in_panel>; 135 }; 136 }; 137 }; 138}; 139 140&gpio_keys_control { 141 button-a { 142 gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>; 143 label = "EAST"; 144 linux,code = <BTN_EAST>; 145 }; 146 147 button-left { 148 gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>; 149 label = "DPAD-LEFT"; 150 linux,code = <BTN_DPAD_LEFT>; 151 }; 152 153 button-right { 154 gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; 155 label = "DPAD-RIGHT"; 156 linux,code = <BTN_DPAD_RIGHT>; 157 }; 158 159 button-r1 { 160 gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; 161 label = "TR"; 162 linux,code = <BTN_TR>; 163 }; 164 165 button-r2 { 166 gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; 167 label = "TR2"; 168 linux,code = <BTN_TR2>; 169 }; 170 171 button-right { 172 gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; 173 label = "DPAD-RIGHT"; 174 linux,code = <BTN_DPAD_RIGHT>; 175 }; 176 177 button-y { 178 gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>; 179 label = "WEST"; 180 linux,code = <BTN_WEST>; 181 }; 182}; 183 184&pinctrl { 185 audio-amplifier { 186 spk_amp_enable_h: spk-amp-enable-h { 187 rockchip,pins = 188 <4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; 189 }; 190 }; 191 192 gpio-lcd { 193 lcd_reset: lcd-reset { 194 rockchip,pins = 195 <4 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; 196 }; 197 }; 198 199 gpio-spi { 200 spi_pins: spi-pins { 201 rockchip,pins = 202 <4 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>, 203 <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>, 204 <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; 205 }; 206 }; 207}; 208 209&rk817 { 210 rk817_charger: charger { 211 monitored-battery = <&battery>; 212 rockchip,resistor-sense-micro-ohms = <10000>; 213 rockchip,sleep-enter-current-microamp = <300000>; 214 rockchip,sleep-filter-current-microamp = <100000>; 215 }; 216}; 217 218&vp1 { 219 vp1_out_dsi0: endpoint@ROCKCHIP_VOP2_EP_MIPI0 { 220 reg = <ROCKCHIP_VOP2_EP_MIPI0>; 221 remote-endpoint = <&dsi0_in_vp1>; 222 }; 223}; 224