Lines Matching refs:tm

31 static int wm8350_rtc_readtime(struct device *dev, struct rtc_time *tm)  in wm8350_rtc_readtime()  argument
52 tm->tm_sec = time1[0] & WM8350_RTC_SECS_MASK; in wm8350_rtc_readtime()
54 tm->tm_min = (time1[0] & WM8350_RTC_MINS_MASK) in wm8350_rtc_readtime()
57 tm->tm_hour = time1[1] & WM8350_RTC_HRS_MASK; in wm8350_rtc_readtime()
59 tm->tm_wday = ((time1[1] >> WM8350_RTC_DAY_SHIFT) in wm8350_rtc_readtime()
62 tm->tm_mon = ((time1[2] & WM8350_RTC_MTH_MASK) in wm8350_rtc_readtime()
65 tm->tm_mday = (time1[2] & WM8350_RTC_DATE_MASK); in wm8350_rtc_readtime()
67 tm->tm_year = ((time1[3] & WM8350_RTC_YHUNDREDS_MASK) in wm8350_rtc_readtime()
69 tm->tm_year += time1[3] & WM8350_RTC_YUNITS_MASK; in wm8350_rtc_readtime()
71 tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, in wm8350_rtc_readtime()
72 tm->tm_year); in wm8350_rtc_readtime()
73 tm->tm_year -= 1900; in wm8350_rtc_readtime()
90 static int wm8350_rtc_settime(struct device *dev, struct rtc_time *tm) in wm8350_rtc_settime() argument
97 time[0] = tm->tm_sec; in wm8350_rtc_settime()
98 time[0] |= tm->tm_min << WM8350_RTC_MINS_SHIFT; in wm8350_rtc_settime()
99 time[1] = tm->tm_hour; in wm8350_rtc_settime()
100 time[1] |= (tm->tm_wday + 1) << WM8350_RTC_DAY_SHIFT; in wm8350_rtc_settime()
101 time[2] = tm->tm_mday; in wm8350_rtc_settime()
102 time[2] |= (tm->tm_mon + 1) << WM8350_RTC_MTH_SHIFT; in wm8350_rtc_settime()
103 time[3] = ((tm->tm_year + 1900) / 100) << WM8350_RTC_YHUNDREDS_SHIFT; in wm8350_rtc_settime()
104 time[3] |= (tm->tm_year + 1900) % 100; in wm8350_rtc_settime()
142 struct rtc_time *tm = &alrm->time; in wm8350_rtc_readalarm() local
150 tm->tm_sec = time[0] & WM8350_RTC_ALMSECS_MASK; in wm8350_rtc_readalarm()
151 if (tm->tm_sec == WM8350_RTC_ALMSECS_MASK) in wm8350_rtc_readalarm()
152 tm->tm_sec = -1; in wm8350_rtc_readalarm()
154 tm->tm_min = time[0] & WM8350_RTC_ALMMINS_MASK; in wm8350_rtc_readalarm()
155 if (tm->tm_min == WM8350_RTC_ALMMINS_MASK) in wm8350_rtc_readalarm()
156 tm->tm_min = -1; in wm8350_rtc_readalarm()
158 tm->tm_min >>= WM8350_RTC_ALMMINS_SHIFT; in wm8350_rtc_readalarm()
160 tm->tm_hour = time[1] & WM8350_RTC_ALMHRS_MASK; in wm8350_rtc_readalarm()
161 if (tm->tm_hour == WM8350_RTC_ALMHRS_MASK) in wm8350_rtc_readalarm()
162 tm->tm_hour = -1; in wm8350_rtc_readalarm()
164 tm->tm_wday = ((time[1] >> WM8350_RTC_ALMDAY_SHIFT) & 0x7) - 1; in wm8350_rtc_readalarm()
165 if (tm->tm_wday > 7) in wm8350_rtc_readalarm()
166 tm->tm_wday = -1; in wm8350_rtc_readalarm()
168 tm->tm_mon = time[2] & WM8350_RTC_ALMMTH_MASK; in wm8350_rtc_readalarm()
169 if (tm->tm_mon == WM8350_RTC_ALMMTH_MASK) in wm8350_rtc_readalarm()
170 tm->tm_mon = -1; in wm8350_rtc_readalarm()
172 tm->tm_mon = (tm->tm_mon >> WM8350_RTC_ALMMTH_SHIFT) - 1; in wm8350_rtc_readalarm()
174 tm->tm_mday = (time[2] & WM8350_RTC_ALMDATE_MASK); in wm8350_rtc_readalarm()
175 if (tm->tm_mday == WM8350_RTC_ALMDATE_MASK) in wm8350_rtc_readalarm()
176 tm->tm_mday = -1; in wm8350_rtc_readalarm()
178 tm->tm_year = -1; in wm8350_rtc_readalarm()
246 struct rtc_time *tm = &alrm->time; in wm8350_rtc_setalarm() local
252 if (tm->tm_sec != -1) in wm8350_rtc_setalarm()
253 time[0] |= tm->tm_sec; in wm8350_rtc_setalarm()
257 if (tm->tm_min != -1) in wm8350_rtc_setalarm()
258 time[0] |= tm->tm_min << WM8350_RTC_ALMMINS_SHIFT; in wm8350_rtc_setalarm()
262 if (tm->tm_hour != -1) in wm8350_rtc_setalarm()
263 time[1] |= tm->tm_hour; in wm8350_rtc_setalarm()
267 if (tm->tm_wday != -1) in wm8350_rtc_setalarm()
268 time[1] |= (tm->tm_wday + 1) << WM8350_RTC_ALMDAY_SHIFT; in wm8350_rtc_setalarm()
272 if (tm->tm_mday != -1) in wm8350_rtc_setalarm()
273 time[2] |= tm->tm_mday; in wm8350_rtc_setalarm()
277 if (tm->tm_mon != -1) in wm8350_rtc_setalarm()
278 time[2] |= (tm->tm_mon + 1) << WM8350_RTC_ALMMTH_SHIFT; in wm8350_rtc_setalarm()