diff options
| author | Simon Wilson <simonwilson@google.com> | 2014-03-19 15:23:29 -0700 |
|---|---|---|
| committer | Simon Wilson <simonwilson@google.com> | 2014-03-19 15:23:32 -0700 |
| commit | 6dc19f1009dee8f225bcefc07d1f87b9edc9ccf5 (patch) | |
| tree | 7dab8a8c5e71f6f8e85ed39e71d05238d9df2077 | |
| parent | aca5c9460f0f5faeb050981ab54d0f8a7a30e22c (diff) | |
| download | olio-linux-3.10-6dc19f1009dee8f225bcefc07d1f87b9edc9ccf5.tar.xz olio-linux-3.10-6dc19f1009dee8f225bcefc07d1f87b9edc9ccf5.zip | |
rtc: rtc-sensorhub: use ANDROID_EPOCH as the earliest RTC time
Android requires the earliest time returned by the RTC to
be ANDROID_EPOCH.
Change-Id: I8b37a73426de285699bef080a43a52ee923bfed8
Signed-off-by: Simon Wilson <simonwilson@google.com>
| -rw-r--r-- | drivers/rtc/rtc-sensorhub.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-sensorhub.c b/drivers/rtc/rtc-sensorhub.c index 92e19700c3b..b403c39b065 100644 --- a/drivers/rtc/rtc-sensorhub.c +++ b/drivers/rtc/rtc-sensorhub.c @@ -21,6 +21,8 @@ #define SECONDS_IN_DAY (24*60*60) #define DRIVER_NAME "rtc-sensorhub" +#define ANDROID_EPOCH 1227312001 + struct rtc_sensorhub_private_data { struct rtc_device *p_rtc; struct m4sensorhub_data *p_m4sensorhub_data; @@ -152,6 +154,8 @@ static int rtc_sensorhub_get_rtc_from_m4(struct rtc_time *p_tm, return -EIO; } + if (seconds < ANDROID_EPOCH) + seconds = ANDROID_EPOCH; rtc_time_to_tm(seconds, p_tm); return 0; } @@ -167,8 +171,8 @@ static int rtc_sensorhub_rtc_read_time(struct device *p_dev, if (!(p_priv_data->p_m4sensorhub_data)) { dev_err(p_dev, "read time, but RTC hardware not ready\n"); /* M4 driver is not yet ready, just give the time since boot - and treat boot as start of epoch */ - rtc_time_to_tm(get_seconds(), p_tm); + and treat boot as start of ANDROID_EPOCH */ + rtc_time_to_tm(ANDROID_EPOCH + get_seconds(), p_tm); return 0; } |