linux-block.git
7 weeks agodocs: iio: add documentation for ad3552r driver
Angelo Dureghello [Wed, 9 Apr 2025 18:36:29 +0000 (20:36 +0200)]
docs: iio: add documentation for ad3552r driver

Add documentation for ad3552r driver, needed to describe the high-speed
driver debugfs attributes and shows how the user may use them.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Link: https://patch.msgid.link/20250409-wip-bl-ad3552r-fixes-v5-2-fb429c3a6515@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: dac: adi-axi-dac: add cntrl chan check
Angelo Dureghello [Wed, 9 Apr 2025 18:36:28 +0000 (20:36 +0200)]
iio: dac: adi-axi-dac: add cntrl chan check

Add validity check on CNTRL_X channels (valid as 0 to 15).

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Link: https://patch.msgid.link/20250409-wip-bl-ad3552r-fixes-v5-1-fb429c3a6515@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: imu: inv_icm42600: switch to use generic name irq get
Jean-Baptiste Maneyrol [Thu, 10 Apr 2025 15:39:41 +0000 (17:39 +0200)]
iio: imu: inv_icm42600: switch to use generic name irq get

Use generic fwnode_irq_get_byname() for getting interrupt pin using
interrupt name. Only INT1 is supported by the driver currently.

If not found fallback to first defined interrupt to keep compatibility.

Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20250410-iio-imu-inv-icm42600-rework-interrupt-using-names-v4-2-19e4e2f8f7eb@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agodt-bindings: iio: imu: icm42600: add interrupt naming support
Jean-Baptiste Maneyrol [Thu, 10 Apr 2025 15:39:40 +0000 (17:39 +0200)]
dt-bindings: iio: imu: icm42600: add interrupt naming support

Add interrupt-names field for specifying interrupt pin configured.

Chips are supporting up to 2 interrupt pins with configurable interrupt
sources. Change interrupt to support 1 or 2 entries.

Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/20250410-iio-imu-inv-icm42600-rework-interrupt-using-names-v4-1-19e4e2f8f7eb@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoMAINTAINERS: A driver for TI/ROHM ADCs
Matti Vaittinen [Mon, 7 Apr 2025 11:36:59 +0000 (14:36 +0300)]
MAINTAINERS: A driver for TI/ROHM ADCs

Add undersigned as a maintainer for the ti-adc128s052.c which supports a
few TI's ADCs and the ROHM Semiconductor BD79704 ADC.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/b303bf42b84e7ab143ff6a4a810f7d788e210b86.1744022065.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ti-adc128s052: Support ROHM BD79104
Matti Vaittinen [Mon, 7 Apr 2025 11:36:47 +0000 (14:36 +0300)]
iio: adc: ti-adc128s052: Support ROHM BD79104

The ROHM BD79104 ADC has identical SPI communication logic as the
ti-adc128s052. Eg, SPI transfer should be 16 clk cycles, conversion is
started when the CS is pulled low, and channel selection is done by
writing the channel ID after two zero bits. Data is contained in
big-endian format in the last 12 bits.

The BD79104 has two input voltage pins. Data sheet uses terms "vdd" and
"iovdd". The "vdd" is used also as an analog reference voltage. Hence
the driver expects finding these from the device-tree, instead of having
the "vref" only as TI's driver.

NOTE: The TI's data sheet[1] does show that the TI's IC does actually
have two voltage inputs as well. Pins are called Va (analog reference)
and Vd (digital supply pin) - but I keep the existing driver behaviour
for the TI's IC "as is", because I have no HW to test changes, and
because I have no real need to touch it.

NOTE II: The BD79104 requires SPI MODE 3.

NOTE III: I used evaluation board "BD79104FV-EVK-001" made by ROHM. With
this board I had to drop the SPI speed below the 20M which is mentioned
in the data-sheet [2]. This, however, may be a limitation of the EVK
board, not the component itself.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Datasheet: https://www.ti.com/lit/ds/symlink/adc128s052.pdf # [1]
Datasheet: https://fscdn.rohm.com/en/products/databook/datasheet/ic/data_converter/dac/bd79104fv-la-e.pdf # [2]
Link: https://patch.msgid.link/36ffa72cbdf8dbbdf1e612040db82ebcdf73fa24.1744022065.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ti-adc128s052: Simplify using guard(mutex)
Matti Vaittinen [Mon, 7 Apr 2025 11:36:35 +0000 (14:36 +0300)]
iio: adc: ti-adc128s052: Simplify using guard(mutex)

Error path in ADC reading function can be slighly simplified using the
guard(mutex).

Use guard(mutex) and document the mutex purpose.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/c4262cbf55748d505a74249d2bf46d7c3594d838.1744022065.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ti-adc128s052: Use devm_mutex_init()
Matti Vaittinen [Mon, 7 Apr 2025 11:36:23 +0000 (14:36 +0300)]
iio: adc: ti-adc128s052: Use devm_mutex_init()

