Lines Matching defs:tm

130 static int s3c_rtc_read_time(struct s3c_rtc *info, struct rtc_time *tm)
140 tm->tm_min = readb(info->base + S3C2410_RTCMIN);
141 tm->tm_hour = readb(info->base + S3C2410_RTCHOUR);
142 tm->tm_mday = readb(info->base + S3C2410_RTCDATE);
143 tm->tm_mon = readb(info->base + S3C2410_RTCMON);
144 tm->tm_year = readb(info->base + S3C2410_RTCYEAR);
145 tm->tm_sec = readb(info->base + S3C2410_RTCSEC);
152 if (tm->tm_sec == 0 && !have_retried) {
159 tm->tm_sec = bcd2bin(tm->tm_sec);
160 tm->tm_min = bcd2bin(tm->tm_min);
161 tm->tm_hour = bcd2bin(tm->tm_hour);
162 tm->tm_mday = bcd2bin(tm->tm_mday);
163 tm->tm_mon = bcd2bin(tm->tm_mon);
164 tm->tm_year = bcd2bin(tm->tm_year);
170 static int s3c_rtc_write_time(struct s3c_rtc *info, const struct rtc_time *tm)
178 writeb(bin2bcd(tm->tm_sec), info->base + S3C2410_RTCSEC);
179 writeb(bin2bcd(tm->tm_min), info->base + S3C2410_RTCMIN);
180 writeb(bin2bcd(tm->tm_hour), info->base + S3C2410_RTCHOUR);
181 writeb(bin2bcd(tm->tm_mday), info->base + S3C2410_RTCDATE);
182 writeb(bin2bcd(tm->tm_mon), info->base + S3C2410_RTCMON);
183 writeb(bin2bcd(tm->tm_year), info->base + S3C2410_RTCYEAR);
190 static int s3c_rtc_gettime(struct device *dev, struct rtc_time *tm)
195 ret = s3c_rtc_read_time(info, tm);
200 tm->tm_year += 100;
201 tm->tm_mon -= 1;
203 dev_dbg(dev, "read time %ptR\n", tm);
207 static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
210 struct rtc_time rtc_tm = *tm;
212 dev_dbg(dev, "set time %ptR\n", tm);
277 struct rtc_time *tm = &alrm->time;
281 dev_dbg(dev, "s3c_rtc_setalarm: %d, %ptR\n", alrm->enabled, tm);
290 if (tm->tm_sec < 60 && tm->tm_sec >= 0) {
292 writeb(bin2bcd(tm->tm_sec), info->base + S3C2410_ALMSEC);
295 if (tm->tm_min < 60 && tm->tm_min >= 0) {
297 writeb(bin2bcd(tm->tm_min), info->base + S3C2410_ALMMIN);
300 if (tm->tm_hour < 24 && tm->tm_hour >= 0) {
302 writeb(bin2bcd(tm->tm_hour), info->base + S3C2410_ALMHOUR);
305 if (tm->tm_mon < 12 && tm->tm_mon >= 0) {
307 writeb(bin2bcd(tm->tm_mon + 1), info->base + S3C2410_ALMMON);
310 if (tm->tm_mday <= 31 && tm->tm_mday >= 1) {
312 writeb(bin2bcd(tm->tm_mday), info->base + S3C2410_ALMDATE);