1523adb55SChris Morgan// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2523adb55SChris Morgan
3523adb55SChris Morgan/dts-v1/;
4523adb55SChris Morgan
5523adb55SChris Morgan#include <dt-bindings/gpio/gpio.h>
6523adb55SChris Morgan#include <dt-bindings/input/linux-event-codes.h>
7523adb55SChris Morgan#include <dt-bindings/pinctrl/rockchip.h>
81e141cf1SChris Morgan#include "rk3566-anbernic-rg353x.dtsi"
9523adb55SChris Morgan
10523adb55SChris Morgan/ {
11b41b83b7SChris Morgan	model = "Anbernic RG353P";
12523adb55SChris Morgan	compatible = "anbernic,rg353p", "rockchip,rk3566";
13523adb55SChris Morgan
14523adb55SChris Morgan	aliases {
15523adb55SChris Morgan		mmc0 = &sdhci;
16523adb55SChris Morgan		mmc1 = &sdmmc0;
17523adb55SChris Morgan		mmc2 = &sdmmc1;
18523adb55SChris Morgan		mmc3 = &sdmmc2;
19523adb55SChris Morgan	};
20523adb55SChris Morgan
2122a91b76SChris Morgan	battery: battery {
2222a91b76SChris Morgan		compatible = "simple-battery";
2322a91b76SChris Morgan		charge-full-design-microamp-hours = <3472000>;
2422a91b76SChris Morgan		charge-term-current-microamp = <300000>;
2522a91b76SChris Morgan		constant-charge-current-max-microamp = <2000000>;
2622a91b76SChris Morgan		constant-charge-voltage-max-microvolt = <4200000>;
2722a91b76SChris Morgan		factory-internal-resistance-micro-ohms = <117000>;
2822a91b76SChris Morgan		voltage-max-design-microvolt = <4172000>;
2922a91b76SChris Morgan		voltage-min-design-microvolt = <3400000>;
3022a91b76SChris Morgan
3122a91b76SChris Morgan		ocv-capacity-celsius = <20>;
3222a91b76SChris Morgan		ocv-capacity-table-0 =  <4172000 100>, <4054000 95>, <3984000 90>, <3926000 85>,
3322a91b76SChris Morgan					<3874000 80>, <3826000 75>, <3783000 70>, <3746000 65>,
3422a91b76SChris Morgan					<3714000 60>, <3683000 55>, <3650000 50>, <3628000 45>,
3522a91b76SChris Morgan					<3612000 40>, <3600000 35>, <3587000 30>, <3571000 25>,
3622a91b76SChris Morgan					<3552000 20>, <3525000 15>, <3492000 10>, <3446000 5>,
3722a91b76SChris Morgan					<3400000 0>;
3822a91b76SChris Morgan	};
3922a91b76SChris Morgan
401e141cf1SChris Morgan	/* Channels reversed for both headphones and speakers. */
411e141cf1SChris Morgan	sound {
421e141cf1SChris Morgan		compatible = "simple-audio-card";
431e141cf1SChris Morgan		simple-audio-card,name = "rk817_ext";
441e141cf1SChris Morgan		simple-audio-card,aux-devs = <&spk_amp>;
451e141cf1SChris Morgan		simple-audio-card,format = "i2s";
461e141cf1SChris Morgan		simple-audio-card,hp-det-gpio = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
471e141cf1SChris Morgan		simple-audio-card,mclk-fs = <256>;
481e141cf1SChris Morgan		simple-audio-card,widgets =
491e141cf1SChris Morgan			"Microphone", "Mic Jack",
501e141cf1SChris Morgan			"Headphone", "Headphones",
511e141cf1SChris Morgan			"Speaker", "Internal Speakers";
521e141cf1SChris Morgan		simple-audio-card,routing =
531e141cf1SChris Morgan			"MICL", "Mic Jack",
541e141cf1SChris Morgan			"Headphones", "HPOL",
551e141cf1SChris Morgan			"Headphones", "HPOR",
561e141cf1SChris Morgan			"Internal Speakers", "Speaker Amp OUTL",
571e141cf1SChris Morgan			"Internal Speakers", "Speaker Amp OUTR",
581e141cf1SChris Morgan			"Speaker Amp INL", "HPOL",
591e141cf1SChris Morgan			"Speaker Amp INR", "HPOR";
601e141cf1SChris Morgan		simple-audio-card,pin-switches = "Internal Speakers";
611e141cf1SChris Morgan
621e141cf1SChris Morgan		simple-audio-card,codec {
631e141cf1SChris Morgan			sound-dai = <&rk817>;
641e141cf1SChris Morgan		};
651e141cf1SChris Morgan
661e141cf1SChris Morgan		simple-audio-card,cpu {
671e141cf1SChris Morgan			sound-dai = <&i2s1_8ch>;
681e141cf1SChris Morgan		};
691e141cf1SChris Morgan	};
701e141cf1SChris Morgan
711e141cf1SChris Morgan	spk_amp: audio-amplifier {
721e141cf1SChris Morgan		compatible = "simple-audio-amplifier";
731e141cf1SChris Morgan		enable-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;
741e141cf1SChris Morgan		pinctrl-0 = <&spk_amp_enable_h>;
751e141cf1SChris Morgan		pinctrl-names = "default";
761e141cf1SChris Morgan		sound-name-prefix = "Speaker Amp";
77523adb55SChris Morgan	};
78523adb55SChris Morgan};
79523adb55SChris Morgan
80523adb55SChris Morgan&gpio_keys_control {
81523adb55SChris Morgan	button-r1 {
82523adb55SChris Morgan		gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
83523adb55SChris Morgan		label = "TR";
84523adb55SChris Morgan		linux,code = <BTN_TR>;
85523adb55SChris Morgan	};
86523adb55SChris Morgan
87523adb55SChris Morgan	button-r2 {
88523adb55SChris Morgan		gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>;
89523adb55SChris Morgan		label = "TR2";
90523adb55SChris Morgan		linux,code = <BTN_TR2>;
91523adb55SChris Morgan	};
92523adb55SChris Morgan};
93523adb55SChris Morgan
94523adb55SChris Morgan&i2c2 {
95*f94b9343SHeiko Stuebner	pinctrl-names = "default";
96523adb55SChris Morgan	pinctrl-0 = <&i2c2m1_xfer>;
97523adb55SChris Morgan	status = "okay";
9831a47014SChris Morgan
9931a47014SChris Morgan	touch@1a {
10031a47014SChris Morgan		compatible = "hynitron,cst340";
10131a47014SChris Morgan		reg = <0x1a>;
10231a47014SChris Morgan		interrupt-parent = <&gpio4>;
10331a47014SChris Morgan		interrupts = <RK_PB1 IRQ_TYPE_EDGE_FALLING>;
10431a47014SChris Morgan		pinctrl-0 = <&touch_rst>;
10531a47014SChris Morgan		pinctrl-names = "default";
10631a47014SChris Morgan		reset-gpios = <&gpio4 RK_PA6 GPIO_ACTIVE_LOW>;
10731a47014SChris Morgan		touchscreen-size-x = <640>;
10831a47014SChris Morgan		touchscreen-size-y = <480>;
10931a47014SChris Morgan	};
110523adb55SChris Morgan};
111523adb55SChris Morgan
1121e141cf1SChris Morgan&pinctrl {
1131e141cf1SChris Morgan	audio-amplifier {
1141e141cf1SChris Morgan		spk_amp_enable_h: spk-amp-enable-h {
1151e141cf1SChris Morgan			rockchip,pins =
1161e141cf1SChris Morgan				<4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
1171e141cf1SChris Morgan		};
1181e141cf1SChris Morgan	};
11931a47014SChris Morgan
12031a47014SChris Morgan	touch {
12131a47014SChris Morgan		touch_rst: touch-rst {
12231a47014SChris Morgan			rockchip,pins =
12331a47014SChris Morgan				<4 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
12431a47014SChris Morgan		};
12531a47014SChris Morgan	};
126523adb55SChris Morgan};
127523adb55SChris Morgan
12822a91b76SChris Morgan&rk817 {
12922a91b76SChris Morgan	rk817_charger: charger {
13022a91b76SChris Morgan		monitored-battery = <&battery>;
13122a91b76SChris Morgan		rockchip,resistor-sense-micro-ohms = <10000>;
13222a91b76SChris Morgan		rockchip,sleep-enter-current-microamp = <300000>;
13322a91b76SChris Morgan		rockchip,sleep-filter-current-microamp = <100000>;
13422a91b76SChris Morgan	};
13522a91b76SChris Morgan};
13622a91b76SChris Morgan
137523adb55SChris Morgan&sdhci {
138523adb55SChris Morgan	pinctrl-0 = <&emmc_bus8>, <&emmc_clk>, <&emmc_cmd>, <&emmc_datastrobe>, <&emmc_rstnout>;
139523adb55SChris Morgan	pinctrl-names = "default";
140523adb55SChris Morgan	bus-width = <8>;
141523adb55SChris Morgan	mmc-hs200-1_8v;
142523adb55SChris Morgan	non-removable;
143523adb55SChris Morgan	vmmc-supply = <&vcc_3v3>;
144523adb55SChris Morgan	vqmmc-supply = <&vcc_1v8>;
145523adb55SChris Morgan	status = "okay";
146523adb55SChris Morgan};
147