Orange Pi Zero: Enable crust and fix suspend/resume (#6007)

* Fix system doesnt come back from sleep because of xradio_wlan module

Add workaround for getting suspend resume to work properly. This works by unloading
xradio_wlan module on suspend and reloading the same on system resume. Tested by putting
system to sleep for 20 seconds and bringing it back up via rtc wakealarm using the
following command

echo +20 > /sys/class/rtc/rtc0/wakealarm && systemctl suspend

The rtcwake still causes the system to hang on resume, but atleast systemctl suspend works.

* Enable crust for Orange Pi Zero
This commit is contained in:
Gunjan Gupta
2023-12-05 17:19:13 +05:30
committed by GitHub
parent e4d51f340b
commit 038ca467d5

View File

@@ -11,3 +11,44 @@ HAS_VIDEO_OUTPUT="yes"
SERIALCON="ttyS0,ttyGS0"
KERNEL_TARGET="legacy,current,edge"
KERNEL_TEST_TARGET="current"
CRUSTCONFIG="orangepi_zero_defconfig"
function orange_pi_zero_enable_xradio_workarounds() {
/usr/bin/systemctl enable xradio_unload.service
/usr/bin/systemctl enable xradio_reload.service
}
function post_family_tweaks_bsp__fix_resume_after_suspend() {
# Adding systemd services to remove and reload xradio module on suspend and resume
# respectively. It will fix suspend resume using systemctl suspend, but rtcwake is
# still be broken.
run_host_command_logged cat <<- 'xradio_unload' > "${destination}"/etc/systemd/system/xradio_unload.service
[Unit]
Description=Unload xradio module on sleep
Before=sleep.target
[Service]
Type=simple
ExecStart=-/usr/sbin/rmmod xradio_wlan
[Install]
WantedBy=sleep.target
xradio_unload
run_host_command_logged cat <<- 'xradio_reload' > "${destination}"/etc/systemd/system/xradio_reload.service
[Unit]
Description=Reload xradio module on resume
After=suspend.target
[Service]
Type=simple
ExecStart=-/usr/sbin/modprobe xradio_wlan
[Install]
WantedBy=suspend.target
xradio_reload
# Enable workaround on apt upgrade of armbian-bsp-cli package
postinst_functions+=('orange_pi_zero_enable_xradio_workarounds')
}