Lines Matching refs:tm
140 static int ds1302_rtc_read_time(struct device *dev, struct rtc_time *tm) in ds1302_rtc_read_time() argument
142 tm->tm_sec = bcd2bin(ds1302_readbyte(RTC_ADDR_SEC)); in ds1302_rtc_read_time()
143 tm->tm_min = bcd2bin(ds1302_readbyte(RTC_ADDR_MIN)); in ds1302_rtc_read_time()
144 tm->tm_hour = bcd2bin(ds1302_readbyte(RTC_ADDR_HOUR)); in ds1302_rtc_read_time()
145 tm->tm_wday = bcd2bin(ds1302_readbyte(RTC_ADDR_DAY)); in ds1302_rtc_read_time()
146 tm->tm_mday = bcd2bin(ds1302_readbyte(RTC_ADDR_DATE)); in ds1302_rtc_read_time()
147 tm->tm_mon = bcd2bin(ds1302_readbyte(RTC_ADDR_MON)) - 1; in ds1302_rtc_read_time()
148 tm->tm_year = bcd2bin(ds1302_readbyte(RTC_ADDR_YEAR)); in ds1302_rtc_read_time()
150 if (tm->tm_year < 70) in ds1302_rtc_read_time()
151 tm->tm_year += 100; in ds1302_rtc_read_time()
156 tm->tm_sec, tm->tm_min, tm->tm_hour, in ds1302_rtc_read_time()
157 tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday); in ds1302_rtc_read_time()
159 return rtc_valid_tm(tm); in ds1302_rtc_read_time()
162 static int ds1302_rtc_set_time(struct device *dev, struct rtc_time *tm) in ds1302_rtc_set_time() argument
167 ds1302_writebyte(RTC_ADDR_SEC, bin2bcd(tm->tm_sec)); in ds1302_rtc_set_time()
168 ds1302_writebyte(RTC_ADDR_MIN, bin2bcd(tm->tm_min)); in ds1302_rtc_set_time()
169 ds1302_writebyte(RTC_ADDR_HOUR, bin2bcd(tm->tm_hour)); in ds1302_rtc_set_time()
170 ds1302_writebyte(RTC_ADDR_DAY, bin2bcd(tm->tm_wday)); in ds1302_rtc_set_time()
171 ds1302_writebyte(RTC_ADDR_DATE, bin2bcd(tm->tm_mday)); in ds1302_rtc_set_time()
172 ds1302_writebyte(RTC_ADDR_MON, bin2bcd(tm->tm_mon + 1)); in ds1302_rtc_set_time()
173 ds1302_writebyte(RTC_ADDR_YEAR, bin2bcd(tm->tm_year % 100)); in ds1302_rtc_set_time()