iio: chemical: sgp40: add funtions for serial number readback, self-test, and heater control.
Get series with b4
b4 am [email protected]Versions newest first
- v2 Latest5 patches 12 repliesIn review
Changes in v2 from the cover letter
- Added patch for replacing mutex_lock()/mutex_unlock() with guard().
- Added guard against concurrent access to the device in sgp40_get_serial_number(), sgp40_execute_self_test(), and sgp40_turn_heater_off().
- Return EIO if CRC check fails in sgp40_get_serial_number(), sgp40_execute_self_test(), sgp40_and turn_heater_off().
- Fixed formatting issues, missing newlines, unnecessary debug-print and unnecessary 0LL constant, added comments for sleep times.
- Changed 1 ms sleeps in sgp40_get_serial_number() and sgp40_turn_heater_off() to use fsleep instead of msleep (checkpatch.pl warning against using short msleep)
- Removed storing serial-number in driver-data, instead retrieve it when requested.
- Use the existing serialnumber ABI for presenting the SN to userspace.
- Fixed error paths in sgp40_turn_heater_off(). In v1 positive numbers were returned for errors. Fail the driver probe if the self-test fails to run, or the response is not PASS or FAIL.
- Use the existing heater_enable ABI for heater control.
- Return any negative errors from i2c_master_send() without converting them to -EIO in get_serial_number, execute_self_test, and turn_heater_off.
- Added patch for fixing the i2c error conversion issue in sgp40_measure_resistance_raw().
- Log errors with dev_err_probe() instead of dev_err().
- Link to v1: https://lore.kernel.org/linux-iio/[email protected]/
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | iio: chemical: sgp40: Do not convert I2C errors to EIOdrivers/ | +2 | 1 reply | |
| 2/5 | iio: chemical: sgp40: Replace manual locking with guard()drivers/ | +13 | 4 replies | |
| 3/5 | iio: chemical: sgp40: Implement get_serial_number-commanddrivers/ | +76 | 2 replies | |
| 4/5 | iio: chemical: sgp40: Implement execute_self_test-commanddrivers/ | +58 | 2 replies | |
| 5/5 | iio: chemical: sgp40: Implement turn_heater_off-commanddrivers/ | +61 | 3 replies |
Reviews trailers per patch
1 of 5 patches has a Reviewed-by or Acked-by.
| Patch | Joshua Crofts |
|---|---|
| 1/5 | R-b |
| 2/5 | |
| 3/5 | |
| 4/5 | |
| 5/5 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/5] iio: chemical: sgp40: add funtions for serial number readback, self-test, and heater control.
Add commands for getting the Sensirion SGP40 VOC-sensor serial number, controlling the device's internal heater, and running the device self-test.
Replace the manual mutex_lock()/mutex_unlock() with guard(mutex). Simplifies the locking patterns, making it easier to add new mutex-guarded variable 'heater_enabled' in patch 5.
Extends the lock to cover i2c communications with the device.
Fixes issue with converting all i2c errors to EIO in sgp40_measure_resistance_raw(). Included in the patchset as it was found due to reviewer flagging the same issue in the v1 patches.
Changes in v2:
- Added patch for replacing mutex_lock()/mutex_unlock() with guard().
- Added guard against concurrent access to the device in sgp40_get_serial_number(), sgp40_execute_self_test(), and sgp40_turn_heater_off().
- Return EIO if CRC check fails in sgp40_get_serial_number(), sgp40_execute_self_test(), sgp40_and turn_heater_off().
- Fixed formatting issues, missing newlines, unnecessary debug-print and unnecessary 0LL constant, added comments for sleep times.
- Changed 1 ms sleeps in sgp40_get_serial_number() and sgp40_turn_heater_off() to use fsleep instead of msleep (checkpatch.pl warning against using short msleep)
- Removed storing serial-number in driver-data, instead retrieve it when requested.
- Use the existing serialnumber ABI for presenting the SN to userspace.
- Fixed error paths in sgp40_turn_heater_off(). In v1 positive numbers were returned for errors. Fail the driver probe if the self-test fails to run, or the response is not PASS or FAIL.
- Use the existing heater_enable ABI for heater control.
- Return any negative errors from i2c_master_send() without converting them to -EIO in get_serial_number, execute_self_test, and turn_heater_off.
- Added patch for fixing the i2c error conversion issue in sgp40_measure_resistance_raw().
- Log errors with dev_err_probe() instead of dev_err().
- Link to v1: https://lore.kernel.org/linux-iio/[email protected]/
Jaakko Koivisto (5):
iio: chemical: sgp40: Do not convert I2C errors to EIO
iio: chemical: sgp40: Replace manual locking with guard()
iio: chemical: sgp40: Implement get_serial_number-command
iio: chemical: sgp40: Implement execute_self_test-command
iio: chemical: sgp40: Implement turn_heater_off-command
drivers/iio/chemical/sgp40.c | 231 +++++++++++++++++++++++++++++++---- 1 file changed, 210 insertions(+), 21 deletions(-)
Signature · 1 line
2.56.0