Quoting Jonathan:
"Whilst it doesn't bring huge advantage, now we have devm_mutex_init()
it seems reasonable to use it and maybe catch a use after free for the
lock"

Switch to use devm_mutex_init() while working on this file.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/efe4a039e2bfbf4dcf30743f6b7b88fce3b9ee39.1744022065.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ti-adc128s052: Be consistent with arrays
Matti Vaittinen [Mon, 7 Apr 2025 11:36:11 +0000 (14:36 +0300)]
iio: adc: ti-adc128s052: Be consistent with arrays

The ti-adc128s052 driver has NULL terminated ID arrays for the
of_device_id, spi_device_id and acpi_device_id. All of these are
terminated by having an empty string as the last member of an array.
Only the of_device_id array uses the /* sentinel */ comment.

It's better to be consistent.

This /* sentinel */ comment serves no real purpose these days as people
are used to seeing these ID lists terminated with an empty array
element.

Drop the /* sentinel */ from the of_device_id.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/bb58002accc696bd4a8fbbab37100c6fa0c29941.1744022065.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ti-adc128s052: Simplify using be16_to_cpu()
Matti Vaittinen [Mon, 7 Apr 2025 11:35:56 +0000 (14:35 +0300)]
iio: adc: ti-adc128s052: Simplify using be16_to_cpu()

The register data is 12-bit big-endian data. Use be16_to_cpu() to do
the conversion, and simple bitwise AND for masking to make it more
obvious.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/8202060d90221beb9b8cf467606641349ad47fe9.1744022065.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agodt-bindings: ROHM BD79104 ADC
Matti Vaittinen [Mon, 7 Apr 2025 10:45:06 +0000 (13:45 +0300)]
dt-bindings: ROHM BD79104 ADC

The ROHM BD79104 is a 12-bit, 8-channel ADC with two power supply pins,
connected to SPI. It's worth noting the IC requires SPI MODE 3, (CPHA =
1, CPOL = 1).

I used an evaluation board "BD79104FV-EVK-001" from ROHM. With this
board I had problems to have things working correctly with higher SPI
clock frequencies. I didn't do thorough testing for maximum frequency
though. First attempt was 40M, then 20M and finally 4M. With 20M it
seemed as if the read values were shifted by 1 bit. With 4M it worked
fine.

The component data-sheet is not exact what comes to the maximum SPI
frequency. It says SPI frequency is 20M - "unless othervice specified".
Additionally, it says that maximum sampling rate is 1Mhz, and since
reading a sample requires writing the channel (16 bits) and reading
data (16 bits) - we get some upper limit from this.

>From the "frequency is 20M, unless othervice specified" I picked the
maximum frequency 20M - and did assumption that my problems with 20M
weren't related to the BD79104 - but to the evaluation board
"BD79104FV-EVK-001".

Add bindings for the ROHM BD79104 ADC.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/2a4c65ee35cb79c6b29dbc59cfd9bc7d615a08ac.1744022065.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: addac: ad74115: use new GPIO line value setter callbacks
Bartosz Golaszewski [Wed, 9 Apr 2025 08:40:45 +0000 (10:40 +0200)]
iio: addac: ad74115: use new GPIO line value setter callbacks

struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250409-gpiochip-set-rv-iio-v2-7-4b36428f39cb@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: addac: ad74413r: use new GPIO line value setter callbacks
Bartosz Golaszewski [Wed, 9 Apr 2025 08:40:44 +0000 (10:40 +0200)]
iio: addac: ad74413r: use new GPIO line value setter callbacks

struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250409-gpiochip-set-rv-iio-v2-6-4b36428f39cb@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ad4130: use new GPIO line value setter callbacks
Bartosz Golaszewski [Wed, 9 Apr 2025 08:40:43 +0000 (10:40 +0200)]
iio: adc: ad4130: use new GPIO line value setter callbacks

struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250409-gpiochip-set-rv-iio-v2-5-4b36428f39cb@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ti-ads7950: use new GPIO line value setter callbacks
Bartosz Golaszewski [Wed, 9 Apr 2025 08:40:42 +0000 (10:40 +0200)]
iio: adc: ti-ads7950: use new GPIO line value setter callbacks

struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250409-gpiochip-set-rv-iio-v2-4-4b36428f39cb@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: dac: ad5592r: use new GPIO line value setter callbacks
Bartosz Golaszewski [Wed, 9 Apr 2025 08:40:41 +0000 (10:40 +0200)]
iio: dac: ad5592r: use new GPIO line value setter callbacks

struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250409-gpiochip-set-rv-iio-v2-3-4b36428f39cb@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: dac: ad5592r: use lock guards
Bartosz Golaszewski [Wed, 9 Apr 2025 08:40:40 +0000 (10:40 +0200)]
iio: dac: ad5592r: use lock guards

