Commit Graph

7009 Commits

Author SHA1 Message Date
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
Douglas Teles ae837498a3 network: reconnect WiFi at boot when wifi.enabled is set
WiFi was refactored from connman to iwd (wifictl uses iwctl), but iwd is
dbus-activated and nothing re-associates it to the saved network at boot.
The result: a unit rebooted with WiFi on comes up with the ES toggle
showing active but no connection, and the user has to flip the toggle off
and on to reconnect.

The ES "Enable WiFi" toggle reconnects via `wifictl enable` (rfkill
unblock) + `wifictl connect` (scan + associate to the saved iwd profile,
ApiSystem::enableWifi). Mirror that in 099-networkservices, which already
owns the network domain at boot and runs after network.target. The
connect is backgrounded so the scan does not delay the UI, and wifictl
no-ops when there is no WiFi device.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 18:06:02 -03:00
Douglas Teles 1ba3d6ef92 perf: default CPU to 1.4 GHz, keep 1.5 GHz as an opt-in overclock
Commit e8fd3a6c43 shipped enable.turbo-mode=1 in the default system.cfg,
which makes 095-turbo-mode enable cpufreq/boost at boot, so every unit
runs the 1512 MHz turbo OPP out of the box. That turns the overclock into
the standard clock instead of an opt-in, with the thermal and battery
cost it implies.

Ship enable.turbo-mode=0 so the box defaults to the regular 1416 MHz
ceiling. The 1512 MHz OPP stays available as an overclock: the ES "Enable
CPU Overclock" switch (turbomode enable) flips cpufreq/boost on and pins
the higher OPP, and performance() honors that toggle during gameplay. The
performance governor on game launch is unchanged.

Also correct a stale runemu.sh comment that claimed performance()
unconditionally forces boost on; it follows the user's toggle now.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 17:57:26 -03:00
Douglas Teles 9d89a01d4c soysauce: wire speaker amp in DT and fix joypad controls
soysauce.dts: enable rockchip,use-ext-amplifier + spk-ctl-gpios on the
codec (drives patch 0060), set hp_det to pull-none so insertion is seen,
and bump the analog tuning 200 to 280. The Y3506 sticks only reach ~76%
of the declared range at full deflection, so partial pushes never crossed
the EmulationStation navigation threshold; the higher gain saturates the
axis and keeps menu scrolling responsive (R36S/eeclone pots reach full
range at 200, this is Y3506-specific).

Joypad userspace mapping (the analog/button wiring was never broken in
the kernel, the configs were):
- es_input.cfg: add a GO-Super Gamepad entry modelled on r36s_Gamepad,
  using leftanalog/rightanalog so both sticks navigate the menu. The old
  auto-generated entry mapped them as joystick1/joystick2, and
  joystick2up is hardcoded to volume in ViewController, so the right
  stick changed volume and the left stick did nothing.
- GO-Super Gamepad.cfg (RetroArch): the button indices were the RGB20S
  layout (select=12, start=13, dpad=8-11), which broke in-game Start,
  Select and the exit combo. Correct to the r36s layout (select=8,
  start=9, dpad=13-16, l3=11, r3=12, hotkey=8) and fix the vendor id.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 17:37:19 -03:00
Douglas Teles 36f99fec2b soysauce: speaker output via rk817 external amplifier
The R35S/Y3506 loudspeaker is not wired to the rk817 class-D SPKO; it
hangs off the analog headphone output through an external amp gated by
spk-ctl-gpios. The mainline codec routes "SPK" to the unused class-D, so
the speaker is silent. Add patch 0060 (use_ext_amplifier: route the
speaker mux through the headphone DACs and toggle spk-ctl via a DAPM
event) and the per-device audio playback paths (SPK/HP) so the speaker
plays and headphone switching works.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 17:37:19 -03:00
Douglas Teles 89ce198105 es-menu: openSystemEmulatorSettings saves emulator/core to SystemConf
The save func wrote Settings ".emulator"/".core", but SystemData::getEmulator
/getCore read them from SystemConf on non-Windows builds (and
popSystemConfigurationGui saves to SystemConf), so on Linux/ArchR the choice
was written where nothing reads it and the game launched with the default.
Match the readers' WIN32/else split. (Item is gated off on ARCHR today, but
this is a genuine cross-platform bug, not platform dead code.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 23:37:23 -03:00
Douglas Teles 5a8efc0e78 remove the dead analog-stick LED feature end to end
The "ANALOG STICKS LED COLOR" feature controlled RGB LEDs that no
ArchR-supported device has (only the unsupported R36S Ultra does), gated by
DEVICE_ANALOG_STICKS_LED_CONTROL which no device sets, backed by a dispatcher
that execs a per-device binary nothing ships -> a guaranteed no-op everywhere.

- ES (patches/0003): remove the menu entry, openAnalogSticksLedControls() +
  its declaration + include, the two CMakeLists refs, and the
  GuiAnalogSticksLedControls class.
- system-utils: drop the analog_sticks_ledcontrol dispatcher script + install.
- quirks 999-export: drop DEVICE_ANALOG_STICKS_LED_CONTROL.

If R36S Ultra support is ever added, this comes back with a real, hardware-
backed backend developed against the device.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 23:24:47 -03:00
Douglas Teles 4abec79f22 es-menu: drop dead VIDEO PREVIEWS / VRR toggles, warn on overlay-reset reboot
From the ES menu audit:
- SHOW VIDEO PREVIEWS (UI) toggled Settings "EnableVideoPreviews", consumed
  nowhere. Dead toggle removed.
- VARIABLE REFRESH RATE (Latency) toggled <config>.vrr_runloop_enable, read by
  no launch script and meaningless on the fixed RK3326 panel. Dead toggle
  removed.
- RESET OVERLAYS / FULLY RESET RETROARCH reboot the device (factoryreset
  overlays -> systemctl reboot) without warning; their confirmation text now
  says "THE DEVICE WILL REBOOT."

Second patch under this package's patches/. Pending validation: takes effect
after the ES package is rebuilt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 23:10:41 -03:00