Page MenuHomeFreeBSD

DS3231 i2c RTC driver
ClosedPublic

Authored by loos on Oct 27 2014, 4:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 19, 8:10 AM
Unknown Object (File)
Sat, Apr 12, 1:57 AM
Unknown Object (File)
Fri, Mar 28, 2:53 AM
Unknown Object (File)
Mar 16 2025, 1:16 PM
Unknown Object (File)
Mar 4 2025, 9:53 PM
Unknown Object (File)
Feb 10 2025, 5:09 AM
Unknown Object (File)
Feb 5 2025, 12:04 AM
Unknown Object (File)
Feb 4 2025, 11:27 PM

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
Lint Skipped
Unit
Tests Skipped

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 ↗(On Diff #2127)

The comma is not needed.

46 ↗(On Diff #2127)

s/The access/Access/

48 ↗(On Diff #2127)

s/via/with/

66 ↗(On Diff #2127)

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 ↗(On Diff #2127)

"it" is vague. Maybe:

"... a temperature conversion is started."

72 ↗(On Diff #2127)

s/afterwards/afterward/

76 ↗(On Diff #2127)

Again, "it" is vague.

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

77 ↗(On Diff #2127)

"If set to 0,"

80 ↗(On Diff #2127)

s/Selects/Select/

84 ↗(On Diff #2127)

s/Sets/Set/

86 ↗(On Diff #2127)

s/On/In/

87 ↗(On Diff #2127)

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

106 ↗(On Diff #2127)

s/Is the/The/

108 ↗(On Diff #2127)

Avoid "you" and "your". Maybe:

"to attach to."

But that's ugly. Alternate:

Attach to this
.Xr iicbus 4
device.

110 ↗(On Diff #2127)

s/Is the/The/

122 ↗(On Diff #2127)

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

device is typically:

138 ↗(On Diff #2127)

"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 ↗(On Diff #2127)

Should this be static?

85 ↗(On Diff #2127)

Don't you want to initialise it like above?

232 ↗(On Diff #2127)

You could pass the softc to the sysctl handler instead.

456 ↗(On Diff #2127)

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 ↗(On Diff #2127)

s/like/such as/

118 ↗(On Diff #2127)

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 ↗(On Diff #2127)

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

146 ↗(On Diff #2127)

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

427 ↗(On Diff #2127)

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).