Lines Matching refs:alm
97 static int mv_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) in mv_rtc_read_alarm() argument
116 alm->time.tm_sec = bcd2bin(second); in mv_rtc_read_alarm()
117 alm->time.tm_min = bcd2bin(minute); in mv_rtc_read_alarm()
118 alm->time.tm_hour = bcd2bin(hour); in mv_rtc_read_alarm()
119 alm->time.tm_mday = bcd2bin(day); in mv_rtc_read_alarm()
120 alm->time.tm_wday = bcd2bin(wday); in mv_rtc_read_alarm()
121 alm->time.tm_mon = bcd2bin(month) - 1; in mv_rtc_read_alarm()
123 alm->time.tm_year = bcd2bin(year) + 100; in mv_rtc_read_alarm()
125 alm->enabled = !!readl(ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); in mv_rtc_read_alarm()
127 return rtc_valid_tm(&alm->time); in mv_rtc_read_alarm()
130 static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) in mv_rtc_set_alarm() argument
136 if (alm->time.tm_sec >= 0) in mv_rtc_set_alarm()
137 rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_sec)) in mv_rtc_set_alarm()
139 if (alm->time.tm_min >= 0) in mv_rtc_set_alarm()
140 rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_min)) in mv_rtc_set_alarm()
142 if (alm->time.tm_hour >= 0) in mv_rtc_set_alarm()
143 rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_hour)) in mv_rtc_set_alarm()
148 if (alm->time.tm_mday >= 0) in mv_rtc_set_alarm()
149 rtc_reg = (RTC_ALARM_VALID | bin2bcd(alm->time.tm_mday)) in mv_rtc_set_alarm()
154 if (alm->time.tm_mon >= 0) in mv_rtc_set_alarm()
155 rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_mon + 1)) in mv_rtc_set_alarm()
158 if (alm->time.tm_year >= 0) in mv_rtc_set_alarm()
159 rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year - 100)) in mv_rtc_set_alarm()
164 writel(alm->enabled ? 1 : 0, in mv_rtc_set_alarm()