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-rg353x.dtsi"
9
10/ {
11	model = "RG353V";
12	compatible = "anbernic,rg353v", "rockchip,rk3566";
13
14	aliases {
15		mmc0 = &sdhci;
16		mmc1 = &sdmmc0;
17		mmc2 = &sdmmc1;
18		mmc3 = &sdmmc2;
19	};
20
21	battery: battery {
22		compatible = "simple-battery";
23		charge-full-design-microamp-hours = <3151000>;
24		charge-term-current-microamp = <300000>;
25		constant-charge-current-max-microamp = <2000000>;
26		constant-charge-voltage-max-microvolt = <4200000>;
27		factory-internal-resistance-micro-ohms = <117000>;
28		voltage-max-design-microvolt = <4172000>;
29		voltage-min-design-microvolt = <3400000>;
30
31		ocv-capacity-celsius = <20>;
32		ocv-capacity-table-0 =  <4172000 100>, <4054000 95>, <3984000 90>, <3926000 85>,
33					<3874000 80>, <3826000 75>, <3783000 70>, <3746000 65>,
34					<3714000 60>, <3683000 55>, <3650000 50>, <3628000 45>,
35					<3612000 40>, <3600000 35>, <3587000 30>, <3571000 25>,
36					<3552000 20>, <3525000 15>, <3492000 10>, <3446000 5>,
37					<3400000 0>;
38	};
39
40	/* Channels reversed for headphones. */
41	sound {
42		compatible = "simple-audio-card";
43		simple-audio-card,name = "rk817_int";
44		simple-audio-card,format = "i2s";
45		simple-audio-card,hp-det-gpio = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
46		simple-audio-card,mclk-fs = <256>;
47		simple-audio-card,widgets =
48			"Microphone", "Mic Jack",
49			"Headphone", "Headphones",
50			"Speaker", "Internal Speakers";
51		simple-audio-card,routing =
52			"MICL", "Mic Jack",
53			"Headphones", "HPOL",
54			"Headphones", "HPOR",
55			"Internal Speakers", "SPKO";
56
57		simple-audio-card,codec {
58			sound-dai = <&rk817>;
59		};
60
61		simple-audio-card,cpu {
62			sound-dai = <&i2s1_8ch>;
63		};
64	};
65};
66
67&gpio_keys_control {
68	button-r1 {
69		gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>;
70		label = "TR";
71		linux,code = <BTN_TR>;
72	};
73
74	button-r2 {
75		gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
76		label = "TR2";
77		linux,code = <BTN_TR2>;
78	};
79};
80
81&i2c2 {
82	pintctrl-names = "default";
83	pinctrl-0 = <&i2c2m1_xfer>;
84	status = "okay";
85
86	touch@1a {
87		compatible = "hynitron,cst340";
88		reg = <0x1a>;
89		interrupt-parent = <&gpio4>;
90		interrupts = <RK_PB1 IRQ_TYPE_EDGE_FALLING>;
91		pinctrl-0 = <&touch_rst>;
92		pinctrl-names = "default";
93		reset-gpios = <&gpio4 RK_PA6 GPIO_ACTIVE_LOW>;
94		touchscreen-size-x = <640>;
95		touchscreen-size-y = <480>;
96	};
97};
98
99&pinctrl {
100	touch {
101		touch_rst: touch-rst {
102			rockchip,pins =
103				<4 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
104		};
105	};
106};
107
108&rk817 {
109	rk817_charger: charger {
110		monitored-battery = <&battery>;
111		rockchip,resistor-sense-micro-ohms = <10000>;
112		rockchip,sleep-enter-current-microamp = <300000>;
113		rockchip,sleep-filter-current-microamp = <100000>;
114	};
115};
116
117&sdhci {
118	pinctrl-0 = <&emmc_bus8>, <&emmc_clk>, <&emmc_cmd>, <&emmc_datastrobe>, <&emmc_rstnout>;
119	pinctrl-names = "default";
120	bus-width = <8>;
121	mmc-hs200-1_8v;
122	non-removable;
123	vmmc-supply = <&vcc_3v3>;
124	vqmmc-supply = <&vcc_1v8>;
125	status = "okay";
126};
127