Lines Matching refs:rtc_tm
459 static int sun6i_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
480 rtc_time64_to_tm((date & 0xffff) * SECS_PER_DAY, rtc_tm);
482 rtc_tm->tm_mday = SUN6I_DATE_GET_DAY_VALUE(date);
483 rtc_tm->tm_mon = SUN6I_DATE_GET_MON_VALUE(date) - 1;
484 rtc_tm->tm_year = SUN6I_DATE_GET_YEAR_VALUE(date);
490 rtc_tm->tm_year += SUN6I_YEAR_OFF;
493 rtc_tm->tm_sec = SUN6I_TIME_GET_SEC_VALUE(time);
494 rtc_tm->tm_min = SUN6I_TIME_GET_MIN_VALUE(time);
495 rtc_tm->tm_hour = SUN6I_TIME_GET_HOUR_VALUE(time);
597 static int sun6i_rtc_settime(struct device *dev, struct rtc_time *rtc_tm)
603 time = SUN6I_TIME_SET_SEC_VALUE(rtc_tm->tm_sec) |
604 SUN6I_TIME_SET_MIN_VALUE(rtc_tm->tm_min) |
605 SUN6I_TIME_SET_HOUR_VALUE(rtc_tm->tm_hour);
608 /* The division will cut off the H:M:S part of rtc_tm. */
609 date = div_u64(rtc_tm_to_time64(rtc_tm), SECS_PER_DAY);
611 rtc_tm->tm_year -= SUN6I_YEAR_OFF;
612 rtc_tm->tm_mon += 1;
614 date = SUN6I_DATE_SET_DAY_VALUE(rtc_tm->tm_mday) |
615 SUN6I_DATE_SET_MON_VALUE(rtc_tm->tm_mon) |
616 SUN6I_DATE_SET_YEAR_VALUE(rtc_tm->tm_year);
618 if (is_leap_year(rtc_tm->tm_year + SUN6I_YEAR_MIN))