LINUX RTC
Setting the RTC
If a wrong declaration is present the hwclock command will fail.
First set the system date & time:
# date --set="20171231 23:59"
Then set the HW RTC using the system date & time:
# hwclock --systohc --utc
Power down your board, wait 5 minutes and power up again, then check you system date & time and verify it is correct:
# date
Wakeup using the RTC
All Variscite EVKs mount RTC ISL12057, however wakeup using the RTC requires hardware connection of ISL12057 IRQ2# pin to a SoC GPIO.
By default, the defconfig of latest kernels already enable the Intersil ISL12057 driver.
The kernel configuration item is available in Device Drivers -> Real Time Clock -> <*> Intersil ISL12057.
Using rtcwake command
Assuming the your board implement RTC wakeup capabilities, ensure RTC and system time are synchronized
# hwclock -w
then set the RTC to wakeup after 10 seconds type:
# echo enabled > /sys/class/rtc/rtc0/device/power/wakeup # echo `date "+%s" -d "+ 10 seconds"` > /sys/class/rtc/rtc0/wakealarm
and immediately suspend the machine
# pm-suspend