summaryrefslogtreecommitdiff
path: root/sys/dev/i2c/m41t8x.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2022-10-12 13:39:51 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2022-10-12 13:39:51 +0000
commit25399137b2049d8c660c7d2d02a0588cfd2d0581 (patch)
tree3e927df3dc1e168a17ba7778f1c06eb5e5c276c7 /sys/dev/i2c/m41t8x.c
parent4557e0d8a16da274ab74684f9f41d28bfca45095 (diff)
Extend struct todr_chip_handle with a todr_quality member. This allows us
to assign a quality to RTC implementation and pick the "best" RTC if a system has multiple RTCs (or multiple interfaces to an RTC). This allows us to prefer a battery-backed I2C RTC over an RTC that is part of the SoC which is only running of the SoC is powered. It also allows us to work around issues with firmware RTC interfaces that may lie to us or even crash the system. This change makes sure the todr_quality member of the struct is always initialized. In most cases the quality will be set to zero; further adjustments of the quality for specific subsystems/architectures will follow. ok cheloha@, patrick@
Diffstat (limited to 'sys/dev/i2c/m41t8x.c')
-rw-r--r--sys/dev/i2c/m41t8x.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/i2c/m41t8x.c b/sys/dev/i2c/m41t8x.c
index fa9a14f6d76..b6e2a90da65 100644
--- a/sys/dev/i2c/m41t8x.c
+++ b/sys/dev/i2c/m41t8x.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m41t8x.c,v 1.2 2020/10/23 20:55:15 patrick Exp $ */
+/* $OpenBSD: m41t8x.c,v 1.3 2022/10/12 13:39:50 kettenis Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -75,6 +75,7 @@ m41t8xrtc_attach(struct device *parent, struct device *self, void *aux)
sc->sc_todr.cookie = sc;
sc->sc_todr.todr_gettime = m41t8xrtc_gettime;
sc->sc_todr.todr_settime = m41t8xrtc_settime;
+ sc->sc_todr.todr_quality = 1000;
todr_attach(&sc->sc_todr);
printf("\n");