Commit Graph

7016 Commits

Author SHA1 Message Date
Douglas Teles 205c5bccb3 sleep: default RK3326 to s2idle, preserve ALSA and governor state
Suspend on the R36S family hangs because the shipped sleep.conf orders
SuspendState as "mem standby freeze" and px30 mainline has no working
S3, so the kernel commits to a state it cannot leave. Ship
SuspendState=freeze on RK3326; the power button is the rk817 PMIC
pwrkey, which every board DTS already marks wakeup-source, and logind
already routes HandlePowerKey=suspend through systemd-sleep into this
hook.

Borrow the state discipline from the dArkOS sleep hooks: blank the
backlight before the kernel path runs, snapshot the full mixer state
with alsactl (the rk817 can lose its routing across s2idle and the
existing restore only re-set the master volume), and save/restore the
cpu/gpu/dmc governors. dwc2 reload on resume was already covered by
modules.bad.

Untested on hardware: needs a device check that s2idle enters (screen
and audio off), the pwrkey wakes it, and audio routing plus USB gadget
survive the round trip.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 18:28:53 -03:00
Douglas Teles 8aacf5c823 headphone_sense: sync the startup path with the real jack switch state
The boot-time probe read a legacy /sys/class/gpio number that mainline
kernels never expose, so the initial audio path was always the speaker
guess and a reboot with headphones plugged started routed wrong. Query
the actual EV_SW/SW_HEADPHONE_INSERT bit through evtest --query (exit
10 = bit set; on these boards the switch is inverted, value 0 means
inserted) with the legacy gpio node as fallback, make an empty "$2"
follow the detected state instead of forcing speakers, and bail out
before the event loop when the board has no jack input device at all
(evtest on an empty path just dies and burns service restarts).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 18:27:14 -03:00
Douglas Teles bd6fb8d0a9 gamecontrollerdb: add the Soysauce GO-Super Gamepad SDL mapping
SDL-based games and ports never recognized the Soysauce pad because
gamecontrollerdb.txt only knew r36s_Gamepad; RetroArch and ES have
their own configs, which is why "some games" needed manual input setup
(Reddit report on the 2.0 thread). GUID derived the same way SDL does:
bus 0x19 (host), crc16 of the device name (verified against the
r36s_Gamepad entry), vendor 0, product 0x1100, version 0x0100 from the
DTS; the button/axis layout matches the r36s entry, which is the same
physical layout the validated RetroArch config already uses.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 17:30:48 -03:00
Douglas Teles 0be7aab31b emulationstation: default power LED selection to on, matching boot
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 17:03:08 -03:00
Douglas Teles df92325273 RK3326: fix the shipped-but-broken v2.0 fixes for issues #19 and #35
Issue #19 (RTL8188EUS dongle can scan but never authenticates): the
udev swap rule shipped in v2.0 was structurally a no-op. It matched
the usb_device add event and echoed the device name ("1-1") into
rtl8xxxu's unbind node, but USB drivers bind to the interface
("1-1:1.0"), and at usb_device add time nothing is bound yet anyway;
the follow-up modprobe never rebinds an interface the in-tree driver
already claimed. Users confirmed the auth failure survived into the
release. Rewrite the rule to match the usb_interface event, where the
kernel has already finished its synchronous bind, and deterministically
move the interface: unbind from rtl8xxxu (no-op if it lost the probe
race) and write it into 8188eu's bind node via udev's own %k
substitution (no shell $$ escaping to get wrong).

Issue #35 (R36S Clone V20 speaker silent, headphones fine): the V20-era
clone boards route the speaker through the external amplifier exactly
like the Soysauce (the eeclone DTS already ships rk817-sound-amplified)
but the R36S Clone quirk never exported the playback mux paths nor the
jack input device. Reporters on the issue validated this exact config
by hand-editing the quirk. Also fix headphone_sense: every amixer cset
passed the control name unquoted, so names with spaces ("Playback Mux")
split into two arguments and the call failed; and the boot-time jack
probe read a legacy /sys/class/gpio node that mainline kernels don't
expose, now guarded with a speaker-path default.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 16:18:39 -03:00
Douglas Teles 4385a37cbf RK3326: fix Soysauce power LED polarity, surface DISABLE POWER LED
Live debugging on the Soysauce (USB SSH, watcher on the led sysfs while
the user drove the ES menu) showed the whole chain working but the LED
responding inverted: the blue power LED is wired active high, so the
GPIO_ACTIVE_LOW in the DTS made "off" light it and "on" darken it
(heartbeat looked normal because a blink is a blink upside down). Flip
the polarity and default the LED on so early boot keeps the stock look.
The led-red node was a phantom: the physical red LED belongs to the
charger IC and toggling GPIO0_A5 changes nothing, so drop it.

