xref: /linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rg353p.dts (revision 0526b56cbc3c489642bd6a5fe4b718dea7ef0ee8)
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 = "RG353P";
12	compatible = "anbernic,rg353p", "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 = <3472000>;
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 both headphones and speakers. */
41	sound {
42		compatible = "simple-audio-card";
43		simple-audio-card,name = "rk817_ext";
44		simple-audio-card,aux-devs = <&spk_amp>;
45		simple-audio-card,format = "i2s";
46		simple-audio-card,hp-det-gpio = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
47		simple-audio-card,mclk-fs = <256>;
48		simple-audio-card,widgets =
49			"Microphone", "Mic Jack",
50			"Headphone", "Headphones",
51			"Speaker", "Internal Speakers";
52		simple-audio-card,routing =
53			"MICL", "Mic Jack",
54			"Headphones", "HPOL",
55			"Headphones", "HPOR",
56			"Internal Speakers", "Speaker Amp OUTL",
57			"Internal Speakers", "Speaker Amp OUTR",
58			"Speaker Amp INL", "HPOL",
59			"Speaker Amp INR", "HPOR";
60		simple-audio-card,pin-switches = "Internal Speakers";
61
62		simple-audio-card,codec {
63			sound-dai = <&rk817>;
64		};
65
66		simple-audio-card,cpu {
67			sound-dai = <&i2s1_8ch>;
68		};
69	};
70
71	spk_amp: audio-amplifier {
72		compatible = "simple-audio-amplifier";
73		enable-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;
74		pinctrl-0 = <&spk_amp_enable_h>;
75		pinctrl-names = "default";
76		sound-name-prefix = "Speaker Amp";
77	};
78};
79
80&gpio_keys_control {
81	button-r1 {
82		gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
83		label = "TR";
84		linux,code = <BTN_TR>;
85	};
86
87	button-r2 {
88		gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>;
89		label = "TR2";
90		linux,code = <BTN_TR2>;
91	};
92};
93
94&i2c2 {
95	pintctrl-names = "default";
96	pinctrl-0 = <&i2c2m1_xfer>;
97	status = "okay";
98
99	touch@1a {
100		compatible = "hynitron,cst340";
101		reg = <0x1a>;
102		interrupt-parent = <&gpio4>;
103		interrupts = <RK_PB1 IRQ_TYPE_EDGE_FALLING>;
104		pinctrl-0 = <&touch_rst>;
105		pinctrl-names = "default";
106		reset-gpios = <&gpio4 RK_PA6 GPIO_ACTIVE_LOW>;
107		touchscreen-size-x = <640>;
108		touchscreen-size-y = <480>;
109	};
110};
111
112&pinctrl {
113	audio-amplifier {
114		spk_amp_enable_h: spk-amp-enable-h {
115			rockchip,pins =
116				<4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
117		};
118	};
119
120	touch {
121		touch_rst: touch-rst {
122			rockchip,pins =
123				<4 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
124		};
125	};
126};
127
128&rk817 {
129	rk817_charger: charger {
130		monitored-battery = <&battery>;
131		rockchip,resistor-sense-micro-ohms = <10000>;
132		rockchip,sleep-enter-current-microamp = <300000>;
133		rockchip,sleep-filter-current-microamp = <100000>;
134	};
135};
136
137&sdhci {
138	pinctrl-0 = <&emmc_bus8>, <&emmc_clk>, <&emmc_cmd>, <&emmc_datastrobe>, <&emmc_rstnout>;
139	pinctrl-names = "default";
140	bus-width = <8>;
141	mmc-hs200-1_8v;
142	non-removable;
143	vmmc-supply = <&vcc_3v3>;
144	vqmmc-supply = <&vcc_1v8>;
145	status = "okay";
146};
147