rtc: alarm: Set power-on alarm 120 sec before actual alarm time

This will add extra buffer time for booting-up the device before
actual alarm expiration time.

Change-Id: I02cad84c394a6aab943fff37a1a0de56bb511f56
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
This commit is contained in:
Mohit Aggarwal
2013-08-14 05:07:29 -07:00
committed by Gerrit - the friendly Code Review server
parent 66f7b61399
commit 7289fdd2e0
+10
View File
@@ -25,6 +25,7 @@
#include <asm/mach/time.h>
#define ALARM_DELTA 120
#define ANDROID_ALARM_PRINT_ERROR (1U << 0)
#define ANDROID_ALARM_PRINT_INIT_STATUS (1U << 1)
#define ANDROID_ALARM_PRINT_TSET (1U << 2)
@@ -512,6 +513,15 @@ static void alarm_shutdown(struct platform_device *dev)
rtc_tm_to_time(&rtc_time, &rtc_secs);
alarm_delta = wall_time.tv_sec - rtc_secs;
alarm_time = power_on_alarm - alarm_delta;
/*
* Substract ALARM_DELTA from actual alarm time
* to powerup the device before actual alarm
* expiration.
*/
if ((alarm_time - ALARM_DELTA) > rtc_secs)
alarm_time -= ALARM_DELTA;
if (alarm_time <= rtc_secs)
goto disable_alarm;