linux/drivers/rtc/rtc-ds1685.c
/**
 * ds1685_rtc_read_alarm - reads the alarm registers.
 * @dev: pointer to device structure.
 * @alrm: pointer to rtc_wkalrm structure.
 *
 * There are three primary alarm registers: seconds, minutes, and hours.
 * A fourth alarm register for the month date is also available in bank1 for
 * kickstart/wakeup features.  The DS1685/DS1687 manual states that a
 * "don't care" value ranging from 0xc0 to 0xff may be written into one or
 * more of the three alarm bytes to act as a wildcard value.  The fourth
 * byte doesn't support a "don't care" value.
 */
reads the alarm registers.
@dev: pointer to device structure.
@alrm: pointer to rtc_wkalrm structure.

There are three primary alarm registers: seconds, minutes, and hours.
A fourth alarm register for the month date is also available in bank1 for
kickstart/wakeup features.  The DS1685/DS1687 manual states that a
"don't care" value ranging from 0xc0 to 0xff may be written into one or
more of the three alarm bytes to act as a wildcard value.  The fourth
byte doesn't support a "don't care" value.
reads the alarm registers . @dev : pointer to device structure . @alrm : pointer to rtc_wkalrm structure . There are three primary alarm registers : seconds minutes and hours . A fourth alarm register for the month date is also available in bank1 for kickstart / wakeup features . The DS1685 / DS1687 manual states that a " don ' t care " value ranging from 0xc0 to 0xff may be written into one or more of the three alarm bytes to act as a wildcard value . The fourth byte doesn ' t support a " don ' t care " value .
static int
ds1685_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
	struct ds1685_priv *rtc = dev_get_drvdata(dev);
	u8 seconds, minutes, hours, mday, ctrlb, ctrlc;
	int ret;
	ds1685_rtc_begin_data_access(rtc);
	seconds	= rtc->read(rtc, RTC_SECS_ALARM);
	minutes	= rtc->read(rtc, RTC_MINS_ALARM);
	hours	= rtc->read(rtc, RTC_HRS_ALARM);
	mday	= rtc->read(rtc, RTC_MDAY_ALARM);
	ctrlb	= rtc->read(rtc, RTC_CTRL_B);
	ctrlc	= rtc->read(rtc, RTC_CTRL_C);
	ds1685_rtc_end_data_access(rtc);
	ret = ds1685_rtc_check_mday(rtc, mday);
	if (ret)
		return ret;
	if (likely(seconds < 0xc0))
		alrm->time.tm_sec = ds1685_rtc_bcd2bin(rtc, seconds,
						       RTC_SECS_BCD_MASK,
						       RTC_SECS_BIN_MASK);
	if (likely(minutes < 0xc0))
		alrm->time.tm_min = ds1685_rtc_bcd2bin(rtc, minutes,
						       RTC_MINS_BCD_MASK,
						       RTC_MINS_BIN_MASK);
	if (likely(hours < 0xc0))
		alrm->time.tm_hour = ds1685_rtc_bcd2bin(rtc, hours,
							RTC_HRS_24_BCD_MASK,
							RTC_HRS_24_BIN_MASK);
	alrm->time.tm_mday = ds1685_rtc_bcd2bin(rtc, mday, RTC_MDAY_BCD_MASK,
						RTC_MDAY_BIN_MASK);
	alrm->enabled = !!(ctrlb & RTC_CTRL_B_AIE);
	alrm->pending = !!(ctrlc & RTC_CTRL_C_AF);
	return 0;
}
static int ds1685_rtc_read_alarm ( struct device * dev , struct rtc_wkalrm * alrm ) { struct ds1685_priv * rtc = dev_get_drvdata ( dev ) ; u8 seconds , minutes , hours , mday , ctrlb , ctrlc ; int ret ; ds1685_rtc_begin_data_access ( rtc ) ; seconds = rtc -> read ( rtc , RTC_SECS_ALARM ) ; minutes = rtc -> read ( rtc , RTC_MINS_ALARM ) ; hours = rtc -> read ( rtc , RTC_HRS_ALARM ) ; mday = rtc -> read ( rtc , RTC_MDAY_ALARM ) ; ctrlb = rtc -> read ( rtc , RTC_CTRL_B ) ; ctrlc = rtc -> read ( rtc , RTC_CTRL_C ) ; ds1685_rtc_end_data_access ( rtc ) ; ret = ds1685_rtc_check_mday ( rtc , mday ) ; if ( ret ) return ret ; if ( likely ( seconds < 0xc0 ) ) alrm -> time . tm_sec = ds1685_rtc_bcd2bin ( rtc , seconds , RTC_SECS_BCD_MASK , RTC_SECS_BIN_MASK ) ; if ( likely ( minutes < 0xc0 ) ) alrm -> time . tm_min = ds1685_rtc_bcd2bin ( rtc , minutes , RTC_MINS_BCD_MASK , RTC_MINS_BIN_MASK ) ; if ( likely ( hours < 0xc0 ) ) alrm -> time . tm_hour = ds1685_rtc_bcd2bin ( rtc , hours , RTC_HRS_24_BCD_MASK , RTC_HRS_24_BIN_MASK ) ; alrm -> time . tm_mday = ds1685_rtc_bcd2bin ( rtc , mday , RTC_MDAY_BCD_MASK , RTC_MDAY_BIN_MASK ) ; alrm -> enabled = ! ! ( ctrlb & RTC_CTRL_B_AIE ) ; alrm -> pending = ! ! ( ctrlc & RTC_CTRL_C_AF ) ; return 0 ; }
ds1685_rtc_read_alarm - reads the alarm registers.
ds1685_rtc_read_alarm - reads the alarm registers .
/* Fetch the alarm info from the RTC alarm registers. */ /* Check the month date for validity. */ /*
	 * Check the three alarm bytes.
	 *
	 * The Linux RTC system doesn't support the "don't care" capability
	 * of this RTC chip.  We check for it anyways in case support is
	 * added in the future and only assign when we care.
	 */ /* Write the data to rtc_wkalrm. */