Alternative suspend option for IR wakeup, when bl301 tool not possible

Some NG Amlogic boxes can’t wake from suspend by IR remote. The bl301 tool fixes this problem, but it’s not compatible with secure boot devices or encrypted bootloaders, like newer AM6+ and FireTV 2nd gen Cube.

An alternative to CE’s suspend (suspend-to-ram) is to use the suspend-to-freeze option, which is one stage above suspend-to-ram. The 2nd gen Cube uses 1.8-1.9Watts while idle, and 0.7Watts in suspend-to-idle. The IR receiver is still active in this state.

This requires using the Amlogic remote driver (remote.conf). Issuing an IR power command exits suspend-to-idle, but then the board continues to a full shutdown. So I’ve created a small script to temporarily disable shutdown after exiting suspend.

#!/bin/sh

# Disable anything that might wake from suspend early
echo disabled > /sys/devices/platform/rtc/power/wakeup
echo disabled > /sys/devices/platform/rtc/input/input1/power/wakeup

# Prevent shutdown on wakeup
systemctl mask systemd-poweroff.service

# Suspend-to-idle
echo freeze > /sys/power/state


# Commands issued on wakeup
(
# Restart Bluetooth, otherwise bluez hangs on USB BT dongle
# systemctl restart bluetooth

sleep 30
# Re-enable power-off service after wakeup
systemctl unmask systemd-poweroff.service
)&

This mostly works except a couple things like CEC Framework still restarts, adding a small delay. Using Arctic Zeyphr skin, Kodi restarts on wakeup adding some delay. There’s still room for improvement.

I’d also like to get an idea of what the power consumption is during suspend-to-idle vs suspend-to-ram, maybe it’s not much different? If anyone has a power meter and an Amlogic box (preferably NG) that can wake from CE’s default suspend state with IR, can you measure:
CE idle power consumption
CE suspend-to-ram power consumption
CE suspend-to-idle power consumption (SSH: echo freeze > /sys/power/state)

2 Likes