Skip to content

Instantly share code, notes, and snippets.

@ginkage
Created March 3, 2026 10:29
Show Gist options
  • Select an option

  • Save ginkage/cd7befd92e9497403a2ee7b7116dcefb to your computer and use it in GitHub Desktop.

Select an option

Save ginkage/cd7befd92e9497403a2ee7b7116dcefb to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Copyright (c) 2024 StonedEdge and GinKage
*
* Based on rk3588s-radxa-cm5-io.dts
* Copyright (c) 2025 Radxa Computer (Shenzhen) Co., Ltd.
* Copyright (c) 2025 Joseph Kogut <[email protected]>
*/
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/pinctrl/rockchip.h>
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/soc/rockchip,vop2.h>
#include "rk3588s-radxa-cm5.dtsi"
/ {
model = "RetrOLED CM5";
compatible = "retroled,cm5", "radxa,cm5", "rockchip,rk3588s";
aliases {
mmc1 = &sdmmc;
};
chosen {
stdout-path = "serial2:1500000n8";
};
vcc12v_dcin: regulator-12v0 {
compatible = "regulator-fixed";
regulator-name = "vcc12v_dcin";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <12000000>;
regulator-max-microvolt = <12000000>;
};
vcc5v0_sys: regulator-5v0 {
compatible = "regulator-fixed";
regulator-name = "vcc5v0_sys";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
vin-supply = <&vcc12v_dcin>;
};
/*
* vcc_sysin feeds the on-module RK806 PMIC and CPU regulators.
* Modelled as a fixed 4V rail derived from vcc5v0_sys, matching
* the Radxa CM5 IO board design.
*/
vcc_sysin: regulator-4v0 {
compatible = "regulator-fixed";
regulator-name = "vcc_sysin";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <4000000>;
regulator-max-microvolt = <4000000>;
vin-supply = <&vcc5v0_sys>;
};
vcc3v3_sys: regulator-3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc3v3_sys";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
vin-supply = <&vcc12v_dcin>;
};
/* WiFi module power via PCIe slot */
vcc3v3_wf: regulator-3v3-wf {
compatible = "regulator-fixed";
enable-active-high;
gpio = <&gpio1 RK_PD3 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&wifi_pwr_en>;
regulator-name = "vcc3v3_wf";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
regulator-always-on;
startup-delay-us = <50000>;
vin-supply = <&vcc5v0_sys>;
};
rfkill-bt {
compatible = "rfkill-gpio";
pinctrl-names = "default";
pinctrl-0 = <&host_wake_bt_h>;
radio-type = "bluetooth";
shutdown-gpios = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>;
};
rfkill-wlan {
compatible = "rfkill-gpio";
pinctrl-names = "default";
pinctrl-0 = <&bt_reg_on_h>;
radio-type = "wlan";
shutdown-gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>;
};
fan: pwm-fan {
compatible = "pwm-fan";
#cooling-cells = <2>;
cooling-levels = <15 55 95 135 175 215 255>;
fan-supply = <&vcc5v0_sys>;
pwms = <&pwm11 0 40000 0>;
};
wm8960_mclk: wm8960-mclk {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <24000000>;
};
wm8960_sound: wm8960-sound {
status = "okay";
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,name = "wm8960-soundcard";
simple-audio-card,mclk-fs = <256>;
simple-audio-card,widgets =
"Microphone", "Mic Jack",
"Line", "Line In",
"Line", "Line Out",
"Speaker", "Speaker",
"Headphone", "Headphone Jack";
simple-audio-card,routing =
"Headphone Jack", "HP_L",
"Headphone Jack", "HP_R",
"Speaker", "SPK_LP",
"Speaker", "SPK_LN",
"LINPUT1", "Mic Jack",
"LINPUT3", "Mic Jack",
"RINPUT1", "Mic Jack",
"RINPUT2", "Mic Jack";
pinctrl-0 = <&hp_det>;
pinctrl-names = "default";
simple-audio-card,hp-det-gpio = <&gpio1 RK_PB2 GPIO_ACTIVE_LOW>;
simple-audio-card,hp-pin-name = "Headphone Jack";
sac_cpu: simple-audio-card,cpu {
sound-dai = <&i2s1_8ch>;
};
sac_codec: simple-audio-card,codec {
sound-dai = <&wm8960>;
clocks = <&wm8960_mclk>;
clock-names = "mclk";
};
};
lcd_3v3: lcd-3v3 {
compatible = "regulator-fixed";
regulator-name = "lcd_3v3";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
vin-supply = <&vcc3v3_sys>;
};
hdmi0-con {
compatible = "hdmi-connector";
type = "a";
port {
hdmi0_con_in: endpoint {
remote-endpoint = <&hdmi0_out_con>;
};
};
};
bq24292i_charger: charger {
compatible = "gpio-charger";
charger-type = "usb-sdp";
gpios = <&gpio0 RK_PC7 GPIO_ACTIVE_LOW>;
charge-status-gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&bq24292i_gpio>;
};
gpio_keys: gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&volume_keys>;
key-vol-down {
label = "volume down";
linux,code = <KEY_VOLUMEDOWN>;
gpios = <&gpio4 RK_PA6 GPIO_ACTIVE_LOW>;
};
key-vol-up {
label = "volume up";
linux,code = <KEY_VOLUMEUP>;
gpios = <&gpio1 RK_PB1 GPIO_ACTIVE_LOW>;
};
key-lid {
label = "lid";
linux,code = <SW_LID>;
linux,input-type = <EV_SW>;
gpios = <&gpio1 RK_PC6 GPIO_ACTIVE_LOW>;
};
};
gpio_poweroff: gpio-poweroff {
compatible = "gpio-poweroff";
pinctrl-names = "default";
pinctrl-0 = <&poweroff_gpio>;
gpios = <&gpio1 RK_PD5 GPIO_ACTIVE_LOW>;
};
};
&combphy0_ps {
status = "okay";
};
&combphy2_psu {
status = "okay";
};
&dp0 {
force-hpd;
status = "okay";
};
&dp0_in {
dp0_in_vp2: endpoint {
remote-endpoint = <&vp2_out_dp0>;
};
};
&dsi1 {
status = "okay";
panel@0 {
status = "okay";
compatible = "raydium,rm67199";
reg = <0>;
vdd-supply = <&lcd_3v3>;
power-supply = <&lcd_3v3>;
reset-gpios = <&gpio1 RK_PB0 GPIO_ACTIVE_LOW>;
rotation = <270>;
pinctrl-names = "default";
pinctrl-0 = <&dsi1_lcd_rst_gpio>;
dsi-lanes = <4>;
video-mode = <2>; /* non-burst mode with sync pulse */
width-mm = <68>;
height-mm = <121>;
display-timings {
native-mode = <&dsi1_timing0>;
dsi1_timing0: timing0 {
clock-frequency = <133812000>;
hactive = <1080>;
vactive = <1920>;
hfront-porch = <26>;
hsync-len = <2>;
hback-porch = <36>;
vfront-porch = <8>;
vsync-len = <4>;
vback-porch = <16>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};
port {
panel_in_dsi1: endpoint {
remote-endpoint = <&dsi1_out_panel>;
};
};
};
};
&dsi1_in {
dsi1_in_vp3: endpoint {
remote-endpoint = <&vp3_out_dsi1>;
};
};
&dsi1_out {
dsi1_out_panel: endpoint {
remote-endpoint = <&panel_in_dsi1>;
};
};
&hdmi0 {
status = "okay";
};
&hdmi0_in {
hdmi0_in_vp0: endpoint {
remote-endpoint = <&vp0_out_hdmi0>;
};
};
&hdmi0_out {
hdmi0_out_con: endpoint {
remote-endpoint = <&hdmi0_con_in>;
};
};
&hdmi0_sound {
status = "okay";
};
&hdptxphy0 {
status = "okay";
};
&i2c6 {
pinctrl-names = "default";
pinctrl-0 = <&i2c6m3_xfer>;
status = "okay";
rtc@51 {
compatible = "haoyu,hym8563";
reg = <0x51>;
#clock-cells = <0>;
clock-output-names = "rtc_32k_in";
interrupt-parent = <&gpio0>;
interrupts = <RK_PB0 IRQ_TYPE_LEVEL_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&rtc_int_l>;
wakeup-source;
};
};
&i2c7 {
pinctrl-names = "default";
pinctrl-0 = <&i2c7m2_xfer>;
status = "okay";
wm8960: wm8960@1a {
compatible = "wlf,wm8960";
reg = <0x1a>;
#sound-dai-cells = <0>;
AVDD-supply = <&vcc5v0_sys>;
DVDD-supply = <&vcc_3v3_s3>;
};
battery: battery@36 {
compatible = "maxim,max17055";
reg = <0x36>;
interrupt-parent = <&gpio1>;
interrupts = <RK_PC4 IRQ_TYPE_LEVEL_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&fuel_gauge>;
power-supplies = <&bq24292i_charger>;
maxim,rsns-microohm = <10000>;
maxim,over-heat-temp = <800>;
maxim,dead-volt = <3100>;
maxim,over-volt = <4300>;
maxim,empty-volt = <3200>;
maxim,design-cap = <7800>;
};
};
&i2c8 {
pinctrl-names = "default";
pinctrl-0 = <&i2c8m2_xfer>;
clock-frequency = <400000>;
status = "okay";
gt9886: touchscreen@5d {
compatible = "goodix,gt9886";
reg = <0x5d>;
interrupt-parent = <&gpio1>;
interrupts = <RK_PB5 IRQ_TYPE_EDGE_FALLING>;
pinctrl-names = "default";
pinctrl-0 = <&gtx8_gpio>;
goodix,irq-gpio = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>;
goodix,reset-gpio = <&gpio1 RK_PB4 GPIO_ACTIVE_HIGH>;
goodix,irq-flags = <2>;
goodix,panel-max-x = <1080>;
goodix,panel-max-y = <1920>;
goodix,panel-max-w = <255>;
};
};
&i2s1_8ch {
rockchip,playback-channels = <2>;
rockchip,capture-channels = <2>;
rockchip,i2s-tx-route = <1 0 2 3>;
rockchip,i2s-rx-route = <0 1 2 3>;
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&i2s1m0_sclk
&i2s1m0_lrck
&i2s1m0_sdi0
&i2s1m0_sdo1>;
status = "okay";
};
&i2s5_8ch {
status = "okay";
};
&mipidcphy1 {
status = "okay";
};
&package_thermal {
polling-delay = <1000>;
trips {
package_fan0: package-fan0 {
hysteresis = <2000>;
temperature = <55000>;
type = "active";
};
package_fan1: package-fan1 {
hysteresis = <2000>;
temperature = <65000>;
type = "active";
};
package_fan2: package-fan2 {
hysteresis = <2000>;
temperature = <75000>;
type = "active";
};
};
cooling-maps {
map0 {
cooling-device = <&fan THERMAL_NO_LIMIT 2>;
trip = <&package_fan0>;
};
map1 {
cooling-device = <&fan 3 5>;
trip = <&package_fan1>;
};
map2 {
cooling-device = <&fan 6 THERMAL_NO_LIMIT>;
trip = <&package_fan2>;
};
};
};
&pcie2x1l2 {
pinctrl-names = "default";
pinctrl-0 = <&pcie20x1_2_perstn_m0>;
reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>;
vpcie3v3-supply = <&vcc3v3_wf>;
status = "okay";
};
&pinctrl {
bq24292i {
bq24292i_gpio: bq24292i-gpio {
rockchip,pins =
<0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_up>,
<1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
dsi1-lcd {
dsi1_lcd_rst_gpio: dsi1-lcd-rst-gpio {
rockchip,pins = <1 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
gauge {
fuel_gauge: fuel-gauge {
rockchip,pins = <1 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
gpio-key {
volume_keys: volume-keys {
rockchip,pins =
<4 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
<1 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>,
<1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
gtx8 {
gtx8_gpio: gtx8-gpio {
rockchip,pins =
<1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>,
<1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
headphone {
hp_det: hp-det {
rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
pcie {
pcie20x1_2_perstn_m0: pcie20x1-2-perstn-m0 {
rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
};
wifi_pwr_en: wifi-pwr-en {
rockchip,pins = <1 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
poweroff {
poweroff_gpio: poweroff-gpio {
rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
rfkill {
bt_reg_on_h: bt-reg-on-h {
rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_down>;
};
host_wake_bt_h: host-wake-bt-h {
rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>;
};
};
rtc {
rtc_int_l: rtc-int-l {
rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
};
&pwm11 {
pinctrl-names = "default";
pinctrl-0 = <&pwm11m3_pins>;
status = "okay";
};
&sdmmc {
bus-width = <4>;
cap-mmc-highspeed;
cap-sd-highspeed;
cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
disable-wp;
max-frequency = <200000000>;
no-sdio;
no-mmc;
pinctrl-names = "default";
pinctrl-0 = <&sdmmc_bus4 &sdmmc_clk &sdmmc_cmd>;
sd-uhs-sdr104;
vmmc-supply = <&vcc_3v3_s3>;
vqmmc-supply = <&vccio_sd_s0>;
status = "okay";
};
&u2phy0 {
status = "okay";
};
&u2phy0_otg {
status = "okay";
};
&u2phy2 {
status = "okay";
};
&u2phy2_host {
phy-supply = <&vcc5v0_sys>;
status = "okay";
};
&u2phy3 {
status = "okay";
};
&u2phy3_host {
phy-supply = <&vcc5v0_sys>;
status = "okay";
};
&uart2 {
pinctrl-names = "default";
pinctrl-0 = <&uart2m0_xfer>;
status = "okay";
};
&usb_host0_ehci {
status = "okay";
};
&usb_host0_xhci {
dr_mode = "host";
status = "okay";
};
&usb_host1_ehci {
status = "okay";
};
&usb_host1_ohci {
status = "okay";
};
&usb_host2_xhci {
status = "okay";
};
&usbdp_phy0 {
status = "okay";
};
&vp0 {
vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
reg = <ROCKCHIP_VOP2_EP_HDMI0>;
remote-endpoint = <&hdmi0_in_vp0>;
};
};
&vp2 {
vp2_out_dp0: endpoint@ROCKCHIP_VOP2_EP_DP0 {
reg = <ROCKCHIP_VOP2_EP_DP0>;
remote-endpoint = <&dp0_in_vp2>;
};
};
&vp3 {
vp3_out_dsi1: endpoint@ROCKCHIP_VOP2_EP_MIPI1 {
reg = <ROCKCHIP_VOP2_EP_MIPI1>;
remote-endpoint = <&dsi1_in_vp3>;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment