Page MenuHomeFreeBSD

DS3231 i2c RTC driver
ClosedPublic

Authored by loos on Oct 27 2014, 4:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 27, 12:30 AM
Unknown Object (File)
Sat, Oct 18, 5:41 PM
Unknown Object (File)
Sat, Oct 18, 5:41 PM
Unknown Object (File)
Sat, Oct 18, 5:41 PM
Unknown Object (File)
Sat, Oct 18, 5:41 PM
Unknown Object (File)
Sat, Oct 18, 3:24 AM
Unknown Object (File)
Wed, Oct 15, 11:08 PM
Unknown Object (File)
Sep 13 2025, 6:55 AM

Details

Summary

Adds the driver for DS3231 'extremely accurate' i2c-integrated RTC/TCXO/Crystal.

The driver allows the setting of the 32 kHz output state, the interrupt/SQW pin mode, the square-wave output frequency and the temperature reading.

Tested on Raspberry Pi.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

loos retitled this revision from to DS3231 i2c RTC driver.
loos updated this object.
loos edited the test plan for this revision. (Show Details)

Chris, could you review the man page ?

Note: I have only read the man page, not tested it for errors with textproc/igor or mandoc -Tlint.

share/man/man4/ds3231.4
43

The comma is not needed.

46

s/The access/Access/

48

s/via/with/

66

s/Is the/The/

The "read" in "temperature read by the RTC" can be confused with "read-only". Maybe:

"Current temperature of the RTC, a read-only value."

70

"it" is vague. Maybe:

"... a temperature conversion is started."

72

s/afterwards/afterward/

76

Again, "it" is vague.

is set to square-wave, battery-backed square-wave output is enabled.

77

"If set to 0,"

80

s/Selects/Select/

84

s/Sets/Set/

86

s/On/In/

87

alarms.
In square-wave mode, the SQW pin drives a square-wave of

106

s/Is the/The/

108

Avoid "you" and "your". Maybe:

"to attach to."

But that's ugly. Alternate:

Attach to this
.Xr iicbus 4
device.

110

s/Is the/The/

122

"usually looks like" is better said as "typical":

device is typically:

138

"should" is a recommendation. Use "must" if it is required.

rpaulo added a reviewer: rpaulo.
rpaulo added a subscriber: rpaulo.

Only minor comments.

sys/dev/iicbus/ds3231.c
74

Should this be static?

85

Don't you want to initialise it like above?

232

You could pass the softc to the sysctl handler instead.

456

Spaces instead of tabs?

This revision is now accepted and ready to land.Nov 1 2014, 1:42 AM

Looks good.

share/man/man4/ds3231.4
100

s/like/such as/

118

s/like/such as/ (this is just a pet peeve of mine; it's not just systems that are like ARM)

Also, more generally, I've never seen us refer to FDT metadata in manpages before, and the bindings are documented extensively elsewhere, do we really want to recapitulate them?

The problem is that "elsewhere" is truly elsewhere, the docs live in their own public repo that we don't control. Can we get away with a non-specific hand-wavy reference to them? Something like

On an FDT based system the device address is configured with the standard "i2c-address" property.

sys/dev/iicbus/ds3231.c
109

It seems odd to be setting these things in the read routine rather than the write routine.

146

does this need throttling, or does something just naturally ensure that this routine doesn't get called very often?

427

should this be BUS_PROBE_NOWILDCARD? I think that's the right value for a hinted child, and is either right or harmless for an FDT child.

loos edited edge metadata.

Update all files with the fixes for the aforementioned issues.

This revision now requires review to proceed.Feb 26 2015, 10:13 PM
ian edited edge metadata.
This revision is now accepted and ready to land.Feb 26 2015, 10:21 PM
rpaulo edited edge metadata.
loos updated this revision to Diff 4031.

Closed by commit rS279399 (authored by @loos).