Lines Matching defs:alm
95 static int mv_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
114 alm->time.tm_sec = bcd2bin(second);
115 alm->time.tm_min = bcd2bin(minute);
116 alm->time.tm_hour = bcd2bin(hour);
117 alm->time.tm_mday = bcd2bin(day);
118 alm->time.tm_wday = bcd2bin(wday);
119 alm->time.tm_mon = bcd2bin(month) - 1;
121 alm->time.tm_year = bcd2bin(year) + 100;
123 if (rtc_valid_tm(&alm->time) < 0) {
125 rtc_time_to_tm(0, &alm->time);
128 alm->enabled = !!readl(ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS);
132 static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
138 if (alm->time.tm_sec >= 0)
139 rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_sec))
141 if (alm->time.tm_min >= 0)
142 rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_min))
144 if (alm->time.tm_hour >= 0)
145 rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_hour))
150 if (alm->time.tm_mday >= 0)
151 rtc_reg = (RTC_ALARM_VALID | bin2bcd(alm->time.tm_mday))
156 if (alm->time.tm_mon >= 0)
157 rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_mon + 1))
160 if (alm->time.tm_year >= 0)
161 rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year % 100))
166 writel(alm->enabled ? 1 : 0,