Up to [cvs.NetBSD.org] / src / sys / dev / i2c
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
ds2482ow(4): KNF No functional change intended. Non-whitespace changes: 1. Sort includes. 2. Say `if (sc->sc_is_800)', not `if (sc->sc_is_800 == true)'; no need to have multiple redundant verbs and boolean tests in this phrasing. 3. Use __nothing (a statement that has no effect), not empty token sequence, for macros that have no effect. This avoids potential confusion in places that expect exactly one statement. (If this change does have a functional effect, well, something must have been broken before!) 4. Omit needless `return;' at the end of void functions. (ds2482_attach still needs something after `out:', though, and `out: return;' is a little less obscure than `out:;'.) Some of this nesting is a little excessive. It would help legibility and avoid excessive nesting depth to rephrase things like error = foo(); if (!error) error = bar(); if (!error) { error = baz(); if (!error) error = quux(); if (!error) { error = zot(); if (!error) { error = mumble(); if (!error) { error = frotz(); if (!error) { *obuf = xbuf; } } } } } as error = foo(); if (error) goto out; /* or break, in this case */ error = bar(); if (error) goto out; error = baz(); if (error) goto out; error = quux(); if (error) goto out; error = zot(); if (error) goto out; error = mumble(); if (error) goto out; error = frotz(); if (error) goto out; *obuf = xbuf; so that the indentation level doesn't grow indefinitely and the expected-taken normal path remains unindented while the expected-not-taken error branches get indentation. (But that's a lot more churn to the code, and more error-prone, than seemed appropriate here.)
Add a driver for the Maxim DS2482-100 and DS2482-800 I2C to 1-Wire bridge. This chip provides a I2C device that then has 1 or 8 1-Wire busses on the other side. The 1-Wire buses show up as onewire(4) buses in the NetBSD. The chip can be used in situations where: * You have a I2C bus extended a long distance, say with a LTC4311 active terminator / extender or one of the differential I2C extenders and you would like to have a 1-Wire device on the far end and it isn't possible to add wiring to get to the far end. * You are either out of GPIO pins or the GPIO pins are not reliable enough to use gpioow(4), but you do have working I2C. The DS2482 does all of the 1-Wire signals in hardware and provides for a couple of pullup options for the 1-Wire devices. All of the functions of the DS2482-100 and -800 are supported except for overdrive speed support. To do this will likely require some API changes to onewire(4). Breakout boards exist for the DS2482 for both variants, but they appear to be more expensive than expected. The chip itself is quiet cheap and wasn't all that hard to SMD solder to a board. No other components are really needed. There are other members in the same family, the DS2482-101, DS2484 and DS2485. The DS2482-101 has a sleep pin, but from the datasheet appears to program the same as the -100 variant. The DS2484 has a slightly different way to set configuration information and probably won't quite work with the driver, but isn't far off. The DS2485 is very different and would require a new driver to function.