Use lock guards from linux/cleanup.h to simplify the code and remove
some labels.

Note that we need to initialize some variables even though it's not
technically required as scoped_guards() are implemented as for loops.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250409-gpiochip-set-rv-iio-v2-2-4b36428f39cb@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: dac: ad5592r: destroy mutexes in detach paths
Bartosz Golaszewski [Wed, 9 Apr 2025 08:40:39 +0000 (10:40 +0200)]
iio: dac: ad5592r: destroy mutexes in detach paths

The locks used here are initialized but never released which causes
resource leaks with mutex debugging enabled. Add missing calls to
mutex_destroy() or use devres if applicable.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250409-gpiochip-set-rv-iio-v2-1-4b36428f39cb@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: bd79124: Use set_rv and set_multiple_rv
Matti Vaittinen [Mon, 7 Apr 2025 07:30:47 +0000 (10:30 +0300)]
iio: bd79124: Use set_rv and set_multiple_rv

The new GPIO callbacks 'set_rv' and 'set_multiple_rv' allow returning a
success code to indicate failures when setting GPIO status. Use them to
allow callers to know when things go south.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/Z_N_J52IZ2IaWawl@mva-rohm
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoMAINTAINERS: IIO: Update reviewers for the subsystem
Jonathan Cameron [Sun, 6 Apr 2025 15:31:19 +0000 (16:31 +0100)]
MAINTAINERS: IIO: Update reviewers for the subsystem

Lars-Peter has not been active in IIO reviewing for some time. Without
David, Nuno and Andy, along with many others who review IIO patches, I
would not be able to keep up with the rate of change and would have
become a bottleneck to development.

Hence update the MAINTAINERS entry to more accurately reflect reality.
This is not intended to give the 3 of them any more work or to oblige
them to review any particular series, so if there are any series waiting
a long time continue to poke me via the list.

Acked-by: Andy Shevchenko <andy@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250406153120.2129133-1-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ad7606: add SPI offload support
Angelo Dureghello [Thu, 3 Apr 2025 16:19:06 +0000 (18:19 +0200)]
iio: adc: ad7606: add SPI offload support

Add SPI offload support for this family.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250403-wip-bl-spi-offload-ad7606-v1-3-1b00cb638b12@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agodoc: iio: ad7606: describe offload support
Angelo Dureghello [Thu, 3 Apr 2025 16:19:05 +0000 (18:19 +0200)]
doc: iio: ad7606: describe offload support

Add a section to the ad7606 documentation describing how to use the
driver with SPI offloading.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250403-wip-bl-spi-offload-ad7606-v1-2-1b00cb638b12@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agodt-bindings: iio: adc: adi,ad7606: add SPI offload properties
Angelo Dureghello [Thu, 3 Apr 2025 16:19:04 +0000 (18:19 +0200)]
dt-bindings: iio: adc: adi,ad7606: add SPI offload properties

Add #trigger-source-cells property to allow the BUSY output to be
used as a SPI offload trigger source to indicate when a sample is ready
to be read.

Macros are added to adi,ad7606.h for the cell values to help with
readability since they are arbitrary values.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250403-wip-bl-spi-offload-ad7606-v1-1-1b00cb638b12@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoDocumentation: iio: ad7380: add AD7389-4
David Lechner [Tue, 1 Apr 2025 22:50:12 +0000 (17:50 -0500)]
Documentation: iio: ad7380: add AD7389-4

Document support for AD7389-4 and it's quirks.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250401-iio-ad7380-add-ad7389-4-v1-5-23d2568aa24f@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ad7380: add ad7389-4
David Lechner [Tue, 1 Apr 2025 22:50:11 +0000 (17:50 -0500)]
iio: adc: ad7380: add ad7389-4

Add chip info for AD7389-4 to the ad7380 driver.

This is essentially the same as ad7380-4 except that it is internal-
reference-only instead of external-reference-only.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250401-iio-ad7380-add-ad7389-4-v1-4-23d2568aa24f@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ad7380: move internal reference voltage to chip_info
David Lechner [Tue, 1 Apr 2025 22:50:10 +0000 (17:50 -0500)]
iio: adc: ad7380: move internal reference voltage to chip_info

Move the internal reference voltage value to the chip_info structure.

Before this change, only ADAQ chips could be internal_ref_only and only
non-ADAQ chips could be external_ref_only. Now, this restriction is
removed.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250401-iio-ad7380-add-ad7389-4-v1-3-23d2568aa24f@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ad7380: rename internal_ref_only
David Lechner [Tue, 1 Apr 2025 22:50:09 +0000 (17:50 -0500)]
iio: adc: ad7380: rename internal_ref_only

