Lines Matching refs:alarm

179 				   struct rtc_wkalrm *alarm)  in rtc_read_alarm_internal()  argument
192 alarm->enabled = 0; in rtc_read_alarm_internal()
193 alarm->pending = 0; in rtc_read_alarm_internal()
194 alarm->time.tm_sec = -1; in rtc_read_alarm_internal()
195 alarm->time.tm_min = -1; in rtc_read_alarm_internal()
196 alarm->time.tm_hour = -1; in rtc_read_alarm_internal()
197 alarm->time.tm_mday = -1; in rtc_read_alarm_internal()
198 alarm->time.tm_mon = -1; in rtc_read_alarm_internal()
199 alarm->time.tm_year = -1; in rtc_read_alarm_internal()
200 alarm->time.tm_wday = -1; in rtc_read_alarm_internal()
201 alarm->time.tm_yday = -1; in rtc_read_alarm_internal()
202 alarm->time.tm_isdst = -1; in rtc_read_alarm_internal()
203 err = rtc->ops->read_alarm(rtc->dev.parent, alarm); in rtc_read_alarm_internal()
208 trace_rtc_read_alarm(rtc_tm_to_time64(&alarm->time), err); in rtc_read_alarm_internal()
212 int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) in __rtc_read_alarm() argument
272 err = rtc_read_alarm_internal(rtc, alarm); in __rtc_read_alarm()
277 if (rtc_valid_tm(&alarm->time) == 0) { in __rtc_read_alarm()
278 rtc_add_offset(rtc, &alarm->time); in __rtc_read_alarm()
296 if (alarm->time.tm_sec == -1) in __rtc_read_alarm()
297 alarm->time.tm_sec = now.tm_sec; in __rtc_read_alarm()
298 if (alarm->time.tm_min == -1) in __rtc_read_alarm()
299 alarm->time.tm_min = now.tm_min; in __rtc_read_alarm()
300 if (alarm->time.tm_hour == -1) in __rtc_read_alarm()
301 alarm->time.tm_hour = now.tm_hour; in __rtc_read_alarm()
304 if (alarm->time.tm_mday < 1 || alarm->time.tm_mday > 31) { in __rtc_read_alarm()
305 alarm->time.tm_mday = now.tm_mday; in __rtc_read_alarm()
308 if ((unsigned int)alarm->time.tm_mon >= 12) { in __rtc_read_alarm()
309 alarm->time.tm_mon = now.tm_mon; in __rtc_read_alarm()
313 if (alarm->time.tm_year == -1) { in __rtc_read_alarm()
314 alarm->time.tm_year = now.tm_year; in __rtc_read_alarm()
322 err = rtc_valid_tm(&alarm->time); in __rtc_read_alarm()
328 t_alm = rtc_tm_to_time64(&alarm->time); in __rtc_read_alarm()
341 rtc_time64_to_tm(t_alm, &alarm->time); in __rtc_read_alarm()
352 if (alarm->time.tm_mon < 11) { in __rtc_read_alarm()
353 alarm->time.tm_mon++; in __rtc_read_alarm()
355 alarm->time.tm_mon = 0; in __rtc_read_alarm()
356 alarm->time.tm_year++; in __rtc_read_alarm()
358 days = rtc_month_days(alarm->time.tm_mon, in __rtc_read_alarm()
359 alarm->time.tm_year); in __rtc_read_alarm()
360 } while (days < alarm->time.tm_mday); in __rtc_read_alarm()
367 alarm->time.tm_year++; in __rtc_read_alarm()
368 } while (!is_leap_year(alarm->time.tm_year + 1900) && in __rtc_read_alarm()
369 rtc_valid_tm(&alarm->time) != 0); in __rtc_read_alarm()
376 err = rtc_valid_tm(&alarm->time); in __rtc_read_alarm()
381 &alarm->time); in __rtc_read_alarm()
386 int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) in rtc_read_alarm() argument
398 memset(alarm, 0, sizeof(struct rtc_wkalrm)); in rtc_read_alarm()
399 alarm->enabled = rtc->aie_timer.enabled; in rtc_read_alarm()
400 alarm->time = rtc_ktime_to_tm(rtc->aie_timer.node.expires); in rtc_read_alarm()
404 trace_rtc_read_alarm(rtc_tm_to_time64(&alarm->time), err); in rtc_read_alarm()
409 static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) in __rtc_set_alarm() argument
415 err = rtc_valid_tm(&alarm->time); in __rtc_set_alarm()
419 scheduled = rtc_tm_to_time64(&alarm->time); in __rtc_set_alarm()
436 rtc_subtract_offset(rtc, &alarm->time); in __rtc_set_alarm()
443 err = rtc->ops->set_alarm(rtc->dev.parent, alarm); in __rtc_set_alarm()
445 trace_rtc_set_alarm(rtc_tm_to_time64(&alarm->time), err); in __rtc_set_alarm()
449 int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) in rtc_set_alarm() argument
459 err = rtc_valid_tm(&alarm->time); in rtc_set_alarm()
463 err = rtc_valid_range(rtc, &alarm->time); in rtc_set_alarm()
473 alarm_time = rtc_tm_to_ktime(alarm->time); in rtc_set_alarm()
479 alarm_time = ktime_sub_ns(alarm_time, (u64)alarm->time.tm_sec * NSEC_PER_SEC); in rtc_set_alarm()
483 if (alarm->enabled) in rtc_set_alarm()
493 int rtc_initialize_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) in rtc_initialize_alarm() argument
498 err = rtc_valid_tm(&alarm->time); in rtc_initialize_alarm()
510 rtc->aie_timer.node.expires = rtc_tm_to_ktime(alarm->time); in rtc_initialize_alarm()
514 if (alarm->enabled && (rtc_tm_to_ktime(now) < in rtc_initialize_alarm()
822 struct rtc_wkalrm alarm; in rtc_timer_enqueue() local
825 alarm.time = rtc_ktime_to_tm(timer->node.expires); in rtc_timer_enqueue()
826 alarm.enabled = 1; in rtc_timer_enqueue()
827 err = __rtc_set_alarm(rtc, &alarm); in rtc_timer_enqueue()
870 struct rtc_wkalrm alarm; in rtc_timer_remove() local
878 alarm.time = rtc_ktime_to_tm(next->expires); in rtc_timer_remove()
879 alarm.enabled = 1; in rtc_timer_remove()
880 err = __rtc_set_alarm(rtc, &alarm); in rtc_timer_remove()
936 struct rtc_wkalrm alarm; in rtc_timer_do_work() local
940 alarm.time = rtc_ktime_to_tm(next->expires); in rtc_timer_do_work()
941 alarm.enabled = 1; in rtc_timer_do_work()
943 err = __rtc_set_alarm(rtc, &alarm); in rtc_timer_do_work()