Add support for R36S "soysauce" variant: device tree, panel overlays, and installation scripts

This commit is contained in:
Douglas Teles
2026-03-25 22:21:43 -03:00
parent f4989d5180
commit e88cc70153
6 changed files with 310 additions and 7 deletions

View File

@@ -2,6 +2,7 @@
archr,device_switch {
r33s = "rk3326-gameconsole-r33s";
r36s = "rk3326-gameconsole-r36s";
soysauce = "rk3326-gameconsole-soysauce";
rgb10x = "rk3326-powkiddy-rgb10x";
};
};

View File

@@ -0,0 +1,258 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Copyright (C) 2026 ArchR (https://github.com/archr-linux/Arch-R)
*
* Device tree for R36S "soysauce" variant (Y3506 boards).
* Hardware differences from standard R36S:
* - Panel reset GPIO: GPIO3_PB0 (standard uses GPIO3_PC0)
* - Panel enable GPIO: GPIO1_PC2 (standard has none)
* - Speaker control GPIO: GPIO3_PC4 (same pin, different function)
* - LED GPIOs: GPIO0_PA5 (red), GPIO0_PA0 (blue) on soysauce
* - No backlight-supply regulator (backlight powered directly)
* - Different panel timing parameters (varies by sub-variant)
*/
/dts-v1/;
#include "rk3326-gameconsole-r3xs.dtsi"
#include "rk3326-device-group-r36.dtsi"
/ {
model = "Game Console R36S Soysauce";
compatible = "gameconsole,soysauce", "gameconsole,r36s", "rockchip,rk3326";
archr,device_switch {
this = "soysauce";
};
/* Soysauce uses speaker amp on same GPIO as standard R36S */
spk_amp: audio-amplifier {
compatible = "simple-audio-amplifier";
enable-gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>;
pinctrl-0 = <&spk_amp_enable_h>;
pinctrl-names = "default";
sound-name-prefix = "Speaker Amp";
};
/* LED indicators (soysauce-specific) */
leds {
compatible = "gpio-leds";
led-red {
gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
label = "red";
default-state = "off";
};
led-blue {
gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>;
label = "blue";
default-state = "off";
};
};
joypad: odroidgo3-joypad {
compatible = "odroidgo3-joypad";
pwms = <&pwm0 0 200000000 0>;
pwm-names = "enable";
rumble-boost-weak = <0x0000>;
rumble-boost-strong = <0x0000>;
joypad-name = "r36s_Gamepad";
joypad-product = <0x1188>;
joypad-revision = <0x0188>;
status = "okay";
/* gpio pincontrol setup */
pinctrl-names = "default";
pinctrl-0 = <&btn_pins>;
pinctrl-1 = <&pwm0_pin>;
/* Analog mux define */
io-channel-names = "amux_adc";
io-channels = <&saradc 1>;
/* adc mux channel count */
amux-count = <4>;
/* adc mux select(a,b) gpio */
amux-a-gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>;
amux-b-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>;
/* adc mux enable gpio */
amux-en-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>;
/* adc calculate scale */
button-adc-scale = <2>;
/* adc deadzone range */
button-adc-deadzone = <64>;
button-adc-fuzz = <32>;
button-adc-flat = <32>;
abs_x-p-tuning = <200>;
abs_x-n-tuning = <200>;
abs_y-p-tuning = <200>;
abs_y-n-tuning = <200>;
abs_rx-p-tuning = <200>;
abs_rx-n-tuning = <200>;
abs_ry-p-tuning = <200>;
abs_ry-n-tuning = <200>;
/* poll device interval (ms) */
poll-interval = <10>;
/* required for R36S */
invert-absx;
invert-absy;
sw1 {
gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>;
label = "GPIO DPAD-UP";
linux,code = <BTN_DPAD_UP>;
};
sw2 {
gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>;
label = "GPIO DPAD-DOWN";
linux,code = <BTN_DPAD_DOWN>;
};
sw3 {
gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>;
label = "GPIO DPAD-LEFT";
linux,code = <BTN_DPAD_LEFT>;
};
sw4 {
gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>;
label = "GPIO DPAD-RIGHT";
linux,code = <BTN_DPAD_RIGHT>;
};
sw5 {
gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>;
label = "GPIO KEY BTN-A";
linux,code = <BTN_EAST>;
};
sw6 {
gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>;
label = "GPIO BTN-B";
linux,code = <BTN_SOUTH>;
};
sw7 {
gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>;
label = "GPIO BTN-Y";
linux,code = <BTN_WEST>;
};
sw8 {
gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>;
label = "GPIO BTN-X";
linux,code = <BTN_NORTH>;
};
sw11 {
gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>;
label = "GPIO BTN_THUMBL";
linux,code = <BTN_THUMBL>;
};
sw12 {
gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>;
label = "GPIO BTN_THUMBR";
linux,code = <BTN_THUMBR>;
};
sw13 {
gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>;
label = "GPIO BTN_FN";
linux,code = <BTN_MODE>;
};
sw15 {
gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>;
label = "GPIO TOP-LEFT";
linux,code = <BTN_TL>;
};
sw16 {
gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>;
label = "GPIO TOP-RIGHT";
linux,code = <BTN_TR>;
};
sw19 {
gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>;
label = "GPIO BTN_SELECT";
linux,code = <BTN_SELECT>;
};
sw20 {
gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
label = "GPIO TOP-RIGHT2";
linux,code = <BTN_TR2>;
};
sw21 {
gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>;
label = "GPIO TOP-LEFT2";
linux,code = <BTN_TL2>;
};
sw22 {
gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
label = "GPIO BTN_START";
linux,code = <BTN_START>;
};
};
};
/* Override sound card from r3xs.dtsi: add speaker amplifier */
/ {
rk817-sound {
simple-audio-card,aux-devs = <&spk_amp>;
simple-audio-card,routing =
"MICL", "Mic Jack",
"Headphones", "HPOL",
"Headphones", "HPOR",
"Speaker Amp INL", "SPKO";
};
};
/* Soysauce panel: different reset GPIO + additional enable GPIO */
&internal_display {
compatible = "archr,generic-dsi", "rocknix,generic-dsi";
reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>;
enable-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>;
};
&rk817_codec {
/* Soysauce has spk-ctl on GPIO3_PC4 */
spk-ctl-gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>;
};
&pinctrl {
btns {
btn_pins: btn-pins {
rockchip,pins = <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>,
<1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>,
<1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>,
<1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>,
<1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>,
<1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>,
<1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
<1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>,
<2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>,
<2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>,
<2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
<2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>,
<2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
<2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>,
<3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>,
<3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
<3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>,
<3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
speaker {
spk_amp_enable_h: spk-amp-enable-h {
rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
panel {
panel_reset: panel-reset {
rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
};
panel_enable: panel-enable {
rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
};

View File

@@ -174,6 +174,41 @@ for key in "${CLONE_ORDER[@]}"; do
generate_from_dtb "$CLONES_DIR/$dtb" "$OUTPUT_CLONE/${key}.dtbo" "" "$key"
done
#------------------------------------------------------------------------------
# Soysauce R36S panels (pre-compiled DTBs from Y3506 variants)
#------------------------------------------------------------------------------
SOYSAUCE_DIR="${ROOT_DIR}/config/archr-dts/R36S-soysauce"
OUTPUT_SOYSAUCE="${MIPI_OUT:-${ROOT_DIR}/config/mipi-generator/output}/soysauce"
mkdir -p "$OUTPUT_SOYSAUCE"
if [ -d "$SOYSAUCE_DIR" ]; then
log ""
log "=== Soysauce R36S Panel Overlays ==="
log "Source: $SOYSAUCE_DIR"
log "Output: $OUTPUT_SOYSAUCE"
log ""
declare -A SOYSAUCE_PANELS=(
[soysauce_v03_1104]="Y3506_V03_20241104/rk3326-r36s-linux.dtb"
[soysauce_v03_1210]="Y3506_v03_20241210/rk3326-r36s-linux.dtb"
[soysauce_v03_0317]="Y3506_V03_20250317/rk3326-r36s-linux.dtb"
[soysauce_v04_253x]="Y3506_V04_20250529 253x Panel 6/rk3326-r36s-linux.dtb"
[soysauce_v04_2548]="Y3506_V04_20250529 2548/rk3326-r36s-linux.dtb"
[soysauce_v05_2551]="Y3506_V05_20251215 2551/rk3326-r36s-linux.dtb"
[soysauce_v05_2601]="Y3506_V05_20251215 2601/rk3326-r36s-linux.dtb"
)
SOYSAUCE_ORDER=(soysauce_v03_1104 soysauce_v03_1210 soysauce_v03_0317
soysauce_v04_253x soysauce_v04_2548
soysauce_v05_2551 soysauce_v05_2601)
for key in "${SOYSAUCE_ORDER[@]}"; do
dtb="${SOYSAUCE_PANELS[$key]}"
log "Soysauce ${key}: ${dtb}"
generate_from_dtb "$SOYSAUCE_DIR/$dtb" "$OUTPUT_SOYSAUCE/${key}.dtbo" "" "$key"
done
fi
#------------------------------------------------------------------------------
# Summary
#------------------------------------------------------------------------------

View File

@@ -11,6 +11,7 @@
<file>rk3326-gameforce-chi</file>
<file>rk3326-magicx-xu10</file>
<file>rk3326-powkiddy-rgb10</file>
<file>rk3326-gameconsole-soysauce</file>
</original>
<clone mkimage_options="dtb,bootscr,extlinux,uboot" fdt_type="fdtdir" fdt="/dtbs/">
<file>rk3326-gameconsole-eeclone</file>

View File

@@ -120,6 +120,12 @@ makeinstall_target() {
cp -av ${FOUND_PATH}/*.dtbo "${INSTALL}/usr/share/bootloader/overlays_${sd}/" 2>/dev/null || true
fi
done
# Install soysauce panel overlays (included in original image)
if [ -d "${MIPI_OUT}/soysauce" ]; then
mkdir -p "${INSTALL}/usr/share/bootloader/overlays_soysauce"
cp -av "${MIPI_OUT}/soysauce/"*.dtbo "${INSTALL}/usr/share/bootloader/overlays_soysauce/" 2>/dev/null || true
fi
# Also install generic overlays dir (README, fallback)
find_dir_path config/overlays && cp -av ${FOUND_PATH} "${INSTALL}/usr/share/bootloader/"
}

View File

@@ -3,23 +3,25 @@
# Copyright (C) 2024 JELOS (https://github.com/JustEnoughLinuxOS)
# Copyright (C) 2026 ArchR (https://github.com/archr-linux/Arch-R)
# RK3326 (PX30) Cortex-A35 supports up to 1512MHz (Rockchip reference)
# Default scaling_max is 1416MHz, boost unlocks 1512MHz
BOOST_FILE="/sys/devices/system/cpu/cpufreq/boost"
POLICY="/sys/devices/system/cpu/cpufreq/policy0"
FREQ_1416=1416000
FREQ_1512=1512000
# Get the actual max frequency supported by hardware
MAX_FREQ=$(cat "${POLICY}/cpuinfo_max_freq" 2>/dev/null)
case $1 in
disable)
echo "0" > "${BOOST_FILE}" 2>/dev/null
echo "${FREQ_1416}" > "${POLICY}/scaling_max_freq" 2>/dev/null
echo "performance" > "${POLICY}/scaling_governor" 2>/dev/null
set_setting enable.turbo-mode 0
;;
enable)
echo "1" > "${BOOST_FILE}" 2>/dev/null
echo "${FREQ_1512}" > "${POLICY}/scaling_max_freq" 2>/dev/null
# Set governor to performance and max freq to hardware maximum
echo "performance" > "${POLICY}/scaling_governor" 2>/dev/null
if [ -n "${MAX_FREQ}" ]; then
echo "${MAX_FREQ}" > "${POLICY}/scaling_max_freq" 2>/dev/null
fi
set_setting enable.turbo-mode 1
;;
esac