summaryrefslogtreecommitdiff
path: root/firmware/drivers/rtc/rtc_s35390a.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2017-01-25 19:32:15 -0500
committerMichael Sevakis <jethead71@rockbox.org>2017-01-26 23:07:49 -0500
commit58b849c451ac1281c14bfc535ab7f411a0b736e0 (patch)
tree035026a62581900f72fa0d90bd694a8a92372c00 /firmware/drivers/rtc/rtc_s35390a.c
parent783c77531c35e62dd754c510c4f2beefe6df4a9d (diff)
downloadrockbox-58b849c451ac1281c14bfc535ab7f411a0b736e0.tar.gz
rockbox-58b849c451ac1281c14bfc535ab7f411a0b736e0.zip
Move intrinsic RTC implmentation differences to driver files
Some drivers set tm_wday just fine and do not need it coerced to be correct. Others set tm_yday, so don't overwrite what the driver sets; just zero it inside if it can't fill the field. Move calls to set_day_of_week() to the sorts of drivers that presumably required the hammer (FS#11814) in get_time() where the weekday isn't locked to the date. Change-Id: Idd0ded6bfc9d9f48fcc1a6074068164c42fcf24a
Diffstat (limited to 'firmware/drivers/rtc/rtc_s35390a.c')
-rw-r--r--firmware/drivers/rtc/rtc_s35390a.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/firmware/drivers/rtc/rtc_s35390a.c b/firmware/drivers/rtc/rtc_s35390a.c
index 13027d31a2..b82029a114 100644
--- a/firmware/drivers/rtc/rtc_s35390a.c
+++ b/firmware/drivers/rtc/rtc_s35390a.c
@@ -22,6 +22,7 @@
22#include "config.h" 22#include "config.h"
23#include "rtc.h" 23#include "rtc.h"
24#include "i2c-s5l8700.h" 24#include "i2c-s5l8700.h"
25#include "timefuncs.h"
25 26
26/* Driver for the Seiko S35390A real-time clock chip with i2c interface 27/* Driver for the Seiko S35390A real-time clock chip with i2c interface
27 28
@@ -75,10 +76,12 @@ int rtc_read_datetime(struct tm *tm)
75 tm->tm_sec = buf[6]; 76 tm->tm_sec = buf[6];
76 tm->tm_min = buf[5]; 77 tm->tm_min = buf[5];
77 tm->tm_hour = buf[4]; 78 tm->tm_hour = buf[4];
78 tm->tm_wday = buf[3];
79 tm->tm_mday = buf[2]; 79 tm->tm_mday = buf[2];
80 tm->tm_mon = buf[1] - 1; 80 tm->tm_mon = buf[1] - 1;
81 tm->tm_year = buf[0] + 100; 81 tm->tm_year = buf[0] + 100;
82 tm->tm_yday = 0; /* Not implemented for now */
83
84 set_day_of_week(tm);
82 85
83 return ret; 86 return ret;
84} 87}