BeagleBone Black RTC Wake Alarms

I am trying to use power management (sleep mode) in a way that is similar to how Android does it with timerfd and epoll. I want to enable autosleep and use RTC wake timers (created using timerfd) that wake the system back up and prevent sleep mode (using epoll mechanism) until the timer event is handled and all wakelocks have been released again.

When I try using this approach, the wake timer created using timerfd does not wake the system (however, the rtcwake command does work). I’m not sure if this is supported by the BeagleBone kernel or not. I found the following code references from Linux 3.12 code, but appears to be replaced with dts and drivers/soc/ti/wkup_m3_ipc.c in Linux 3.14. Could there be something missing from arch/arm/boot/dts/am33xx.dtsi that would enable what I need?

Reference from 3.12 source:

struct wkup_m3_wakeup_src wakeups[] = {
{.irq_nr = 35, .src = “USB0_PHY”},
{.irq_nr = 36, .src = “USB1_PHY”},
{.irq_nr = 40, .src = “I2C0”},
{.irq_nr = 41, .src = “RTC Timer”},
{.irq_nr = 42, .src = “RTC Alarm”},
{.irq_nr = 43, .src = “Timer0”},
{.irq_nr = 44, .src = “Timer1”},
{.irq_nr = 45, .src = “UART”},
{.irq_nr = 46, .src = “GPIO0”},
{.irq_nr = 48, .src = “MPU_WAKE”},
{.irq_nr = 49, .src = “WDT0”},
{.irq_nr = 50, .src = “WDT1”},
{.irq_nr = 51, .src = “ADC_TSC”},
{.irq_nr = 0, .src = “Unknown”},
};

Environment

I can tell you that using kernel 4.1.x https://www.linux.com/learn/wake-linux-rtc-alarm-clock works. I’m not sure that rtc wake timer is related to the one you’re asking. However, I can tell you that once the main am335x processor loses power, or the ability to act from being in sleep mode, the RTC on the processor die will no longer function correctly. There has been some discussion on these forums about this in the past, and I do believe there was actually an errata on this as well.

drivers/soc/ti/wkup_m3_ipc.c Also from memory has nothing to do with the rtc wakeup stuff. That actually is for the PRU’s or possibly other peripherals sharing the L3 interconnect fabric on the am335x processor.

Sorry, I missed that the first time I read your post.

I am just trying to put the system in the “mem” sleep/suspend state and have a timer wake the system back up. Using the rtcwake command (and “mem” mode) does work, but when I create a timer with timerfd (instead of using the /dev/rtc0 device directly like rtcwake does) it does not work. It seems like there might be a wake source or something missing.

I am also looking for this functionnality for the kernel 3.8 or 3.14.

I discovered that a fix for the rtc-omap driver is missing in the 3.14.x-ti code. This was preventing alarmtimer and other devices from detecting rtc-omap as a valid wake-capable RTC… applying this patch fixed the issue for me.

https://lkml.org/lkml/2014/10/9/425

Just an FYI this worked for me on a BBG 4.4.68-ti-r108

$ sudo su
$ echo 0 > /sys/class/rtc/rtc0/wakealarm
$ echo date '+%s' -d '+ 1 minutes' > /sys/class/rtc/rtc0/wakealarm
$ echo standby > /sys/power/state
(shutsdown to 0.02A then wakesup on deadline or any other event…)