Rename adaq_internal_ref_only to internal_ref_only_adaq. There are non-
ADAQ chips in the family that are also internal reference only, so the
adaq_ prefix is misleading.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250401-iio-ad7380-add-ad7389-4-v1-2-23d2568aa24f@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agodt-bindings: iio: adc: ad7380: add AD7389-4
David Lechner [Tue, 1 Apr 2025 22:50:08 +0000 (17:50 -0500)]
dt-bindings: iio: adc: ad7380: add AD7389-4

Add compatible and quirks for AD7389-4. This is essentially the same as
AD7380-4 but instead of having no internal reference, it has no external
reference voltage supply.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20250401-iio-ad7380-add-ad7389-4-v1-1-23d2568aa24f@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: Adjust internals of handling of direct mode claiming to suit new API.
Jonathan Cameron [Mon, 31 Mar 2025 12:13:17 +0000 (13:13 +0100)]
iio: Adjust internals of handling of direct mode claiming to suit new API.

Now there are no remaining callers of iio_device_claim_direct_mode()
and iio_device_release_direct_mode() rename those functions to ensure
they are not used in new drivers. Also make them now return booleans
in line with the sparse friendly static inline wrappers.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-38-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agostaging: iio: ad5933: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:16 +0000 (13:13 +0100)]
staging: iio: ad5933: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-37-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: temp: maxim_thermocouple: Drop unused mutex.h include.
Jonathan Cameron [Mon, 31 Mar 2025 12:13:15 +0000 (13:13 +0100)]
iio: temp: maxim_thermocouple: Drop unused mutex.h include.

There are no mutex related calls in this driver.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-36-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: temp: maxim_thermocouple: Switch to sparse friendly iio_device_claim/release_dir...
Jonathan Cameron [Mon, 31 Mar 2025 12:13:14 +0000 (13:13 +0100)]
iio: temp: maxim_thermocouple: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Tidy up a few direct returns whilst here.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-35-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: proximity: sx9500: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:13 +0000 (13:13 +0100)]
iio: proximity: sx9500: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-34-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: proximity: pulsed-light: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:12 +0000 (13:13 +0100)]
iio: proximity: pulsed-light: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-33-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: proximity: hx9023s: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:11 +0000 (13:13 +0100)]
iio: proximity: hx9023s: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Cc: Yasin Lee <yasin.lee.x@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-32-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: pressure: zpa2326: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:10 +0000 (13:13 +0100)]
iio: pressure: zpa2326: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-31-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: pressure: rohm-bm1390: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:09 +0000 (13:13 +0100)]
iio: pressure: rohm-bm1390: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-30-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: pressure: ms5611: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:08 +0000 (13:13 +0100)]
iio: pressure: ms5611: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-29-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: pressure: mpl3115: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:07 +0000 (13:13 +0100)]
iio: pressure: mpl3115: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-28-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: pressure: mpl3115: factor out core of IIO_INFO_RAW read to simplify code flow
Jonathan Cameron [Mon, 31 Mar 2025 12:13:06 +0000 (13:13 +0100)]
iio: pressure: mpl3115: factor out core of IIO_INFO_RAW read to simplify code flow

Apply guard(mutex) to remove the need for manual release of the lock.
Factor out the code that occurs under the direct claim.
These two changes allow for direct returns simplifying code flow.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-27-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: pressure: icp10100: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:05 +0000 (13:13 +0100)]
iio: pressure: icp10100: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-26-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: pressure: dlhl60d: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:04 +0000 (13:13 +0100)]
iio: pressure: dlhl60d: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-25-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: magnetometer: rm3100: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:03 +0000 (13:13 +0100)]
iio: magnetometer: rm3100: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-24-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: magnetometer: mag3110: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:02 +0000 (13:13 +0100)]
iio: magnetometer: mag3110: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-23-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: magnetometer: mag3110: Factor out core of read/write_raw() and use guard() to...
Jonathan Cameron [Mon, 31 Mar 2025 12:13:01 +0000 (13:13 +0100)]
iio: magnetometer: mag3110: Factor out core of read/write_raw() and use guard() to simplify code flow.

The combination of guard(mutex) and factoring out sections of code
that occur with the device held in direct mode simplifies code flow.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-22-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: imu: st_lsm6dsx: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:13:00 +0000 (13:13 +0100)]
iio: imu: st_lsm6dsx: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-21-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: imu: st_lsm6dsx: Switch to sparse friendly claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:59 +0000 (13:12 +0100)]
iio: imu: st_lsm6dsx: Switch to sparse friendly claim/release_direct()

This driver caused a false positive with __cond_lock() style solution
but is fine with the simple boolean return approach now used.

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-20-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: imu: st_lsm6dsx: Factor out parts of st_lsm6dsx_shub_write_raw() to allow direct...
Jonathan Cameron [Mon, 31 Mar 2025 12:12:58 +0000 (13:12 +0100)]
iio: imu: st_lsm6dsx: Factor out parts of st_lsm6dsx_shub_write_raw() to allow direct returns

