Lines Matching refs:rtc
45 ds1685_read(struct ds1685_priv *rtc, int reg) in ds1685_read() argument
47 return readb((u8 __iomem *)rtc->regs + in ds1685_read()
48 (reg * rtc->regstep)); in ds1685_read()
58 ds1685_write(struct ds1685_priv *rtc, int reg, u8 value) in ds1685_write() argument
60 writeb(value, ((u8 __iomem *)rtc->regs + in ds1685_write()
61 (reg * rtc->regstep))); in ds1685_write()
76 ds1685_indirect_read(struct ds1685_priv *rtc, int reg) in ds1685_indirect_read() argument
78 writeb(reg, rtc->regs); in ds1685_indirect_read()
79 return readb(rtc->data); in ds1685_indirect_read()
89 ds1685_indirect_write(struct ds1685_priv *rtc, int reg, u8 value) in ds1685_indirect_write() argument
91 writeb(reg, rtc->regs); in ds1685_indirect_write()
92 writeb(value, rtc->data); in ds1685_indirect_write()
108 ds1685_rtc_bcd2bin(struct ds1685_priv *rtc, u8 val, u8 bcd_mask, u8 bin_mask) in ds1685_rtc_bcd2bin() argument
110 if (rtc->bcd_mode) in ds1685_rtc_bcd2bin()
126 ds1685_rtc_bin2bcd(struct ds1685_priv *rtc, u8 val, u8 bin_mask, u8 bcd_mask) in ds1685_rtc_bin2bcd() argument
128 if (rtc->bcd_mode) in ds1685_rtc_bin2bcd()
142 ds1685_rtc_check_mday(struct ds1685_priv *rtc, u8 mday) in ds1685_rtc_check_mday() argument
144 if (rtc->bcd_mode) { in ds1685_rtc_check_mday()
159 ds1685_rtc_switch_to_bank0(struct ds1685_priv *rtc) in ds1685_rtc_switch_to_bank0() argument
161 rtc->write(rtc, RTC_CTRL_A, in ds1685_rtc_switch_to_bank0()
162 (rtc->read(rtc, RTC_CTRL_A) & ~(RTC_CTRL_A_DV0))); in ds1685_rtc_switch_to_bank0()
170 ds1685_rtc_switch_to_bank1(struct ds1685_priv *rtc) in ds1685_rtc_switch_to_bank1() argument
172 rtc->write(rtc, RTC_CTRL_A, in ds1685_rtc_switch_to_bank1()
173 (rtc->read(rtc, RTC_CTRL_A) | RTC_CTRL_A_DV0)); in ds1685_rtc_switch_to_bank1()
190 ds1685_rtc_begin_data_access(struct ds1685_priv *rtc) in ds1685_rtc_begin_data_access() argument
193 rtc->write(rtc, RTC_CTRL_B, in ds1685_rtc_begin_data_access()
194 (rtc->read(rtc, RTC_CTRL_B) | RTC_CTRL_B_SET)); in ds1685_rtc_begin_data_access()
197 ds1685_rtc_switch_to_bank1(rtc); in ds1685_rtc_begin_data_access()
200 while (rtc->read(rtc, RTC_EXT_CTRL_4A) & RTC_CTRL_4A_INCR) in ds1685_rtc_begin_data_access()
213 ds1685_rtc_end_data_access(struct ds1685_priv *rtc) in ds1685_rtc_end_data_access() argument
216 ds1685_rtc_switch_to_bank0(rtc); in ds1685_rtc_end_data_access()
219 rtc->write(rtc, RTC_CTRL_B, in ds1685_rtc_end_data_access()
220 (rtc->read(rtc, RTC_CTRL_B) & ~(RTC_CTRL_B_SET))); in ds1685_rtc_end_data_access()
238 ds1685_rtc_get_ssn(struct ds1685_priv *rtc, u8 *ssn) in ds1685_rtc_get_ssn() argument
240 ssn[0] = rtc->read(rtc, RTC_BANK1_SSN_MODEL); in ds1685_rtc_get_ssn()
241 ssn[1] = rtc->read(rtc, RTC_BANK1_SSN_BYTE_1); in ds1685_rtc_get_ssn()
242 ssn[2] = rtc->read(rtc, RTC_BANK1_SSN_BYTE_2); in ds1685_rtc_get_ssn()
243 ssn[3] = rtc->read(rtc, RTC_BANK1_SSN_BYTE_3); in ds1685_rtc_get_ssn()
244 ssn[4] = rtc->read(rtc, RTC_BANK1_SSN_BYTE_4); in ds1685_rtc_get_ssn()
245 ssn[5] = rtc->read(rtc, RTC_BANK1_SSN_BYTE_5); in ds1685_rtc_get_ssn()
246 ssn[6] = rtc->read(rtc, RTC_BANK1_SSN_BYTE_6); in ds1685_rtc_get_ssn()
247 ssn[7] = rtc->read(rtc, RTC_BANK1_SSN_CRC); in ds1685_rtc_get_ssn()
263 struct ds1685_priv *rtc = dev_get_drvdata(dev); in ds1685_rtc_read_time() local
268 ds1685_rtc_begin_data_access(rtc); in ds1685_rtc_read_time()
269 seconds = rtc->read(rtc, RTC_SECS); in ds1685_rtc_read_time()
270 minutes = rtc->read(rtc, RTC_MINS); in ds1685_rtc_read_time()
271 hours = rtc->read(rtc, RTC_HRS); in ds1685_rtc_read_time()
272 wday = rtc->read(rtc, RTC_WDAY); in ds1685_rtc_read_time()
273 mday = rtc->read(rtc, RTC_MDAY); in ds1685_rtc_read_time()
274 month = rtc->read(rtc, RTC_MONTH); in ds1685_rtc_read_time()
275 years = rtc->read(rtc, RTC_YEAR); in ds1685_rtc_read_time()
276 century = rtc->read(rtc, RTC_CENTURY); in ds1685_rtc_read_time()
277 ds1685_rtc_end_data_access(rtc); in ds1685_rtc_read_time()
280 years = ds1685_rtc_bcd2bin(rtc, years, RTC_YEAR_BCD_MASK, in ds1685_rtc_read_time()
282 century = ds1685_rtc_bcd2bin(rtc, century, RTC_CENTURY_MASK, in ds1685_rtc_read_time()
284 tm->tm_sec = ds1685_rtc_bcd2bin(rtc, seconds, RTC_SECS_BCD_MASK, in ds1685_rtc_read_time()
286 tm->tm_min = ds1685_rtc_bcd2bin(rtc, minutes, RTC_MINS_BCD_MASK, in ds1685_rtc_read_time()
288 tm->tm_hour = ds1685_rtc_bcd2bin(rtc, hours, RTC_HRS_24_BCD_MASK, in ds1685_rtc_read_time()
290 tm->tm_wday = (ds1685_rtc_bcd2bin(rtc, wday, RTC_WDAY_MASK, in ds1685_rtc_read_time()
292 tm->tm_mday = ds1685_rtc_bcd2bin(rtc, mday, RTC_MDAY_BCD_MASK, in ds1685_rtc_read_time()
294 tm->tm_mon = (ds1685_rtc_bcd2bin(rtc, month, RTC_MONTH_BCD_MASK, in ds1685_rtc_read_time()
311 struct ds1685_priv *rtc = dev_get_drvdata(dev); in ds1685_rtc_set_time() local
315 seconds = ds1685_rtc_bin2bcd(rtc, tm->tm_sec, RTC_SECS_BIN_MASK, in ds1685_rtc_set_time()
317 minutes = ds1685_rtc_bin2bcd(rtc, tm->tm_min, RTC_MINS_BIN_MASK, in ds1685_rtc_set_time()
319 hours = ds1685_rtc_bin2bcd(rtc, tm->tm_hour, RTC_HRS_24_BIN_MASK, in ds1685_rtc_set_time()
321 wday = ds1685_rtc_bin2bcd(rtc, (tm->tm_wday + 1), RTC_WDAY_MASK, in ds1685_rtc_set_time()
323 mday = ds1685_rtc_bin2bcd(rtc, tm->tm_mday, RTC_MDAY_BIN_MASK, in ds1685_rtc_set_time()
325 month = ds1685_rtc_bin2bcd(rtc, (tm->tm_mon + 1), RTC_MONTH_BIN_MASK, in ds1685_rtc_set_time()
327 years = ds1685_rtc_bin2bcd(rtc, (tm->tm_year % 100), in ds1685_rtc_set_time()
329 century = ds1685_rtc_bin2bcd(rtc, ((tm->tm_year + 1900) / 100), in ds1685_rtc_set_time()
352 ds1685_rtc_begin_data_access(rtc); in ds1685_rtc_set_time()
353 ctrlb = rtc->read(rtc, RTC_CTRL_B); in ds1685_rtc_set_time()
354 if (rtc->bcd_mode) in ds1685_rtc_set_time()
358 rtc->write(rtc, RTC_CTRL_B, ctrlb); in ds1685_rtc_set_time()
359 rtc->write(rtc, RTC_SECS, seconds); in ds1685_rtc_set_time()
360 rtc->write(rtc, RTC_MINS, minutes); in ds1685_rtc_set_time()
361 rtc->write(rtc, RTC_HRS, hours); in ds1685_rtc_set_time()
362 rtc->write(rtc, RTC_WDAY, wday); in ds1685_rtc_set_time()
363 rtc->write(rtc, RTC_MDAY, mday); in ds1685_rtc_set_time()
364 rtc->write(rtc, RTC_MONTH, month); in ds1685_rtc_set_time()
365 rtc->write(rtc, RTC_YEAR, years); in ds1685_rtc_set_time()
366 rtc->write(rtc, RTC_CENTURY, century); in ds1685_rtc_set_time()
367 ds1685_rtc_end_data_access(rtc); in ds1685_rtc_set_time()
387 struct ds1685_priv *rtc = dev_get_drvdata(dev); in ds1685_rtc_read_alarm() local
392 ds1685_rtc_begin_data_access(rtc); in ds1685_rtc_read_alarm()
393 seconds = rtc->read(rtc, RTC_SECS_ALARM); in ds1685_rtc_read_alarm()
394 minutes = rtc->read(rtc, RTC_MINS_ALARM); in ds1685_rtc_read_alarm()
395 hours = rtc->read(rtc, RTC_HRS_ALARM); in ds1685_rtc_read_alarm()
396 mday = rtc->read(rtc, RTC_MDAY_ALARM); in ds1685_rtc_read_alarm()
397 ctrlb = rtc->read(rtc, RTC_CTRL_B); in ds1685_rtc_read_alarm()
398 ctrlc = rtc->read(rtc, RTC_CTRL_C); in ds1685_rtc_read_alarm()
399 ds1685_rtc_end_data_access(rtc); in ds1685_rtc_read_alarm()
402 ret = ds1685_rtc_check_mday(rtc, mday); in ds1685_rtc_read_alarm()
414 alrm->time.tm_sec = ds1685_rtc_bcd2bin(rtc, seconds, in ds1685_rtc_read_alarm()
419 alrm->time.tm_min = ds1685_rtc_bcd2bin(rtc, minutes, in ds1685_rtc_read_alarm()
424 alrm->time.tm_hour = ds1685_rtc_bcd2bin(rtc, hours, in ds1685_rtc_read_alarm()
429 alrm->time.tm_mday = ds1685_rtc_bcd2bin(rtc, mday, RTC_MDAY_BCD_MASK, in ds1685_rtc_read_alarm()
445 struct ds1685_priv *rtc = dev_get_drvdata(dev); in ds1685_rtc_set_alarm() local
450 seconds = ds1685_rtc_bin2bcd(rtc, alrm->time.tm_sec, in ds1685_rtc_set_alarm()
453 minutes = ds1685_rtc_bin2bcd(rtc, alrm->time.tm_min, in ds1685_rtc_set_alarm()
456 hours = ds1685_rtc_bin2bcd(rtc, alrm->time.tm_hour, in ds1685_rtc_set_alarm()
459 mday = ds1685_rtc_bin2bcd(rtc, alrm->time.tm_mday, in ds1685_rtc_set_alarm()
464 ret = ds1685_rtc_check_mday(rtc, mday); in ds1685_rtc_set_alarm()
492 ds1685_rtc_begin_data_access(rtc); in ds1685_rtc_set_alarm()
493 ctrlb = rtc->read(rtc, RTC_CTRL_B); in ds1685_rtc_set_alarm()
494 rtc->write(rtc, RTC_CTRL_B, (ctrlb & ~(RTC_CTRL_B_AIE))); in ds1685_rtc_set_alarm()
497 rtc->read(rtc, RTC_CTRL_C); in ds1685_rtc_set_alarm()
503 ctrlb = rtc->read(rtc, RTC_CTRL_B); in ds1685_rtc_set_alarm()
504 if (rtc->bcd_mode) in ds1685_rtc_set_alarm()
508 rtc->write(rtc, RTC_CTRL_B, ctrlb); in ds1685_rtc_set_alarm()
509 rtc->write(rtc, RTC_SECS_ALARM, seconds); in ds1685_rtc_set_alarm()
510 rtc->write(rtc, RTC_MINS_ALARM, minutes); in ds1685_rtc_set_alarm()
511 rtc->write(rtc, RTC_HRS_ALARM, hours); in ds1685_rtc_set_alarm()
512 rtc->write(rtc, RTC_MDAY_ALARM, mday); in ds1685_rtc_set_alarm()
516 ctrlb = rtc->read(rtc, RTC_CTRL_B); in ds1685_rtc_set_alarm()
518 rtc->write(rtc, RTC_CTRL_B, ctrlb); in ds1685_rtc_set_alarm()
522 ds1685_rtc_end_data_access(rtc); in ds1685_rtc_set_alarm()
540 struct ds1685_priv *rtc = dev_get_drvdata(dev); in ds1685_rtc_alarm_irq_enable() local
544 rtc->write(rtc, RTC_CTRL_B, (rtc->read(rtc, RTC_CTRL_B) | in ds1685_rtc_alarm_irq_enable()
547 rtc->write(rtc, RTC_CTRL_B, (rtc->read(rtc, RTC_CTRL_B) & in ds1685_rtc_alarm_irq_enable()
551 rtc->read(rtc, RTC_CTRL_C); in ds1685_rtc_alarm_irq_enable()
567 ds1685_rtc_extended_irq(struct ds1685_priv *rtc, struct platform_device *pdev) in ds1685_rtc_extended_irq() argument
571 ds1685_rtc_switch_to_bank1(rtc); in ds1685_rtc_extended_irq()
572 ctrl4a = rtc->read(rtc, RTC_EXT_CTRL_4A); in ds1685_rtc_extended_irq()
573 ctrl4b = rtc->read(rtc, RTC_EXT_CTRL_4B); in ds1685_rtc_extended_irq()
582 rtc->write(rtc, RTC_EXT_CTRL_4B, in ds1685_rtc_extended_irq()
583 (rtc->read(rtc, RTC_EXT_CTRL_4B) & in ds1685_rtc_extended_irq()
587 rtc->write(rtc, RTC_EXT_CTRL_4A, in ds1685_rtc_extended_irq()
597 rtc->write(rtc, RTC_EXT_CTRL_4B, in ds1685_rtc_extended_irq()
598 (rtc->read(rtc, RTC_EXT_CTRL_4B) | in ds1685_rtc_extended_irq()
602 if (rtc->prepare_poweroff != NULL) in ds1685_rtc_extended_irq()
603 rtc->prepare_poweroff(); in ds1685_rtc_extended_irq()
615 rtc->write(rtc, RTC_EXT_CTRL_4A, in ds1685_rtc_extended_irq()
619 if (rtc->wake_alarm != NULL) in ds1685_rtc_extended_irq()
620 rtc->wake_alarm(); in ds1685_rtc_extended_irq()
637 rtc->write(rtc, RTC_EXT_CTRL_4A, in ds1685_rtc_extended_irq()
642 if (rtc->post_ram_clear != NULL) in ds1685_rtc_extended_irq()
643 rtc->post_ram_clear(); in ds1685_rtc_extended_irq()
648 ds1685_rtc_switch_to_bank0(rtc); in ds1685_rtc_extended_irq()
660 struct ds1685_priv *rtc = platform_get_drvdata(pdev); in ds1685_rtc_irq_handler() local
666 if (unlikely(!rtc)) in ds1685_rtc_irq_handler()
669 rtc_lock(rtc->dev); in ds1685_rtc_irq_handler()
672 ctrlb = rtc->read(rtc, RTC_CTRL_B); in ds1685_rtc_irq_handler()
673 ctrlc = rtc->read(rtc, RTC_CTRL_C); in ds1685_rtc_irq_handler()
710 ds1685_rtc_extended_irq(rtc, pdev); in ds1685_rtc_irq_handler()
713 rtc_update_irq(rtc->dev, num_irqs, events); in ds1685_rtc_irq_handler()
714 rtc_unlock(rtc->dev); in ds1685_rtc_irq_handler()
754 struct ds1685_priv *rtc = dev_get_drvdata(dev); in ds1685_rtc_proc() local
759 ds1685_rtc_switch_to_bank1(rtc); in ds1685_rtc_proc()
760 ds1685_rtc_get_ssn(rtc, ssn); in ds1685_rtc_proc()
761 ctrla = rtc->read(rtc, RTC_CTRL_A); in ds1685_rtc_proc()
762 ctrlb = rtc->read(rtc, RTC_CTRL_B); in ds1685_rtc_proc()
763 ctrld = rtc->read(rtc, RTC_CTRL_D); in ds1685_rtc_proc()
764 ctrl4a = rtc->read(rtc, RTC_EXT_CTRL_4A); in ds1685_rtc_proc()
765 ctrl4b = rtc->read(rtc, RTC_EXT_CTRL_4B); in ds1685_rtc_proc()
766 ds1685_rtc_switch_to_bank0(rtc); in ds1685_rtc_proc()
843 struct ds1685_priv *rtc = priv; in ds1685_nvram_read() local
844 struct mutex *rtc_mutex = &rtc->dev->ops_lock; in ds1685_nvram_read()
853 ds1685_rtc_switch_to_bank0(rtc); in ds1685_nvram_read()
859 *buf++ = rtc->read(rtc, (NVRAM_TIME_BASE + pos++)); in ds1685_nvram_read()
861 *buf++ = rtc->read(rtc, (NVRAM_BANK0_BASE + pos++)); in ds1685_nvram_read()
866 ds1685_rtc_switch_to_bank1(rtc); in ds1685_nvram_read()
870 rtc->write(rtc, RTC_EXT_CTRL_4A, in ds1685_nvram_read()
871 (rtc->read(rtc, RTC_EXT_CTRL_4A) | in ds1685_nvram_read()
876 rtc->write(rtc, RTC_BANK1_RAM_ADDR_LSB, in ds1685_nvram_read()
886 rtc->write(rtc, RTC_BANK1_RAM_ADDR, in ds1685_nvram_read()
889 *buf++ = rtc->read(rtc, RTC_BANK1_RAM_DATA_PORT); in ds1685_nvram_read()
895 rtc->write(rtc, RTC_EXT_CTRL_4A, in ds1685_nvram_read()
896 (rtc->read(rtc, RTC_EXT_CTRL_4A) & in ds1685_nvram_read()
899 ds1685_rtc_switch_to_bank0(rtc); in ds1685_nvram_read()
910 struct ds1685_priv *rtc = priv; in ds1685_nvram_write() local
911 struct mutex *rtc_mutex = &rtc->dev->ops_lock; in ds1685_nvram_write()
920 ds1685_rtc_switch_to_bank0(rtc); in ds1685_nvram_write()
926 rtc->write(rtc, (NVRAM_TIME_BASE + pos++), in ds1685_nvram_write()
929 rtc->write(rtc, (NVRAM_BANK0_BASE), *buf++); in ds1685_nvram_write()
933 ds1685_rtc_switch_to_bank1(rtc); in ds1685_nvram_write()
937 rtc->write(rtc, RTC_EXT_CTRL_4A, in ds1685_nvram_write()
938 (rtc->read(rtc, RTC_EXT_CTRL_4A) | in ds1685_nvram_write()
943 rtc->write(rtc, RTC_BANK1_RAM_ADDR_LSB, in ds1685_nvram_write()
953 rtc->write(rtc, RTC_BANK1_RAM_ADDR, in ds1685_nvram_write()
956 rtc->write(rtc, RTC_BANK1_RAM_DATA_PORT, *buf++); in ds1685_nvram_write()
962 rtc->write(rtc, RTC_EXT_CTRL_4A, in ds1685_nvram_write()
963 (rtc->read(rtc, RTC_EXT_CTRL_4A) & in ds1685_nvram_write()
966 ds1685_rtc_switch_to_bank0(rtc); in ds1685_nvram_write()
987 struct ds1685_priv *rtc = dev_get_drvdata(dev->parent); in ds1685_rtc_sysfs_battery_show() local
990 ctrld = rtc->read(rtc, RTC_CTRL_D); in ds1685_rtc_sysfs_battery_show()
1007 struct ds1685_priv *rtc = dev_get_drvdata(dev->parent); in ds1685_rtc_sysfs_auxbatt_show() local
1010 ds1685_rtc_switch_to_bank1(rtc); in ds1685_rtc_sysfs_auxbatt_show()
1011 ctrl4a = rtc->read(rtc, RTC_EXT_CTRL_4A); in ds1685_rtc_sysfs_auxbatt_show()
1012 ds1685_rtc_switch_to_bank0(rtc); in ds1685_rtc_sysfs_auxbatt_show()
1029 struct ds1685_priv *rtc = dev_get_drvdata(dev->parent); in ds1685_rtc_sysfs_serial_show() local
1032 ds1685_rtc_switch_to_bank1(rtc); in ds1685_rtc_sysfs_serial_show()
1033 ds1685_rtc_get_ssn(rtc, ssn); in ds1685_rtc_sysfs_serial_show()
1034 ds1685_rtc_switch_to_bank0(rtc); in ds1685_rtc_sysfs_serial_show()
1071 struct ds1685_priv *rtc; in ds1685_rtc_probe() local
1089 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); in ds1685_rtc_probe()
1090 if (!rtc) in ds1685_rtc_probe()
1096 rtc->regs = devm_platform_ioremap_resource(pdev, 0); in ds1685_rtc_probe()
1097 if (IS_ERR(rtc->regs)) in ds1685_rtc_probe()
1098 return PTR_ERR(rtc->regs); in ds1685_rtc_probe()
1099 rtc->read = ds1685_read; in ds1685_rtc_probe()
1100 rtc->write = ds1685_write; in ds1685_rtc_probe()
1103 rtc->regs = devm_platform_ioremap_resource(pdev, 0); in ds1685_rtc_probe()
1104 if (IS_ERR(rtc->regs)) in ds1685_rtc_probe()
1105 return PTR_ERR(rtc->regs); in ds1685_rtc_probe()
1106 rtc->data = devm_platform_ioremap_resource(pdev, 1); in ds1685_rtc_probe()
1107 if (IS_ERR(rtc->data)) in ds1685_rtc_probe()
1108 return PTR_ERR(rtc->data); in ds1685_rtc_probe()
1109 rtc->read = ds1685_indirect_read; in ds1685_rtc_probe()
1110 rtc->write = ds1685_indirect_write; in ds1685_rtc_probe()
1114 if (!rtc->read || !rtc->write) in ds1685_rtc_probe()
1119 rtc->regstep = pdata->regstep; in ds1685_rtc_probe()
1121 rtc->regstep = 1; in ds1685_rtc_probe()
1125 rtc->prepare_poweroff = pdata->plat_prepare_poweroff; in ds1685_rtc_probe()
1129 rtc->wake_alarm = pdata->plat_wake_alarm; in ds1685_rtc_probe()
1133 rtc->post_ram_clear = pdata->plat_post_ram_clear; in ds1685_rtc_probe()
1136 platform_set_drvdata(pdev, rtc); in ds1685_rtc_probe()
1139 ctrla = rtc->read(rtc, RTC_CTRL_A); in ds1685_rtc_probe()
1154 rtc->write(rtc, RTC_CTRL_A, ctrla); in ds1685_rtc_probe()
1157 rtc->write(rtc, RTC_EXT_CTRL_4B, in ds1685_rtc_probe()
1158 (rtc->read(rtc, RTC_EXT_CTRL_4B) | RTC_CTRL_4B_E32K)); in ds1685_rtc_probe()
1161 rtc->write(rtc, RTC_CTRL_B, in ds1685_rtc_probe()
1162 (rtc->read(rtc, RTC_CTRL_B) | RTC_CTRL_B_SET)); in ds1685_rtc_probe()
1165 while (rtc->read(rtc, RTC_EXT_CTRL_4A) & RTC_CTRL_4A_INCR) in ds1685_rtc_probe()
1172 ctrlb = rtc->read(rtc, RTC_CTRL_B); in ds1685_rtc_probe()
1177 rtc->bcd_mode = pdata->bcd_mode; in ds1685_rtc_probe()
1190 hours = rtc->read(rtc, RTC_HRS); in ds1685_rtc_probe()
1192 hours = ds1685_rtc_bcd2bin(rtc, hours, RTC_HRS_12_BCD_MASK, in ds1685_rtc_probe()
1200 rtc->write(rtc, RTC_CTRL_B, ctrlb); in ds1685_rtc_probe()
1203 rtc->write(rtc, RTC_HRS, in ds1685_rtc_probe()
1204 ds1685_rtc_bin2bcd(rtc, hours, in ds1685_rtc_probe()
1209 hours = rtc->read(rtc, RTC_HRS_ALARM); in ds1685_rtc_probe()
1211 hours = ds1685_rtc_bcd2bin(rtc, hours, RTC_HRS_12_BCD_MASK, in ds1685_rtc_probe()
1216 rtc->write(rtc, RTC_HRS_ALARM, in ds1685_rtc_probe()
1217 ds1685_rtc_bin2bcd(rtc, hours, in ds1685_rtc_probe()
1222 rtc->write(rtc, RTC_CTRL_B, ctrlb); in ds1685_rtc_probe()
1226 rtc->write(rtc, RTC_CTRL_B, in ds1685_rtc_probe()
1227 (rtc->read(rtc, RTC_CTRL_B) & ~(RTC_CTRL_B_SET))); in ds1685_rtc_probe()
1230 if (!(rtc->read(rtc, RTC_CTRL_D) & RTC_CTRL_D_VRT)) in ds1685_rtc_probe()
1235 if (!(rtc->read(rtc, RTC_EXT_CTRL_4A) & RTC_CTRL_4A_VRT2)) in ds1685_rtc_probe()
1240 rtc->write(rtc, RTC_CTRL_B, in ds1685_rtc_probe()
1241 (rtc->read(rtc, RTC_CTRL_B) & ~(RTC_CTRL_B_PAU_MASK))); in ds1685_rtc_probe()
1244 rtc->read(rtc, RTC_CTRL_C); in ds1685_rtc_probe()
1247 rtc->write(rtc, RTC_EXT_CTRL_4B, in ds1685_rtc_probe()
1248 (rtc->read(rtc, RTC_EXT_CTRL_4B) & ~(RTC_CTRL_4B_RWK_MASK))); in ds1685_rtc_probe()
1251 rtc->write(rtc, RTC_EXT_CTRL_4A, in ds1685_rtc_probe()
1252 (rtc->read(rtc, RTC_EXT_CTRL_4A) & ~(RTC_CTRL_4A_RWK_MASK))); in ds1685_rtc_probe()
1258 rtc->write(rtc, RTC_EXT_CTRL_4B, in ds1685_rtc_probe()
1259 (rtc->read(rtc, RTC_EXT_CTRL_4B) | RTC_CTRL_4B_KSE)); in ds1685_rtc_probe()
1278 rtc->dev = rtc_dev; in ds1685_rtc_probe()
1293 rtc->irq_num = ret; in ds1685_rtc_probe()
1296 ret = devm_request_threaded_irq(&pdev->dev, rtc->irq_num, in ds1685_rtc_probe()
1305 rtc->irq_num = 0; in ds1685_rtc_probe()
1308 rtc->no_irq = pdata->no_irq; in ds1685_rtc_probe()
1311 ds1685_rtc_switch_to_bank0(rtc); in ds1685_rtc_probe()
1317 nvmem_cfg.priv = rtc; in ds1685_rtc_probe()
1332 struct ds1685_priv *rtc = platform_get_drvdata(pdev); in ds1685_rtc_remove() local
1335 rtc->write(rtc, RTC_CTRL_B, in ds1685_rtc_remove()
1336 (rtc->read(rtc, RTC_CTRL_B) & in ds1685_rtc_remove()
1340 rtc->read(rtc, RTC_CTRL_C); in ds1685_rtc_remove()
1343 rtc->write(rtc, RTC_EXT_CTRL_4B, in ds1685_rtc_remove()
1344 (rtc->read(rtc, RTC_EXT_CTRL_4B) & in ds1685_rtc_remove()
1348 rtc->write(rtc, RTC_EXT_CTRL_4A, in ds1685_rtc_remove()
1349 (rtc->read(rtc, RTC_EXT_CTRL_4A) & in ds1685_rtc_remove()
1380 struct ds1685_priv *rtc; in ds1685_rtc_poweroff() local
1389 rtc = platform_get_drvdata(pdev); in ds1685_rtc_poweroff()
1397 if (!rtc->no_irq) in ds1685_rtc_poweroff()
1398 disable_irq_nosync(rtc->irq_num); in ds1685_rtc_poweroff()
1401 ctrla = rtc->read(rtc, RTC_CTRL_A); in ds1685_rtc_poweroff()
1404 rtc->write(rtc, RTC_CTRL_A, ctrla); in ds1685_rtc_poweroff()
1411 ds1685_rtc_switch_to_bank1(rtc); in ds1685_rtc_poweroff()
1412 ctrl4a = rtc->read(rtc, RTC_EXT_CTRL_4A); in ds1685_rtc_poweroff()
1416 rtc->write(rtc, RTC_EXT_CTRL_4A, ctrl4a); in ds1685_rtc_poweroff()
1424 ctrl4b = rtc->read(rtc, RTC_EXT_CTRL_4B); in ds1685_rtc_poweroff()
1427 rtc->write(rtc, RTC_EXT_CTRL_4B, ctrl4b); in ds1685_rtc_poweroff()
1433 rtc->write(rtc, RTC_EXT_CTRL_4A, in ds1685_rtc_poweroff()