Lines Matching refs:tm

131 static int validate_time(const struct rtc_time *tm)  in validate_time()  argument
133 if ((tm->tm_year < 2000) || (tm->tm_year > 2099)) in validate_time()
136 if ((tm->tm_mon < 1) || (tm->tm_mon > 12)) in validate_time()
139 if ((tm->tm_mday < 1) || (tm->tm_mday > 31)) in validate_time()
142 if ((tm->tm_wday < 0) || (tm->tm_wday > 6)) in validate_time()
145 if ((tm->tm_hour < 0) || (tm->tm_hour > 23)) in validate_time()
148 if ((tm->tm_min < 0) || (tm->tm_min > 59)) in validate_time()
151 if ((tm->tm_sec < 0) || (tm->tm_sec > 59)) in validate_time()
193 static int s35392a_rtc_get(DEV_TYPE *dev, struct rtc_time *tm) in s35392a_rtc_get() argument
213 tm->tm_sec = bcd2bin(date[S35390A_BYTE_SECS]); in s35392a_rtc_get()
214 tm->tm_min = bcd2bin(date[S35390A_BYTE_MINS]); in s35392a_rtc_get()
215 tm->tm_hour = bcd2bin(date[S35390A_BYTE_HOURS] & ~S35390A_FLAG_24H); in s35392a_rtc_get()
216 tm->tm_wday = bcd2bin(date[S35390A_BYTE_WDAY]); in s35392a_rtc_get()
217 tm->tm_mday = bcd2bin(date[S35390A_BYTE_DAY]); in s35392a_rtc_get()
218 tm->tm_mon = bcd2bin(date[S35390A_BYTE_MONTH]); in s35392a_rtc_get()
219 tm->tm_year = bcd2bin(date[S35390A_BYTE_YEAR]) + 2000; in s35392a_rtc_get()
222 tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday, in s35392a_rtc_get()
223 tm->tm_hour, tm->tm_min, tm->tm_sec); in s35392a_rtc_get()
229 static int s35392a_rtc_set(DEV_TYPE *dev, const struct rtc_time *tm) in s35392a_rtc_set() argument
236 tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday, in s35392a_rtc_set()
237 tm->tm_hour, tm->tm_min, tm->tm_sec); in s35392a_rtc_set()
239 ret = validate_time(tm); in s35392a_rtc_set()
254 date[S35390A_BYTE_YEAR] = bin2bcd(tm->tm_year - 2000); in s35392a_rtc_set()
255 date[S35390A_BYTE_MONTH] = bin2bcd(tm->tm_mon); in s35392a_rtc_set()
256 date[S35390A_BYTE_DAY] = bin2bcd(tm->tm_mday); in s35392a_rtc_set()
257 date[S35390A_BYTE_WDAY] = bin2bcd(tm->tm_wday); in s35392a_rtc_set()
258 date[S35390A_BYTE_HOURS] = bin2bcd(tm->tm_hour); in s35392a_rtc_set()
259 date[S35390A_BYTE_MINS] = bin2bcd(tm->tm_min); in s35392a_rtc_set()
260 date[S35390A_BYTE_SECS] = bin2bcd(tm->tm_sec); in s35392a_rtc_set()
315 int rtc_get(struct rtc_time *tm) in rtc_get() argument
317 return s35392a_rtc_get(&dev, tm); in rtc_get()
320 int rtc_set(struct rtc_time *tm) in rtc_set() argument
322 return s35392a_rtc_set(&dev, tm); in rtc_set()