By factoring out all the code that occurs with direct mode claimed
to a helper function, that helper function can directly return simplifying
code flow.

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-19-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: imu: smi240: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:57 +0000 (13:12 +0100)]
iio: imu: smi240: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Cc: Shen Jianping <Jianping.Shen@de.bosch.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-18-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: imu: inv_mpu6050: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:56 +0000 (13:12 +0100)]
iio: imu: inv_mpu6050: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-17-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: imu: inv_icm42600: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:55 +0000 (13:12 +0100)]
iio: imu: inv_icm42600: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-16-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: humidity: hts211: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:54 +0000 (13:12 +0100)]
iio: humidity: hts211: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-15-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: humidity: hts211: Factor out everything under direct mode claim into helper...
Jonathan Cameron [Mon, 31 Mar 2025 12:12:53 +0000 (13:12 +0100)]
iio: humidity: hts211: Factor out everything under direct mode claim into helper functions.

Pulling out the functionality of read_raw() and write_raw() callbacks
so that only the mode claim is done in the initial call allows for
direct returns and simpler error handling in the new __hts211_write_raw()
/ __hts211_read_raw() functions.

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-14-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: humidity: hdc2010: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:52 +0000 (13:12 +0100)]
iio: humidity: hdc2010: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Acked-by: Eugene Zaikonnikov <ez@norphonic.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-13-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: humidity: hdc100x: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:51 +0000 (13:12 +0100)]
iio: humidity: hdc100x: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-12-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: humidity: hdc100x: Use guard(mutex) to simplify code flow
Jonathan Cameron [Mon, 31 Mar 2025 12:12:50 +0000 (13:12 +0100)]
iio: humidity: hdc100x: Use guard(mutex) to simplify code flow

By using autoreleasing on the lock a number of paths can use
direct returns allow earlier exit from functions.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-11-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: health: max30102: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:49 +0000 (13:12 +0100)]
iio: health: max30102: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated. This particular case is about ensuring
the mode does not change rather than ensuring we are in direct mode.
A follow up may cleanup the buffer mode claim.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-10-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: gyro: adxrs290: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:48 +0000 (13:12 +0100)]
iio: gyro: adxrs290: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Cc: Nishant Malpani <nish.malpani25@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-9-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: common: st_sensors: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:47 +0000 (13:12 +0100)]
iio: common: st_sensors: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-8-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: common: scmi: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:46 +0000 (13:12 +0100)]
iio: common: scmi: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Cc: Jyoti Bhayana <jbhayana@google.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-7-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: chemical: scd4x: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:45 +0000 (13:12 +0100)]
iio: chemical: scd4x: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Cc: Roan van Dijk <roan@protonic.nl>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-6-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: chemical: atlas-sensor: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:44 +0000 (13:12 +0100)]
iio: chemical: atlas-sensor: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-5-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: chemical: ccs811: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:43 +0000 (13:12 +0100)]
iio: chemical: ccs811: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-4-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: chemical: ccs811: Factor out handling of read of IIO_INFO_RAW to simplify error...
Jonathan Cameron [Mon, 31 Mar 2025 12:12:42 +0000 (13:12 +0100)]
iio: chemical: ccs811: Factor out handling of read of IIO_INFO_RAW to simplify error paths.

Factor out the implementation of this part of read_raw() and use
guard() to allow direct returns, simplifying both error and non error
paths.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-3-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: addac: ad74115: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Mon, 31 Mar 2025 12:12:41 +0000 (13:12 +0100)]
iio: addac: ad74115: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Cc: Cosmin Tanislav <demonsingur@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-2-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ad7124: Make register naming consistent
Uwe Kleine-König [Mon, 17 Mar 2025 11:52:49 +0000 (12:52 +0100)]
iio: adc: ad7124: Make register naming consistent

Cleanup definition of register related constants:

 - Use the register and field names exactly as documented in the data
   sheet.
 - Consistently use <regname>_<bitfield> to name a register's bitfield.
 - Drop _MSK definitions and implicit FIELD_PREP calls.
 - Consistent indentation.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/20250317115247.3735016-8-u.kleine-koenig@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ad7124: Remove ability to write filter_low_pass_3db_frequency
Uwe Kleine-König [Mon, 17 Mar 2025 11:52:48 +0000 (12:52 +0100)]
iio: adc: ad7124: Remove ability to write filter_low_pass_3db_frequency

There are several issues with the function that implements writing to
the filter_low_pass_3db_frequency property:

 - The sinc3 factor should be 0.272 not 0.262 (this is fixed for the
   reading side in the previous patch).
 - For freq > 1 the if condition is always true so the sinc4 filter is
   hardly ever chosen.
 - In the nearly always taken if branch the filter is set to sinc3, but
   the frequency is set for sinc4. (And vice versa in the else branch.)

This is broken enough to justify the claim that there isn't any serious
user. Also it it counter-intuitive that setting the 3db frequency
modifies the sample frequency and the filter type.

