Up to [cvs.NetBSD.org] / src / sys / dev / i2c
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
The SHT3x temperature and humidity sensor has a set of commands that can do the measurement by using I2C clock stretching in single shot mode. Add a sysctl to allow the driver to use those commands. This is more efficient than doing the usual polling method of getting the measurements back from the chip, but only works if the I2C master supports clock stretching.
s/peridoic/periodic/ in sysctl description and one more typo fix in comment.
The SHT3X_READ_SERIAL_NUMBER command on the SHT3x sensors is undocumented, but used in a lot of other drivers. When I wrote the driver it didn't seem like it needed any sort of delay, and that was true if the I2C bus is short. However, when the I2C bus is extended out to a great length using active terminators, or some such, you won't get any data back from the SHT3X_READ_SERIAL_NUMBER command as you will try to read from the bus before the data is there. The SHT3X device works this way.. you can't start reading back data too soon after issuing a command to the device. So, add a delay like the other commands. The amount of delay was estimated based upon field observation.
After testing with a couple of more samples of the SHT3x sensor chip it was found that the datasheet does not appear to provide enough information to make use of the alarm and interrupt function work. So actually remove the dead code that was an attempt at making that all work. Adjust the man page to mention that this.
For device modules that provide both auto-config and /dev/xxx interfaces, make sure that initialization and destruction follow the proper sequence. This is triggered by the recent changes to the devsw stuff; per riastradh@ the required call sequence is: devsw_attach() config_init_component() or config_cf*_attach() ... config_fini_component() or config_cf*_detach() devsw_detach() While here, add a few missing calls to some of the detach routines. Testing of these changes has been limited to: 1. compile without build break 2. no related test failures from atf 3. modload/modunload work as well as before. No functional device testing done, since I don't have any of these devices. Let me know of any damage I might cause here! XXX Some of the modules affected by this commit are already XXX broken; see kern/56772. This commit does not break any additional modules (as far as I know).
These modules need to depend on iic, not just on i2cexec. (They will still recursively get i2cexec since the iic depends on it.) Partial fix for kern/56772
Fix some regressions that were introduced. One must make sure that you release the i2c bus if you acquire. One must not try to release the i2c bus if you failed to acquire it. One can't leave too early from the single-shot refresh without checking the status register as there may have been a reset and releasing the i2c bus.
Brad wants the __did_not_work code back :-)
simplify the code and remove unused (it is in CVS anyway). Try to merge duplicate code. Follow KNF. Brad, please test!
Driver for the Sensirion SHT30/SHT31/SHT35 temperature and humidity sensor such as: https://www.adafruit.com/product/2857 This is a higher priced sensor with a lot of features, including the ability to do sub-second periodic updates. The driver supports everything about the sensor except for the alert pin.