Lines Matching full:cmos
3 * RTC class driver for "CMOS RTC": PCs, ACPI, etc
10 * The original "cmos clock" chip was an MC146818 chip, now obsolete.
253 struct cmos_rtc *cmos; member
269 if (p->cmos->day_alrm) { in cmos_read_alarm_callback()
271 time->tm_mday = CMOS_READ(p->cmos->day_alrm) & 0x3f; in cmos_read_alarm_callback()
275 if (p->cmos->mon_alrm) { in cmos_read_alarm_callback()
276 time->tm_mon = CMOS_READ(p->cmos->mon_alrm); in cmos_read_alarm_callback()
287 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_read_alarm() local
289 .cmos = cmos, in cmos_read_alarm()
294 if (!is_valid_irq(cmos->irq)) in cmos_read_alarm()
327 if (cmos->day_alrm) { in cmos_read_alarm()
333 if (cmos->mon_alrm) { in cmos_read_alarm()
348 static void cmos_checkintr(struct cmos_rtc *cmos, unsigned char rtc_control) in cmos_checkintr() argument
362 rtc_update_irq(cmos->rtc, 1, rtc_intr); in cmos_checkintr()
365 static void cmos_irq_enable(struct cmos_rtc *cmos, unsigned char mask) in cmos_irq_enable() argument
373 cmos_checkintr(cmos, rtc_control); in cmos_irq_enable()
381 if (cmos->wake_on) in cmos_irq_enable()
382 cmos->wake_on(cmos->dev); in cmos_irq_enable()
385 cmos_checkintr(cmos, rtc_control); in cmos_irq_enable()
388 static void cmos_irq_disable(struct cmos_rtc *cmos, unsigned char mask) in cmos_irq_disable() argument
399 if (cmos->wake_off) in cmos_irq_disable()
400 cmos->wake_off(cmos->dev); in cmos_irq_disable()
403 cmos_checkintr(cmos, rtc_control); in cmos_irq_disable()
408 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_validate_alarm() local
413 if (!cmos->day_alrm) { in cmos_validate_alarm()
425 } else if (!cmos->mon_alrm) { in cmos_validate_alarm()
474 struct cmos_rtc *cmos; member
489 cmos_irq_disable(p->cmos, RTC_AIE); in cmos_set_alarm_callback()
497 if (p->cmos->day_alrm) { in cmos_set_alarm_callback()
498 CMOS_WRITE(p->mday, p->cmos->day_alrm); in cmos_set_alarm_callback()
499 if (p->cmos->mon_alrm) in cmos_set_alarm_callback()
500 CMOS_WRITE(p->mon, p->cmos->mon_alrm); in cmos_set_alarm_callback()
513 cmos_irq_enable(p->cmos, RTC_AIE); in cmos_set_alarm_callback()
518 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_set_alarm() local
520 .cmos = cmos, in cmos_set_alarm()
527 if (!is_valid_irq(cmos->irq)) in cmos_set_alarm()
562 cmos->alarm_expires = rtc_tm_to_time64(&t->time); in cmos_set_alarm()
569 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_alarm_irq_enable() local
575 cmos_irq_enable(cmos, RTC_AIE); in cmos_alarm_irq_enable()
577 cmos_irq_disable(cmos, RTC_AIE); in cmos_alarm_irq_enable()
587 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_procfs() local
613 cmos->rtc->irq_freq, in cmos_procfs()
666 struct cmos_rtc *cmos = priv; in cmos_nvram_write() local
679 if (off == cmos->day_alrm in cmos_nvram_write()
680 || off == cmos->mon_alrm in cmos_nvram_write()
681 || off == cmos->century) in cmos_nvram_write()
863 /* force periodic irq to CMOS reset default of 1024Hz; in cmos_do_probe()
965 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_do_remove() local
968 cmos_do_shutdown(cmos->irq); in cmos_do_remove()
970 if (is_valid_irq(cmos->irq)) { in cmos_do_remove()
971 free_irq(cmos->irq, cmos->rtc); in cmos_do_remove()
976 cmos->rtc = NULL; in cmos_do_remove()
978 ports = cmos->iomem; in cmos_do_remove()
983 cmos->iomem = NULL; in cmos_do_remove()
985 cmos->dev = NULL; in cmos_do_remove()
990 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_aie_poweroff() local
996 if (!cmos->alarm_expires) in cmos_aie_poweroff()
1019 if (cmos->alarm_expires == t_now + 1) { in cmos_aie_poweroff()
1026 } else if (cmos->alarm_expires > t_now + 1) { in cmos_aie_poweroff()
1035 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_suspend() local
1040 cmos->suspend_ctrl = tmp = CMOS_READ(RTC_CONTROL); in cmos_suspend()
1052 cmos_checkintr(cmos, tmp); in cmos_suspend()
1057 cmos->enabled_wake = 1; in cmos_suspend()
1058 if (cmos->wake_on) in cmos_suspend()
1059 cmos->wake_on(dev); in cmos_suspend()
1061 enable_irq_wake(cmos->irq); in cmos_suspend()
1064 memset(&cmos->saved_wkalrm, 0, sizeof(struct rtc_wkalrm)); in cmos_suspend()
1065 cmos_read_alarm(dev, &cmos->saved_wkalrm); in cmos_suspend()
1090 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_check_wkalrm() local
1098 if (!(cmos->suspend_ctrl & RTC_AIE)) in cmos_check_wkalrm()
1108 if (t_now >= cmos->alarm_expires && cmos_use_acpi_alarm()) { in cmos_check_wkalrm()
1110 cmos_interrupt(0, (void *)cmos->rtc); in cmos_check_wkalrm()
1118 t_saved_expires = rtc_tm_to_time64(&cmos->saved_wkalrm.time); in cmos_check_wkalrm()
1120 cmos->saved_wkalrm.enabled != current_alarm.enabled) { in cmos_check_wkalrm()
1121 cmos_set_alarm(dev, &cmos->saved_wkalrm); in cmos_check_wkalrm()
1130 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_resume() local
1133 if (cmos->enabled_wake && !cmos_use_acpi_alarm()) { in cmos_resume()
1134 if (cmos->wake_off) in cmos_resume()
1135 cmos->wake_off(dev); in cmos_resume()
1137 disable_irq_wake(cmos->irq); in cmos_resume()
1138 cmos->enabled_wake = 0; in cmos_resume()
1145 tmp = cmos->suspend_ctrl; in cmos_resume()
1146 cmos->suspend_ctrl = 0; in cmos_resume()
1167 rtc_update_irq(cmos->rtc, 1, mask); in cmos_resume()
1186 /* On non-x86 systems, a "CMOS" RTC lives most naturally on platform_bus.
1201 struct cmos_rtc *cmos = dev_get_drvdata(dev); in rtc_handler() local
1213 cmos_interrupt(0, (void *)cmos->rtc); in rtc_handler()
1223 rtc_update_irq(cmos->rtc, 1, rtc_intr); in rtc_handler()
1278 /* Every ACPI platform has a mc146818 compatible "cmos rtc". Here we find
1319 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_check_acpi_rtc_status() local
1334 rtc_update_irq(cmos->rtc, 1, mask); in cmos_check_acpi_rtc_status()
1395 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_pnp_shutdown() local
1404 cmos_do_shutdown(cmos->irq); in cmos_pnp_shutdown()
1499 struct cmos_rtc *cmos = dev_get_drvdata(dev); in cmos_platform_shutdown() local
1508 cmos_do_shutdown(cmos->irq); in cmos_platform_shutdown()
1570 MODULE_DESCRIPTION("Driver for PC-style 'CMOS' RTCs");