So drop the ability to write that property.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Link: https://patch.msgid.link/20250317115247.3735016-7-u.kleine-koenig@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ad7124: Fix 3dB filter frequency reading
Uwe Kleine-König [Mon, 17 Mar 2025 11:52:47 +0000 (12:52 +0100)]
iio: adc: ad7124: Fix 3dB filter frequency reading

The sinc4 filter has a factor 0.23 between Output Data Rate and f_{3dB}
and for sinc3 the factor is 0.272 according to the data sheets for
ad7124-4 (Rev. E.) and ad7124-8 (Rev. F).

Fixes: cef2760954cf ("iio: adc: ad7124: add 3db filter")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Link: https://patch.msgid.link/20250317115247.3735016-6-u.kleine-koenig@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoDocumentation: iio: ad4000: Describe offload support
Marcelo Schmitt [Thu, 27 Mar 2025 21:25:29 +0000 (18:25 -0300)]
Documentation: iio: ad4000: Describe offload support

When SPI offloading is supported, the IIO device provides different sysfs
interfaces to allow using the adjusting the sample rate. Document SPI
offload support for AD4000 and similar devices.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Link: https://patch.msgid.link/eb94013b1a4d66a8492cf094aef3e4410f81d22b.1743110188.git.marcelo.schmitt@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoDocumentation: iio: ad4000: Add IIO Device characteristics section
Marcelo Schmitt [Thu, 27 Mar 2025 21:25:12 +0000 (18:25 -0300)]
Documentation: iio: ad4000: Add IIO Device characteristics section

Complement ad4000 IIO driver documentation with considerations about
``_scale_available`` attribute and table of typical channel attributes.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Link: https://patch.msgid.link/6c8fe68d7d413ffdd33b154ba45600c7ce7013da.1743110188.git.marcelo.schmitt@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoDocumentation: iio: ad4000: Add new supported parts
Marcelo Schmitt [Thu, 27 Mar 2025 21:24:53 +0000 (18:24 -0300)]
Documentation: iio: ad4000: Add new supported parts

Commit <c3948d090080> ("iio: adc: ad4000: Add support for PulSAR devices"),
extended the ad4000 driver supports many single-channel PulSAR devices.

Update IIO ad4000 documentation with the extra list of supported devices.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Link: https://patch.msgid.link/2b602abd0773af91e7ccd9dd7a2afe67f4792f95.1743110188.git.marcelo.schmitt@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ad4000: Add support for SPI offload
Marcelo Schmitt [Thu, 27 Mar 2025 21:24:35 +0000 (18:24 -0300)]
iio: adc: ad4000: Add support for SPI offload

FPGA HDL projects can include a PWM generator in addition to SPI-Engine.
The PWM IP is used to trigger SPI-Engine offload modules that in turn set
SPI-Engine to execute transfers to poll data from the ADC. That allows data
to be read at the maximum sample rates. Also, it is possible to set a
specific sample rate by setting the proper PWM duty cycle and related state
parameters, thus allowing an adjustable ADC sample rate when a PWM (offload
trigger) is used in combination with SPI-Engine.

Add support for SPI offload.

Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Link: https://patch.msgid.link/386ce043a0e3fc9e8ff71f17aef8de128ce5869e.1743110188.git.marcelo.schmitt@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: adc: ad7944: drop bits_per_word hack
David Lechner [Mon, 31 Mar 2025 19:29:54 +0000 (14:29 -0500)]
iio: adc: ad7944: drop bits_per_word hack

Remove setting bits_per_word in SPI xfers without data. The shortcoming
that this was working around was fixed in the SPI controller driver, so
it is no longer necessary. And we don't need this to be cargo-culted to
new drivers.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250331-iio-adc-ad7944-drop-bits_per_word-hack-v1-1-2b952e033340@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: dac: bd79703: Support ROHM BD79702
Matti Vaittinen [Wed, 2 Apr 2025 06:46:44 +0000 (09:46 +0300)]
iio: dac: bd79703: Support ROHM BD79702

The ROHM BD79702 is similar to the BD79703, except that it has only 4
channels whereas BD79703 has 6 channels. The channel 'addresses' of the
first two channels (used to identify the channel when data is read over
SPI) are same for both ICs. The next two channels of the BD79702 have
same addresses as the last two channels of the BD79703. This means the
BD79702 channel addresses do not follow the channel numbers with a
constant offset. Thus, we need to specify the addresses separately,
instead of directly deriving them from the channel number with a
constant offset.

It's worth noting that the data-sheet describes the BD79702 as a device
having channels 1,2,5 and 6. The driver however represents channels
0,1,2,3 to the users - with no gaps in the numbering - which may be more
familiar view for the application software.

Support ROHM BD79702 DAC.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/0ba243a63115dd4af03ebf9656c65b8c259a3e34.1743576022.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: dac: bd79703: Support BD79700 and BD79701
Matti Vaittinen [Wed, 2 Apr 2025 06:46:30 +0000 (09:46 +0300)]
iio: dac: bd79703: Support BD79700 and BD79701

