From: Aldo Conte <aldocontelk@gmail.com>
To: jic23@kernel.org
Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
shuah@kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linux.dev
Subject: [PATCH 0/3] iio: light: tcs3472: devm conversion, wait time, locking cleanup
Date: Wed, 6 May 2026 11:43:08 +0200 [thread overview]
Message-ID: <20260506094311.222500-1-aldocontelk@gmail.com> (raw)
This series of changes modernizes the tcs3472 driver by completing the
devm conversion and updating the locking style to use an automatic
guard (mutex). Furthermore, it implement control of the WAIT state,
resolving a TODO.
Patch1: Converts the driver to use device-managed resource allocation.
This removes the need for an explicit remove() callback, since cleanup
is now handled automatically. It also adds a new function called
tcs3472_powerdown_action() that powers down the chip when the driver is
unloaded, removed or when probe fails after the chip has been enabled.
Patch2: adds support for the wait time resolving the old TODO comment.
The user can control the WTIME indirectly by writing to the
sampling_frequency attribute. Changing the sampling
frequency attribute results in a change to the wtime while preserving
the current integration time.
Similarly, if the user has previously set a sampling frequency and
then changes the integration time, the driver re-computes WTIME so the
previous frequency is preserved. The patch also handles the deactivation
of wtime when the requested frequency is very high, as well as the
extension of wtime to its maximum values (by enabling the use of WLONG)
when the requested frequency is very low.
Patch3: converts the remaining mutex_lock()/mutex_unlock() pairs to
guard(mutex).
All patches have been tested on a Raspberry Pi 3B with a TCS3472
connected to I2C-1 at address 0x29. Sampling frequency and integration
time changes have been exercised checking the value of WTIME and
consequently WEN and WLONG. Raw RGBC reads, calibscale, integration_time
and threshold events continue to work as before.
Aldo Conte (3):
iio: light: tcs3472: use devm for resource management
iio: light: tcs3472: implement wait time and sampling frequency
iio: light: tcs3472: Use guard(mutex)() family over manual locking
drivers/iio/light/tcs3472.c | 287 ++++++++++++++++++++++++++----------
1 file changed, 206 insertions(+), 81 deletions(-)
--
2.54.0
next reply other threads:[~2026-05-06 9:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 9:43 Aldo Conte [this message]
2026-05-06 9:43 ` [PATCH 1/3] iio: light: tcs3472: use devm for resource management Aldo Conte
2026-05-06 10:00 ` Andy Shevchenko
2026-05-06 9:43 ` [PATCH 2/3] iio: light: tcs3472: implement wait time and sampling frequency Aldo Conte
2026-05-06 10:19 ` Andy Shevchenko
2026-05-06 18:17 ` Jonathan Cameron
2026-05-06 9:43 ` [PATCH 3/3] iio: light: tcs3472: Use guard(mutex)() family over manual locking Aldo Conte
2026-05-06 10:04 ` Andy Shevchenko
2026-05-06 10:21 ` [PATCH 0/3] iio: light: tcs3472: devm conversion, wait time, locking cleanup Andy Shevchenko
2026-05-06 12:19 ` Aldo Conte
2026-05-06 15:35 ` Aldo Conte
2026-05-06 15:45 ` Andy Shevchenko
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=20260506094311.222500-1-aldocontelk@gmail.com \
--to=aldocontelk@gmail.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=shuah@kernel.org \
/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