From: Jaakko Koivisto <jmatko@utu.fi>
To: "Andreas Klinger" <ak@it-klinger.de>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>
Cc: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Jaakko Koivisto <jmatko@utu.fi>
Subject: [PATCH v2 0/5] iio: chemical: sgp40: add funtions for serial number readback, self-test, and heater control.
Date: Mon, 2 Nov 2026 11:12:53 +0200 [thread overview]
Message-ID: <20261102091258.247402-1-jmatko@utu.fi> (raw)
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/20260918134019.1101308-1-jmatko@utu.fi/
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(-)
--
2.56.0
next reply other threads:[~2026-11-02 9:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 9:12 Jaakko Koivisto [this message]
2026-11-02 9:12 ` [PATCH v2 1/5] iio: chemical: sgp40: Do not convert I2C errors to EIO Jaakko Koivisto
2026-11-02 9:54 ` Joshua Crofts
2026-11-02 9:12 ` [PATCH v2 2/5] iio: chemical: sgp40: Replace manual locking with guard() Jaakko Koivisto
2026-11-02 10:10 ` Joshua Crofts
2026-11-02 9:12 ` [PATCH v2 3/5] iio: chemical: sgp40: Implement get_serial_number-command Jaakko Koivisto
2026-11-02 10:20 ` Joshua Crofts
2026-11-02 9:12 ` [PATCH v2 4/5] iio: chemical: sgp40: Implement execute_self_test-command Jaakko Koivisto
2026-11-02 10:21 ` Joshua Crofts
2026-11-02 9:56 ` [PATCH v2 5/5] iio: chemical: sgp40: Implement turn_heater_off-command Jaakko Koivisto
2026-11-02 10:24 ` Joshua Crofts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261102091258.247402-1-jmatko@utu.fi \
--to=jmatko@utu.fi \
--cc=ak@it-klinger.de \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®