The BD79700 and BD79701 look like almost exact subsets of the BD79703.
The BD79703 contains 6 channels (channels 0 to 5). The BD79700 provides
only 2 channels, matching the BD79703 channels 0 and 1. The BD79701
provides 3 channels (matching BD79703 channels 0, 1, and 2).

Furthermore, the BD79700 and BD79701 do not have separate VFS pin but
use VCC for the full-scale voltage.

Suopport these ICs using the BD79703 driver.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/845aa45974f6fb81c83046368a24a0674e9a8b0e.1743576022.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: dac: bd79703: Add chip data
Matti Vaittinen [Wed, 2 Apr 2025 06:46:13 +0000 (09:46 +0300)]
iio: dac: bd79703: Add chip data

Add a chip data structure which allows handling the different variants
(ROHM BD79700BD79701) with different number of channels.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/2cacb4bec5455fe1aa58a0b28d2d91b96a396d1a.1743576022.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: dac: bd79703 Store device address to 'address'
Matti Vaittinen [Wed, 2 Apr 2025 06:45:56 +0000 (09:45 +0300)]
iio: dac: bd79703 Store device address to 'address'

The ROHM BD79703 needs to identify a channel which we are reading from
in the SPI transfers. This can be seen as an address for the device.

For the bd79703 the address is nicely aligned with the channel number,
so the driver uses the channel ID for the SPI transfers. This, however,
does not need to be the case. The iio_chan_spec has a separate 'address'
field, which we can populate directly with this information.

This helps adding new ICs like the ROHM BD79702 where the channel ID is
different from this address to be handled by this driver, so we don't
need to have separate, IC specific mapping for channel numbers <=>
addresses.

Make the 'address' field in the iio_chan_spec to contain the SPI protocol
address for the channel, and use this value in the transfers.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/e53cb4120d16a3c678e1f391b600af630d6767ce.1743576022.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agodt-bindings: Add ROHM BD7970x variants
Matti Vaittinen [Wed, 2 Apr 2025 06:44:36 +0000 (09:44 +0300)]
dt-bindings: Add ROHM BD7970x variants

The ROHM BD79700BD79701 and BD79702 are subsets of the BD79703 DAC.
The main difference is the number of the channels. BD79703 has 6
channels.

The BD79702 has 4, BD79701 3 and BD79700 2 channels. Additionally, the
BD79700 and BD79701 do not have separate Vfs pin but use the Vcc also
for the full-scale voltage.

Add properties for the BD79700BD79701 and BD79702.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/0a114565e4de52bf8f98c4f9d17943e5148b0112.1743576022.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: al3320a: Implement regmap support
David Heidelberg [Wed, 2 Apr 2025 19:33:28 +0000 (21:33 +0200)]
iio: light: al3320a: Implement regmap support

Modernize and clean up the driver using the regmap framework.

With the regmap implementation, the compiler produces
a significantly smaller module.

Size before: 72 kB
Size after:  58 kB

Signed-off-by: David Heidelberg <david@ixit.cz>
Link: https://patch.msgid.link/20250402-al3010-iio-regmap-v4-5-d189bea87261@ixit.cz
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: al3010: Implement regmap support
David Heidelberg [Wed, 2 Apr 2025 19:33:27 +0000 (21:33 +0200)]
iio: light: al3010: Implement regmap support

Modernize and clean up the driver using the regmap framework.

With the regmap implementation, the compiler produces
a significantly smaller module.

Size before: 72 kB
Size after:  58 kB

Signed-off-by: David Heidelberg <david@ixit.cz>
Link: https://patch.msgid.link/20250402-al3010-iio-regmap-v4-4-d189bea87261@ixit.cz
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: al3320a: Fix an error handling path in al3320a_probe()
David Heidelberg [Wed, 2 Apr 2025 19:33:26 +0000 (21:33 +0200)]
iio: light: al3320a: Fix an error handling path in al3320a_probe()

If regmap_write() fails in al3320a_init(), al3320a_set_pwr_off is
not called.

In order to avoid such a situation, move the devm_add_action_or_reset()
which calls al3320a_set_pwr_off right after a successful
al3320a_set_pwr_on.

Signed-off-by: David Heidelberg <david@ixit.cz>
Link: https://patch.msgid.link/20250402-al3010-iio-regmap-v4-3-d189bea87261@ixit.cz
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: al3000a: Fix an error handling path in al3000a_probe()
David Heidelberg [Wed, 2 Apr 2025 19:33:25 +0000 (21:33 +0200)]
iio: light: al3000a: Fix an error handling path in al3000a_probe()

If regmap_write() fails in al3000a_init(), al3000a_set_pwr_off is
not called.