The DISABLE POWER LED switch in ES is gated on DEVICE_PWR_LED_CONTROL,
which sits in the 999-export allowlist but was never set by any quirk,
so the item was invisible on every device. Set it for the R36S family.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 15:42:40 -03:00
Douglas Teles 413b62304b RK3326: describe the R36S/R33S power LED so the ES menu can drive it
The power LED menu never worked on the R36S Original and Clone because
nothing consumes the old JELOS quirk vars on mainline: 002-disable-led
and battery_led_status poke BSP gpio numbers (gpio77) through the
legacy /sys/class/gpio interface that no longer exists, and the R36S
DTB did not describe the LED at all.

Describe the hardware in the DTS instead. The R36S Original has a
bicolor power LED behind a single line (GPIO2_B5, BSP gpio77): high is
red, low is the green side, high impedance lights both halves orange,
so there is no hardware off; exposed as red:status. The R33S has a mono
blue active-low LED on the same pin (the old quirk wrote 1 to disable
it), exposed as blue:status with true off. The Clone already had proper
LED nodes; its sysfs name is blue:power (color:function, no label).

Point DEVICE_POWER_LED at the right sysfs name per device so
batocera-gameforce (POWER LED COLOR and DISABLE POWER LED paths) finds
the LED, and drop the dead 002-disable-led quirks. On the Original,
"off" shows the stock steady green and "on" shows red; heartbeat pulses
between the two colors.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 23:58:41 -03:00
Douglas Teles 5c5dcd3c4a rkbin: retry the RK3326 TPL DDR frequency at 666MHz
The boot-loop investigation exonerated everything except the original
786MHz TPL: a full hardware bisect (no patches, 024 only, 0026 only,
both) booted every combination at 333MHz with byte-verified TPL
signatures inside the images, which means the earlier "666 and 333 also
fail" results came from flashing stale copies of the 786 image. 666MHz
therefore goes back in for a clean, checksum-verified hardware test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 23:28:12 -03:00
Douglas Teles a30e6ea7f5 emulationstation: fix clipped Internet Status, wire DISABLE POWER LED
Bump to the ES fork fix: the async INTERNET STATUS row now reserves the
cell for the widest value so NOT CONNECTED no longer clips, and the
DISABLE POWER LED switch actually drives the LED (it used to write a
conf key nothing consumed). 096-powerled honours powerled.disabled at
boot so the choice survives a restart.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 23:28:12 -03:00
Douglas Teles d652e2d7bd rkbin: drop the RK3326 TPL DDR frequency to 666MHz
786MHz failed the hardware boot test on the Soysauce: the screen lights
and the SoC resets in a loop before U-Boot, meaning the TPL DDR
training does not converge at that speed on these chips (dArkOS only
reaches 786 via the BSP dmc driver's runtime retraining, which is
gentler than a fixed cold init). 666MHz keeps twice the bandwidth of
the old 333MHz baseline; 528 (dArkOS's powersave floor) is the next
step down if any board still fails.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 20:48:07 -03:00
Douglas Teles 39e4a5ebcf rkbin: fix sed delimiter clashing with the alternation pipes
The frequency rewrite used | both as the sed delimiter and inside the
group alternation, so post_unpack failed and the previous build shipped
no images. Use # as the delimiter; verified against the generated
parameter dump (all five freq fields now rewrite to 786).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 23:02:56 -03:00
Douglas Teles 6794a56987 RK3326: gameplay priority and RetroArch tuning from the dArkOS analysis
- Launch emulators at nice -19 like dArkOS does; with the full-preempt
  kernel this keeps frame pacing stable when background work wakes up
  mid-frame.
- audio_latency 64 to 128, matching dArkOS on the same alsathread
  driver and hardware: the 64ms buffer underruns audibly on heavy
  cores, which users read as instability.
- fastforward_frameskip on: skip rendering during fast-forward and give
  the GPU time back to the core.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 22:59:19 -03:00
Douglas Teles d80eb6c482 RK3326: raise the TPL DDR frequency from 333MHz to 786MHz
The performance gap users report against dArkOS ("more FPS, more
stable") is dominated by memory bandwidth. Our TPL blob initialises
every DDR type at 333MHz (verified via ddrbin_tool -g: lp2/ddr3/lp3/
ddr4/lp4 all 333) and mainline has no px30 dmc driver, so the memory
never leaves 333MHz. dArkOS runs the BSP dmc_ondemand governor, which
scales the same boards up to the 786MHz ceiling of the vendor R36S DTB
dmc table (528/666/786, verified by decompiling their shipped DTB), and
even its powersave mode pins 528MHz: their WORST case has 60% more
memory bandwidth than our best.

Rewrite the frequency fields inside the TPL with Rockchip's ddrbin_tool
(the long-standing ArkOS "DDR fix") so DDR comes up at 786MHz from
boot, for both the standard and the UART5 clone TPL variants. Override
with RK3326_DDR_FREQ=666 if a board proves unstable.

MUST be boot-tested on hardware before any release: a board whose DDR
cannot run 786MHz will hang in the TPL before U-Boot even starts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 22:59:19 -03:00
Douglas Teles 235f113c25 fs-resize: gate resize2fs on fsck, fix sd* boot partition name, explain warnings
Analysis of a first-boot resize log (docs/resize.log):

- The two FAT warnings it records are expected and harmless. The 256MB
  boot partition ships the same out-of-spec FAT32 (16375 clusters, below
  the 65525 minimum) as ROCKNIX and the rest of the RK3326 ecosystem;
  vendor U-Boots are only tested against that layout, so reformatting it
  is exactly the change that has caused boot loops before. The
  boot-sector/backup difference is the kernel vfat dirty flag, written
  to the primary sector only while /flash is mounted read-write; the
  shipped image was verified to carry identical primary and backup
  sectors. The script now appends a NOTE to the log so the warnings stop
  being reported as failures.

Real defects fixed:

- resize2fs ran regardless of the e2fsck result; on unfixed corruption
  (exit above 2) growing the filesystem would compound the damage. The
  resize is now skipped in that case, leaving the grown partition for a
  later retry after a manual fsck.
- The boot-partition path was hardcoded as ${DISK}p1, which is wrong for
  /dev/sdX disks (sdXp1 does not exist), so the FAT serial
  randomization silently never ran there. Derive the partition name per
  device type alongside DISK.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 22:39:12 -03:00
Douglas Teles 1d892b9231 emulationstation: bump for the enumeration pre-warm
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 22:02:06 -03:00
Douglas Teles 3cd958e549 es-menu: provide the missing set-audio, power LED and resolution backends
Three ES menu backends did not exist on ArchR, so the menus silently did
nothing and every ES start logged "command not found":

- set-audio (AUDIO OUTPUT menu): implemented for PipeWire via wpctl
  (list/get/set validated on hardware); card profiles are not exposed,
  so the profile row hides itself.
- batocera-gameforce (POWER LED COLOR menu): drives the gpio-led power
  indicator (blue by default, DEVICE_POWER_LED overrides; the red LED
  remains the charging indicator owned by powerstate). heartbeat/on/off
  validated on the Soysauce. A new 096-powerled autostart replays the
  persisted choice at boot.
- archr-resolution (archr-config lsoutputs): lists connected DRM
  connectors.

emulationstation: bump for the enhanced PowerSaver default (idle menu
CPU measured 25% to 10% on hardware).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 21:51:32 -03:00
Douglas Teles 6a66a44a8e emulationstation: bump for the binary gamelist cache
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 21:14:48 -03:00
Douglas Teles fd304683a3 emulationstation: async settings menus, drop phantom boost dep, enable LTO
Bump to 37f12a02d, which moves every synchronous shell call out of the
settings-menu UI thread (the network menu ping alone could freeze the
interface for six seconds; audio, bluetooth, overclock, overscan,
storage and the ad-hoc WiFi path all stalled the render loop).

boost was listed in PKG_DEPENDS_TARGET but nothing in the source
includes or links it; drop the phantom dependency. Enable LTO for a
smaller, cache-friendlier binary on the A35.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 20:56:41 -03:00
Douglas Teles 492a61eee2 wifi: free the USB OTG port when WiFi is off (internal-WiFi mux boards)
Some clones (XiFan R36Max2 family) wire the internal USB WiFi module to
the same OTG data lines as the physical USB port through a hardware mux
gpio: WiFi and the port are mutually exclusive, and users report that on
the stock OS disabling WiFi brings the port back.

Port ROCKNIX's 0026 USB2 PHY patch, which reads switch-gpios from the
otg-port node and exposes usb_switch_gpio / usb_switch_ext in sysfs
(boot default: internal WiFi). ROCKNIX itself never toggles the mux from
userspace, so the physical port stays dead there; wire it to our WiFi
toggle instead: wifictl enable routes the mux to the internal module,
wifictl disable flips it to the external port and powers its vbus. The
sysfs writes are no-ops on boards without the mux, and the patch is
inert unless the generated overlay (USBMUX hardware variant on the site)
adds switch-gpios to the PHY.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 20:32:04 -03:00
Douglas Teles 94d26a87fd RK3326: drop the dedicated r36tmax DTS, deliver it via overlay instead
ArchR does not ship per-board device trees: the base DTB stays generic
and board specifics come from the generated overlay. The r36tmax.dts
ported from ROCKNIX baked panel, joypad and SDIO WiFi into a dedicated
tree, against that architecture.

The overlay path is verified feasible for the one genuinely new surface
(the rk912/rk915 SDIO WiFi): runtime overlays cannot delete properties,
but mmc_of_parse performs no card-detection setup at all when
"non-removable" is present (host.c "Parse Card Detection"), so an
overlay can neutralize the clone base's second-SD-slot cd-gpios on
&sdio and repurpose the controller for the WiFi module (pwrseq node,
supports-rk912, sdio caps). That fragment moves to the web overlay
generator; the rk915 driver and the supports-rk912 kernel patch stay in
the OS image since they are generic and inert without the DT properties.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 20:24:59 -03:00
Douglas Teles 88647c6e07 RK3326: build and ship the r36tmax DTB in the clone image
The kernel make target and the /dtbs/ payload come from the config.xml
device file list, not from the kernel Makefile registration alone, so
the new rk3326-aislpc-r36tmax.dts was compiled into nothing. List it
under the clone subdevice: the R36T Max flashes the clone image and
selects the DTB via the extlinux FDT line, like the soysauce does on
the original image.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 20:15:49 -03:00
Douglas Teles 9de9224f80 archr: day-resolution PKG_VERSION, seconds broke image assembly
The build system re-evaluates package.mk on every step and derives
PKG_INSTALL from PKG_NAME-PKG_VERSION. With the seconds-resolution
timestamp introduced in 9ff72420c6 the build and install steps computed
different versions, so scripts/install silently skipped a PKG_INSTALL
directory that did not exist and image assembly died in post_install
("sed: can't read .../system.cfg"). Use the build day instead: stable
across the steps of one build, still bumps per release so pacman ships
archr updates.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 20:06:21 -03:00
Douglas Teles 45dd6ff144 wifi: robust dongle connects and visible feedback while connecting
Bug report 1: an Edimax USB dongle sees the network but the connect
fails with a generic error (works on dArkOS). Bug report 4: pressing B
after typing the passphrase looks like a freeze while the console is
silently trying to connect.

wifictl: scan until the target SSID actually shows up in iwd's results
(up to 12s) instead of a fixed 2s sleep; slow USB dongles were reaching
iwctl connect before the network existed in the scan cache, which fails
immediately. Extend the association wait from 15s to 30s and log the
real iwctl connect output plus the outcome to /var/log/wifictl.log so
failures (wrong passphrase, WPA1/TKIP networks that iwd does not
support, timeouts) stop being an indistinguishable "network error".

emulationstation: bump to 8a257e1fa, which wraps both WiFi connect call
sites in a GuiLoading busy spinner instead of blocking the UI thread.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 20:01:01 -03:00
Douglas Teles a738af646b RK3326: support the R36T Max internal SDIO WiFi (rk912/rk915)
Users reported the R36T Max clone does not even scan for networks on the
2.0 clone image while the stock OS and Aurknix work (bug report 2). The
R36T Max internal WiFi is an rk912/rk915 SDIO module, which the clone
image had no driver, no DTS wiring and no SDIO quirks for. Port the
working support from ROCKNIX/Aurknix:

- rk915 driver package (AveyondFly/rk915, WiFi/BT SDIO), added to
  ADDITIONAL_DRIVERS.
- 024-mainline-linux-hacks-for-rk915.patch: MMC_CAP2_WIFI_RK912 cap
  behind the supports-rk912 DT property; bypasses the SDIO CIS size
  check and power cycling that break this module's initialization.
- rk3326-aislpc-r36tmax.dts: dedicated device tree (sdio_pwrseq, sdio
  node with supports-rk912, correct joypad wiring including the analog
  stick inversion users hit on the generic clone DTB). Adapted to the
  archr-singleadc-joypad and archr,generic-dsi compatibles.
- Temperature sensor quirk for the "AISLPC R36TMax" model string.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 20:01:01 -03:00
Douglas Teles 9ff72420c6 repo: make local-overlay and meta packages deliver pacman updates
The pacman update channel silently dropped most local changes:

- gen-pacman-repo hardcoded pkgrel=1, ignoring PKG_REV. A package whose
  upstream PKG_VERSION is pinned (e.g. retroarch-joypads, where only the
  local gamepads/ overlay changes) could never produce a newer package,
  so `pacman -Syu` never saw the fix. Read PKG_REV and map it to the repo
  package release (default 1 when unset or dynamic).

- the archr meta package had PKG_VERSION="", so its install_pkg dir was
  "archr-" and the synthesized version was the constant "archr.". The
  main system-config package (system.cfg, runemu, wifictl, governors,
  networkservices) therefore never updated. Stamp it with the build
  timestamp so each rebuild ships a real, monotonically increasing
  version.

- bump retroarch-joypads PKG_REV to 2 so the corrected GO-Super Gamepad
  autoconfig ships as an update.

The kernel/DTB stays out of pacman on purpose: it lives on the FAT boot
partition, which pacman does not manage, so kernel changes ship by image
flash.
2026-06-30 16:47:29 -03:00