• Home
  • Raw
  • Download

Lines Matching refs:regs

57 static void regs_to_tm(u8 *regs, struct rtc_time *tm)  in regs_to_tm()  argument
59 tm->tm_year = bcd2bin(regs[RTC_YEAR2]) * 100 + in regs_to_tm()
60 bcd2bin(regs[RTC_YEAR1]) - 1900; in regs_to_tm()
61 tm->tm_mon = bcd2bin(regs[RTC_MONTH] & 0x1f) - 1; in regs_to_tm()
62 tm->tm_mday = bcd2bin(regs[RTC_DATE] & 0x3f); in regs_to_tm()
63 tm->tm_wday = (regs[RTC_WEEKDAY] & 0x07); in regs_to_tm()
64 if (regs[RTC_HOUR] & HOUR_12) { in regs_to_tm()
65 tm->tm_hour = bcd2bin(regs[RTC_HOUR] & 0x01f); in regs_to_tm()
68 if (regs[RTC_HOUR] & HOUR_AM_PM) in regs_to_tm()
71 tm->tm_hour = bcd2bin(regs[RTC_HOUR] & 0x03f); in regs_to_tm()
73 tm->tm_min = bcd2bin(regs[RTC_MIN] & 0x7f); in regs_to_tm()
74 tm->tm_sec = bcd2bin(regs[RTC_SEC] & 0x7f); in regs_to_tm()
77 static void tm_to_regs(struct rtc_time *tm, u8 *regs) in tm_to_regs() argument
83 regs[RTC_YEAR2] = bin2bcd(high); in tm_to_regs()
84 regs[RTC_YEAR1] = bin2bcd(low); in tm_to_regs()
85 regs[RTC_MONTH] = bin2bcd(tm->tm_mon + 1); in tm_to_regs()
86 regs[RTC_DATE] = bin2bcd(tm->tm_mday); in tm_to_regs()
87 regs[RTC_WEEKDAY] = tm->tm_wday; in tm_to_regs()
88 regs[RTC_HOUR] = bin2bcd(tm->tm_hour); in tm_to_regs()
89 regs[RTC_MIN] = bin2bcd(tm->tm_min); in tm_to_regs()
90 regs[RTC_SEC] = bin2bcd(tm->tm_sec); in tm_to_regs()
96 u8 regs[TIME_NUM]; in max8907_rtc_read_time() local
99 ret = regmap_bulk_read(rtc->regmap, MAX8907_REG_RTC_SEC, regs, in max8907_rtc_read_time()
104 regs_to_tm(regs, tm); in max8907_rtc_read_time()
112 u8 regs[TIME_NUM]; in max8907_rtc_set_time() local
114 tm_to_regs(tm, regs); in max8907_rtc_set_time()
116 return regmap_bulk_write(rtc->regmap, MAX8907_REG_RTC_SEC, regs, in max8907_rtc_set_time()
123 u8 regs[TIME_NUM]; in max8907_rtc_read_alarm() local
127 ret = regmap_bulk_read(rtc->regmap, MAX8907_REG_ALARM0_SEC, regs, in max8907_rtc_read_alarm()
132 regs_to_tm(regs, &alrm->time); in max8907_rtc_read_alarm()
146 u8 regs[TIME_NUM]; in max8907_rtc_set_alarm() local
149 tm_to_regs(&alrm->time, regs); in max8907_rtc_set_alarm()
156 ret = regmap_bulk_write(rtc->regmap, MAX8907_REG_ALARM0_SEC, regs, in max8907_rtc_set_alarm()