In order to avoid such a situation, move the devm_add_action_or_reset()
which calls al3000a_set_pwr_off right after a successful
al3000a_set_pwr_on.

Signed-off-by: David Heidelberg <david@ixit.cz>
Link: https://patch.msgid.link/20250402-al3010-iio-regmap-v4-2-d189bea87261@ixit.cz
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: al3010: Improve al3010_init error handling with dev_err_probe()
David Heidelberg [Wed, 2 Apr 2025 19:33:24 +0000 (21:33 +0200)]
iio: light: al3010: Improve al3010_init error handling with dev_err_probe()

Minor code simplifications and improved error reporting.

Signed-off-by: David Heidelberg <david@ixit.cz>
Link: https://patch.msgid.link/20250402-al3010-iio-regmap-v4-1-d189bea87261@ixit.cz
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: vcnl4035: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:33 +0000 (17:06 +0000)]
iio: light: vcnl4035: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

This case triggered a false positive from sparse, resolved by
factoring out the code that includes the claim and release of
direct mode.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-19-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: vcnl4000: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:32 +0000 (17:06 +0000)]
iio: light: vcnl4000: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

To simplify the code whilst making the change (and avoid potential false
positives from sparse), split the enabling and disabling of thresholds
into separate functions.  This could have been done in two steps
by splitting the functions first, but would have meant rewriting
the enable function twice.

Cc: Astrid Rost <astrid.rost@axis.com>
Tested-by: Per-Daniel Olsson <perdaniel.olsson@axis.com>
Reviewed-by: Per-Daniel Olsson <perdaniel.olsson@axis.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-18-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: tcs3472: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:31 +0000 (17:06 +0000)]
iio: light: tcs3472: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-17-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: tcs3414: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:30 +0000 (17:06 +0000)]
iio: light: tcs3414: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-16-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: st_uvis25: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:29 +0000 (17:06 +0000)]
iio: light: st_uvis25: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-15-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: si1145: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:28 +0000 (17:06 +0000)]
iio: light: si1145: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-14-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: rpr0521: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:27 +0000 (17:06 +0000)]
iio: light: rpr0521: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-13-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: rpr0521: Factor out handling of IIO_INFO_RAW and use guard()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:26 +0000 (17:06 +0000)]
iio: light: rpr0521: Factor out handling of IIO_INFO_RAW and use guard()

Factor out the code which is only called with the direct mode claimed.
This and the use of guard(mutex) allows direct returns simplifying
code flow.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-12-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: rohm-bu27034: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:25 +0000 (17:06 +0000)]
iio: light: rohm-bu27034: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Acked-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-11-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: opt4060: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:24 +0000 (17:06 +0000)]
iio: light: opt4060: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.  This is a case where the code
is pinning down the mode so also has a claim on buffered mode.
A follow up set may move those calls over to a sparse friendly
form as well.

Tested-by: Per-Daniel Olsson <perdaniel.olsson@axis.com>
Reviewed-by: Per-Daniel Olsson <perdaniel.olsson@axis.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-10-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: ltr501: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:23 +0000 (17:06 +0000)]
iio: light: ltr501: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-9-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: ltr501: Factor out core of write_raw() where direct mode claim is held.
Jonathan Cameron [Sun, 9 Mar 2025 17:06:22 +0000 (17:06 +0000)]
iio: light: ltr501: Factor out core of write_raw() where direct mode claim is held.

Factoring this code out allows for direct returns on error simplifying code
flow.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-8-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: ltr501: Factor out IIO_INFO_RAW leg of read_raw() callback.
Jonathan Cameron [Sun, 9 Mar 2025 17:06:21 +0000 (17:06 +0000)]
iio: light: ltr501: Factor out IIO_INFO_RAW leg of read_raw() callback.

Factoring this code out allows for direct returns, simplifying code flow.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-7-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: as73211: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:20 +0000 (17:06 +0000)]
iio: light: as73211: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated

Cc: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-6-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: as73211: Use guard() and move mode switch into inner write_raw fucntion
Jonathan Cameron [Sun, 9 Mar 2025 17:06:19 +0000 (17:06 +0000)]
iio: light: as73211: Use guard() and move mode switch into inner write_raw fucntion

By using guard(mutex) and moving code that switches the device to config
mode into _as73211_write_raw() the error flow is simplified.

Cc: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-5-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: isl29125: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:18 +0000 (17:06 +0000)]
iio: light: isl29125: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-4-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 weeks agoiio: light: gp2ap020a00f: Switch to sparse friendly iio_device_claim/release_direct()
Jonathan Cameron [Sun, 9 Mar 2025 17:06:17 +0000 (17:06 +0000)]
iio: light: gp2ap020a00f: Switch to sparse friendly iio_device_claim/release_direct()

These new functions allow sparse to find failures to release
direct mode reducing chances of bugs over the claim_direct_mode()
functions that are deprecated.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250309170633.1347476-3-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>