Files
Arch-R/projects/ArchR/packages/sysutils/sleep/package.mk
T
Douglas Teles 34b76db065 RK3326: default to fake-suspend, kernel suspend proven unwakeable
Hardware test on the Soysauce (2026-07-07) killed both kernel suspend
paths: SuspendState=mem hangs on entry and freeze (s2idle) enters but
never wakes, not even from an armed RTC alarm with every wakeup source
enabled (PMIC pwrkey, rk817 i2c and rtc0 all report enabled). Real
debugging needs UART on the pads.

Make the power button useful instead of a lockup: ship the RK3326
sleep.conf with AllowSuspend=no so logind's HandlePowerKey=suspend
becomes a no-op, and seed system.suspendmode=off through a platform
030-suspend_mode quirk so the archr-fake-suspend path (already wired
to the power key via input_sense) stops exiting early. The quirk also
serves the "default" choice of the ES SUSPEND MODE menu, and on boot
it repairs pacman-upgraded installs whose storage still carries the
old mem-first sleep.conf. Users can still opt in to real suspend
through the same menu (the suspendmode script rewrites the conf with
AllowSuspend=yes), and the sleep.sh state-preservation hooks stay in
place for the day s2idle works.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 19:20:16 -03:00

35 lines
1.4 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
PKG_NAME="sleep"
PKG_VERSION=""
PKG_LICENSE="OSS"
PKG_DEPENDS_TARGET="systemd"
PKG_SITE=""
PKG_URL=""
PKG_LONGDESC="Sleep configuration"
PKG_TOOLCHAIN="manual"
makeinstall_target() {
mkdir -p ${INSTALL}/usr/config/sleep.conf.d
cp sleep.conf ${INSTALL}/usr/config/sleep.conf.d/sleep.conf
if [ "${DEVICE}" = "RK3326" ]; then
# px30 mainline has no working kernel suspend at all: "mem" hangs
# on entry and "freeze" (s2idle) enters but never wakes, not even
# from an armed RTC alarm (tested 2026-07-07 on the Soysauce with
# every wakeup source enabled; real debugging needs UART). Inhibit
# real suspend by default so the power button falls through to
# archr-fake-suspend; the ES SUSPEND MODE menu rewrites this file
# via the suspendmode script, so advanced users can still opt in
# to experiment. Keep freeze first for that case: it is the least
# bad state on this SoC.
sed -i 's/^AllowSuspend=.*/AllowSuspend=no/' ${INSTALL}/usr/config/sleep.conf.d/sleep.conf
sed -i 's/^SuspendState=.*/SuspendState=freeze/' ${INSTALL}/usr/config/sleep.conf.d/sleep.conf
fi
cp modules.bad ${INSTALL}/usr/config
mkdir -p ${INSTALL}/usr/lib/systemd/system-sleep/
cp sleep.sh ${INSTALL}/usr/lib/systemd/system-sleep/sleep
chmod +x ${INSTALL}/usr/lib/systemd/system-sleep/sleep
}