1*4d83538aSChris Morgan// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2*4d83538aSChris Morgan
3*4d83538aSChris Morgan/dts-v1/;
4*4d83538aSChris Morgan
5*4d83538aSChris Morgan#include <dt-bindings/gpio/gpio.h>
6*4d83538aSChris Morgan#include <dt-bindings/input/linux-event-codes.h>
7*4d83538aSChris Morgan#include <dt-bindings/pinctrl/rockchip.h>
8*4d83538aSChris Morgan#include "rk3566-anbernic-rg353x.dtsi"
9*4d83538aSChris Morgan
10*4d83538aSChris Morgan/ {
11*4d83538aSChris Morgan	model = "RG353PS";
12*4d83538aSChris Morgan	compatible = "anbernic,rg353ps", "rockchip,rk3566";
13*4d83538aSChris Morgan
14*4d83538aSChris Morgan	aliases {
15*4d83538aSChris Morgan		mmc0 = &sdmmc0;
16*4d83538aSChris Morgan		mmc1 = &sdmmc1;
17*4d83538aSChris Morgan		mmc2 = &sdmmc2;
18*4d83538aSChris Morgan	};
19*4d83538aSChris Morgan
20*4d83538aSChris Morgan	battery: battery {
21*4d83538aSChris Morgan		compatible = "simple-battery";
22*4d83538aSChris Morgan		charge-full-design-microamp-hours = <3472000>;
23*4d83538aSChris Morgan		charge-term-current-microamp = <300000>;
24*4d83538aSChris Morgan		constant-charge-current-max-microamp = <2000000>;
25*4d83538aSChris Morgan		constant-charge-voltage-max-microvolt = <4200000>;
26*4d83538aSChris Morgan		factory-internal-resistance-micro-ohms = <117000>;
27*4d83538aSChris Morgan		voltage-max-design-microvolt = <4172000>;
28*4d83538aSChris Morgan		voltage-min-design-microvolt = <3400000>;
29*4d83538aSChris Morgan
30*4d83538aSChris Morgan		ocv-capacity-celsius = <20>;
31*4d83538aSChris Morgan		ocv-capacity-table-0 =  <4172000 100>, <4054000 95>, <3984000 90>, <3926000 85>,
32*4d83538aSChris Morgan					<3874000 80>, <3826000 75>, <3783000 70>, <3746000 65>,
33*4d83538aSChris Morgan					<3714000 60>, <3683000 55>, <3650000 50>, <3628000 45>,
34*4d83538aSChris Morgan					<3612000 40>, <3600000 35>, <3587000 30>, <3571000 25>,
35*4d83538aSChris Morgan					<3552000 20>, <3525000 15>, <3492000 10>, <3446000 5>,
36*4d83538aSChris Morgan					<3400000 0>;
37*4d83538aSChris Morgan	};
38*4d83538aSChris Morgan
39*4d83538aSChris Morgan	/* Channels reversed for both headphones and speakers. */
40*4d83538aSChris Morgan	sound {
41*4d83538aSChris Morgan		compatible = "simple-audio-card";
42*4d83538aSChris Morgan		simple-audio-card,name = "rk817_ext";
43*4d83538aSChris Morgan		simple-audio-card,aux-devs = <&spk_amp>;
44*4d83538aSChris Morgan		simple-audio-card,format = "i2s";
45*4d83538aSChris Morgan		simple-audio-card,hp-det-gpio = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
46*4d83538aSChris Morgan		simple-audio-card,mclk-fs = <256>;
47*4d83538aSChris Morgan		simple-audio-card,widgets =
48*4d83538aSChris Morgan			"Microphone", "Mic Jack",
49*4d83538aSChris Morgan			"Headphone", "Headphones",
50*4d83538aSChris Morgan			"Speaker", "Internal Speakers";
51*4d83538aSChris Morgan		simple-audio-card,routing =
52*4d83538aSChris Morgan			"MICL", "Mic Jack",
53*4d83538aSChris Morgan			"Headphones", "HPOL",
54*4d83538aSChris Morgan			"Headphones", "HPOR",
55*4d83538aSChris Morgan			"Internal Speakers", "Speaker Amp OUTL",
56*4d83538aSChris Morgan			"Internal Speakers", "Speaker Amp OUTR",
57*4d83538aSChris Morgan			"Speaker Amp INL", "HPOL",
58*4d83538aSChris Morgan			"Speaker Amp INR", "HPOR";
59*4d83538aSChris Morgan		simple-audio-card,pin-switches = "Internal Speakers";
60*4d83538aSChris Morgan
61*4d83538aSChris Morgan		simple-audio-card,codec {
62*4d83538aSChris Morgan			sound-dai = <&rk817>;
63*4d83538aSChris Morgan		};
64*4d83538aSChris Morgan
65*4d83538aSChris Morgan		simple-audio-card,cpu {
66*4d83538aSChris Morgan			sound-dai = <&i2s1_8ch>;
67*4d83538aSChris Morgan		};
68*4d83538aSChris Morgan	};
69*4d83538aSChris Morgan
70*4d83538aSChris Morgan	spk_amp: audio-amplifier {
71*4d83538aSChris Morgan		compatible = "simple-audio-amplifier";
72*4d83538aSChris Morgan		enable-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;
73*4d83538aSChris Morgan		pinctrl-0 = <&spk_amp_enable_h>;
74*4d83538aSChris Morgan		pinctrl-names = "default";
75*4d83538aSChris Morgan		sound-name-prefix = "Speaker Amp";
76*4d83538aSChris Morgan	};
77*4d83538aSChris Morgan};
78*4d83538aSChris Morgan
79*4d83538aSChris Morgan&gpio_keys_control {
80*4d83538aSChris Morgan	button-r1 {
81*4d83538aSChris Morgan		gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
82*4d83538aSChris Morgan		label = "TR";
83*4d83538aSChris Morgan		linux,code = <BTN_TR>;
84*4d83538aSChris Morgan	};
85*4d83538aSChris Morgan
86*4d83538aSChris Morgan	button-r2 {
87*4d83538aSChris Morgan		gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>;
88*4d83538aSChris Morgan		label = "TR2";
89*4d83538aSChris Morgan		linux,code = <BTN_TR2>;
90*4d83538aSChris Morgan	};
91*4d83538aSChris Morgan};
92*4d83538aSChris Morgan
93*4d83538aSChris Morgan&panel {
94*4d83538aSChris Morgan	compatible = "anbernic,rg353v-panel-v2";
95*4d83538aSChris Morgan	iovcc-supply = <&vcc3v3_lcd0_n>;
96*4d83538aSChris Morgan	vcc-supply = <&vcc3v3_lcd0_n>;
97*4d83538aSChris Morgan	/delete-property/ vdd-supply;
98*4d83538aSChris Morgan};
99*4d83538aSChris Morgan
100*4d83538aSChris Morgan&pinctrl {
101*4d83538aSChris Morgan	audio-amplifier {
102*4d83538aSChris Morgan		spk_amp_enable_h: spk-amp-enable-h {
103*4d83538aSChris Morgan			rockchip,pins =
104*4d83538aSChris Morgan				<4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
105*4d83538aSChris Morgan		};
106*4d83538aSChris Morgan	};
107*4d83538aSChris Morgan};
108*4d83538aSChris Morgan
109*4d83538aSChris Morgan&rk817 {
110*4d83538aSChris Morgan	rk817_charger: charger {
111*4d83538aSChris Morgan		monitored-battery = <&battery>;
112*4d83538aSChris Morgan		rockchip,resistor-sense-micro-ohms = <10000>;
113*4d83538aSChris Morgan		rockchip,sleep-enter-current-microamp = <300000>;
114*4d83538aSChris Morgan		rockchip,sleep-filter-current-microamp = <100000>;
115*4d83538aSChris Morgan	};
116*4d83538aSChris Morgan};
117