Jonathan Cameron
df330c8081
iio: accel: mma8452: Ensure error return on failure to matching oversampling ratio
...
If a match was not found, then the write_raw() callback would return
the odr index, not an error. Return -EINVAL if this occurs.
To avoid similar issues in future, introduce j, a new indexing variable
rather than using ret for this purpose.
Fixes: 79de2ee469 ("iio: accel: mma8452: claim direct mode during write raw")
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250217140135.896574-2-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:48 +00:00
Robert Budai
aaa9d61634
docs: iio: add documentation for adis16550 driver
...
Add documentation for adis16550 driver which describes the driver device
files and shows how the user may use the ABI for various scenarios
(configuration, measurement, etc.).
Co-developed-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Co-developed-by: Ramona Gradinariu <ramona.gradinariu@analog.com >
Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com >
Signed-off-by: Robert Budai <robert.budai@analog.com >
Link: https://patch.msgid.link/20250217105753.605465-7-robert.budai@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:47 +00:00
Robert Budai
bac4368fab
iio: imu: adis16550: add adis16550 support
...
The ADIS16550 is a complete inertial system that includes a triaxis
gyroscope and a triaxis accelerometer. Each inertial sensor in the
ADIS16550 combines industry leading MEMS only technology with signal
conditioning that optimizes dynamic performance. The factory calibration
characterizes each sensor for sensitivity, bias, and alignment. As a
result, each sensor has its own dynamic compensation formulas that
provide accurate sensor measurements.
Co-developed-by: Ramona Gradinariu <ramona.gradinariu@analog.com >
Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com >
Co-developed-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Co-developed-by: Nuno Sá <nuno.sa@analog.com >
Signed-off-by: Nuno Sá <nuno.sa@analog.com >
Signed-off-by: Robert Budai <robert.budai@analog.com >
Link: https://patch.msgid.link/20250217105753.605465-6-robert.budai@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:24 +00:00
Robert Budai
6e507f996c
dt-bindings: iio: Add adis16550 bindings
...
Document the ADIS16550 device devicetree bindings.
Co-developed-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Co-developed-by: Ramona Gradinariu <ramona.gradinariu@analog.com >
Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com >
Signed-off-by: Robert Budai <robert.budai@analog.com >
Reviewed-by: Rob Herring (Arm) <robh@kernel.org >
Link: https://patch.msgid.link/20250217105753.605465-5-robert.budai@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-22 12:24:25 +00:00
Robert Budai
9fa98d9413
iio: imu: adis: Add DIAG_STAT register
...
Some devices may have more than 16 bits of status. This patch allows the
user to specify the size of the DIAG_STAT register. It defaults to 2 if
not specified. This is mainly for backward compatibility.
Co-developed-by: Ramona Gradinariu <ramona.gradinariu@analog.com >
Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com >
Co-developed-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Co-developed-by: Nuno Sá <nuno.sa@analog.com >
Signed-off-by: Nuno Sá <nuno.sa@analog.com >
Signed-off-by: Robert Budai <robert.budai@analog.com >
Link: https://patch.msgid.link/20250217105753.605465-4-robert.budai@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-22 12:23:49 +00:00
Robert Budai
7f15d7a7d1
iio: imu: adis: Add reset to custom ops
...
This patch allows the custom definition of reset functionality for adis object.
It is useful in cases where the driver does not need to sleep after the reset
since it is handled by the library.
Co-developed-by: Ramona Gradinariu <ramona.gradinariu@analog.com >
Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com >
Co-developed-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Co-developed-by: Nuno Sá <nuno.sa@analog.com >
Signed-off-by: Nuno Sá <nuno.sa@analog.com >
Signed-off-by: Robert Budai <robert.budai@analog.com >
Link: https://patch.msgid.link/20250217105753.605465-3-robert.budai@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-22 12:23:19 +00:00
Robert Budai
3b29bcee8f
iio: imu: adis: Add custom ops struct
...
This patch introduces a custom ops struct letting users define custom read and
write functions. Some adis devices might define a completely different spi
protocol from the one used in the default implementation.
Co-developed-by: Ramona Gradinariu <ramona.gradinariu@analog.com >
Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com >
Co-developed-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com >
Co-developed-by: Nuno Sá <nuno.sa@analog.com >
Signed-off-by: Nuno Sá <nuno.sa@analog.com >
Signed-off-by: Robert Budai <robert.budai@analog.com >
Link: https://patch.msgid.link/20250217105753.605465-2-robert.budai@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-22 12:22:45 +00:00
David Lechner
66e80e2f21
iio: resolver: ad2s1210: use bitmap_write
...
Replace bitmap array access with bitmap_write.
Accessing the bitmap array directly is not recommended and now there is
a helper function that can be used.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org >
Signed-off-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250210-gpio-set-array-helper-v3-10-d6a673674da8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-22 11:42:50 +00:00
David Lechner
76ce6e6e5c
iio: resolver: ad2s1210: use gpiod_multi_set_value_cansleep
...
Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of
gpiod_set_array_value().
These are not called in an atomic context, so changing to the cansleep
variant is fine.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org >
Signed-off-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250210-gpio-set-array-helper-v3-9-d6a673674da8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:20:45 +00:00
David Lechner
a927e72925
iio: amplifiers: hmc425a: use gpiod_multi_set_value_cansleep
...
Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of
gpiod_set_array_value_cansleep().
Passing NULL as the 3rd argument to gpiod_set_array_value_cansleep()
only needs to be done if the array was constructed manually, which is
not the case here. This change effectively replaces that argument with
st->gpios->array_info. The possible side effect of this change is that
it could make setting the GPIOs more efficient.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org >
Signed-off-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250210-gpio-set-array-helper-v3-8-d6a673674da8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:20:41 +00:00
David Lechner
f23209e975
iio: adc: ad7606: use gpiod_multi_set_value_cansleep
...
Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of
gpiod_set_array_value().
These are not called in an atomic context, so changing to the cansleep
variant is fine.
Also drop unnecessary braces while we are at it.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org >
Signed-off-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250210-gpio-set-array-helper-v3-7-d6a673674da8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:20:36 +00:00
Jonathan Cameron
b2881a480b
Merge tag 'gpio-set-array-helper-v6.15-rc1' into togreg
...
add gpiod_multi_set_value_cansleep() to GPIO core
2025-02-17 13:13:11 +00:00
Jonathan Cameron
4c57188589
iio: Drop iio_device_claim_direct_scoped() and related infrastructure
...
Scoped conditional automated cleanup turned out to be harder to work
with than expected. Despite several attempts to find a better solution
non have surfaced. As such rip it out of the IIO code.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-28-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:04:09 +00:00
Jonathan Cameron
668d7167fc
iio: light: bh1745: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Reviewed-by: Mudit Sharma <muditsharma.info@gmail.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250209180624.701140-27-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:03:48 +00:00
Jonathan Cameron
0bee1bf85a
iio: imu: bmi323: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Cc: Julien Stephan <jstephan@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250209180624.701140-26-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:03:47 +00:00
Jonathan Cameron
73dad3ec96
iio: dummy: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context. Introduce two new utility functions
to allow for direct returns with claim and release of direct mode
in the caller.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-25-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:03:40 +00:00
Jonathan Cameron
41a316c8e5
iio: dac: ad8460: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Cc: Mariel Tinaco <Mariel.Tinaco@analog.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-24-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:03:24 +00:00
Jonathan Cameron
798fa301e1
iio: dac: ad3552r-hs: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Cc: Angelo Dureghello <adureghello@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-23-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:03:04 +00:00
Jonathan Cameron
5e802eed70
iio: chemical: ens160: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Reviewed-by: Gustavo Silva <gustavograzs@gmail.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250209180624.701140-22-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:02:53 +00:00
Jonathan Cameron
e4c569742b
iio: addac: ad74413r: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context. Includes moving a mutex lock
into a function rather than around it to simplify the error handling.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-21-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:02:42 +00:00
Jonathan Cameron
69deb972f9
iio: adc: ti-ads1119: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Cc: João Paulo Gonçalves <joao.goncalves@toradex.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250209180624.701140-20-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:02:16 +00:00
Jonathan Cameron
dc10095660
iio: adc: ti-adc161s626: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250209180624.701140-19-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:02:16 +00:00
Jonathan Cameron
27ac40b627
iio: adc: rtq6056: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context
Reviewed-by: ChiYuan Huang <cy_huang@richtek.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250209180624.701140-18-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:02:16 +00:00
Jonathan Cameron
5fd89f430d
iio: adc: max1363: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-17-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:02:06 +00:00
Jonathan Cameron
7b22c00030
iio: adc: ad9467: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context. Also use guard() to simplify mutex
unlock paths.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-16-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:01:55 +00:00
Jonathan Cameron
82a0760c10
iio: adc: ad7779: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Cc: Ramona Alexandra Nechita <ramona.nechita@analog.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-15-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:01:49 +00:00
Jonathan Cameron
48a24fd21d
iio: adc: ad7625: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Reviewed-by: Trevor Gamblin <tgamblin@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-14-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:01:43 +00:00
Jonathan Cameron
8a1812d040
iio: adc: ad7606: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Cc: Guillaume Stols <gstols@baylibre.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-13-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:00:58 +00:00
Jonathan Cameron
20a57c2714
iio: adc: ad4695: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context. In some cases code is factored
out to utility functions that can do a direct return with the
claim and release around the call.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-12-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 13:00:07 +00:00
Jonathan Cameron
b70fb3c195
iio: adc: ad4130: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Cc: Cosmin Tanislav <demonsingur@gmail.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-11-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 12:59:29 +00:00
Jonathan Cameron
e48c56d150
iio: adc: ad4000: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com >
Tested-by: Marcelo Schmitt <marcelo.schmitt@analog.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-10-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 12:58:55 +00:00
Jonathan Cameron
7c00c85a63
iio: accel: adxl367: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context
In some cases there is a convenient wrapper function to which
the handling can be moved. Do that instead of introducing
another layer of wrappers. In others an outer wrapper is added
which claims direct mode, runs the original function with the
scoped claim logic removed, releases direct mode and then checks
for errors.
Cc: Cosmin Tanislav <demonsingur@gmail.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-9-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 12:58:09 +00:00
Jonathan Cameron
7b7f7e6ee0
iio: proximity: sx9360: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context
Reviewed-by: Gwendal Grignou <gwendal@chromium.org >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250209180624.701140-8-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 12:57:31 +00:00
Jonathan Cameron
ec59a125ea
iio: proximity: sx9324: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context
Reviewed-by: Gwendal Grignou <gwendal@chromium.org >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250209180624.701140-7-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 12:57:31 +00:00
Jonathan Cameron
f238f1efc2
iio: proximity: sx9310: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Reviewed-by: Gwendal Grignou <gwendal@chromium.org >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250209180624.701140-6-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 12:57:31 +00:00
Jonathan Cameron
bcbd26d866
iio: temperature: tmp006: Stop using iio_device_claim_direct_scoped()
...
This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.
Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context.
Cc: Antoni Pokusinski <apokusinski01@gmail.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250209180624.701140-5-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 12:57:31 +00:00
Jonathan Cameron
403f0f9b36
iio: chemical: scd30: 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.
Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250209180624.701140-4-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 12:57:30 +00:00
Jonathan Cameron
5feb553287
iio: chemical: scd30: Use guard(mutex) to allow early returns
...
Auto cleanup based release of the lock allows for simpler code flow in a
few functions with large multiplexing style switch statements and no
common operations following the switch.
Suggested-by: David Lechner <dlechner@baylibre.com >
Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250209180624.701140-3-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 12:57:30 +00:00
Jonathan Cameron
d795e38df4
iio: core: Rework claim and release of direct mode to work with sparse.
...
Initial thought was to do something similar to __cond_lock()
do_iio_device_claim_direct_mode(iio_dev) ? : ({ __acquire(iio_dev); 0; })
+ Appropriate static inline iio_device_release_direct_mode()
However with that, sparse generates false positives. E.g.
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:1811:17: warning: context imbalance in 'st_lsm6dsx_read_raw' - unexpected unlock
So instead, this patch rethinks the return type and makes it more
'conditional lock like' (which is part of what is going on under the hood
anyway) and return a boolean - true for successfully acquired, false for
did not acquire.
To allow a migration path given the rework is now non trivial, take a leaf
out of the naming of the conditional guard we currently have for IIO
device direct mode and drop the _mode postfix from the new functions giving
iio_device_claim_direct() and iio_device_release_direct()
Whilst the kernel supports __cond_acquires() upstream sparse does not
yet do so. Hence rely on sparse expanding a static inline wrapper
to explicitly see whether __acquire() is called.
Note that even with the solution here, sparse sometimes gives false
positives. However in the few cases seen they were complex code
structures that benefited from simplification anyway.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Nuno Sa <nuno.sa@analog.com >
Link: https://patch.msgid.link/20250209180624.701140-2-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-17 12:57:13 +00:00
Bo Liu
9d7d7bfb45
iio: accel: kx022a: convert to use maple tree register cache
...
The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.
Signed-off-by: Bo Liu <liubo03@inspur.com >
Acked-by: Matti Vaittinen <mazziesaccount@gmail.com >
Link: https://patch.msgid.link/20250212075223.4164-5-liubo03@inspur.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-16 16:37:17 +00:00
Bo Liu
7ed9db68c3
iio: accel: bmi088: convert to use maple tree register cache
...
The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.
Signed-off-by: Bo Liu <liubo03@inspur.com >
Link: https://patch.msgid.link/20250212075223.4164-4-liubo03@inspur.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-16 16:37:17 +00:00
Bo Liu
58e9fe2597
iio: accel: bma400: convert to use maple tree register cache
...
The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.
Signed-off-by: Bo Liu <liubo03@inspur.com >
Link: https://patch.msgid.link/20250212075223.4164-3-liubo03@inspur.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-16 16:37:17 +00:00
Bo Liu
7a2dd31359
iio: accel: msa311: convert to use maple tree register cache
...
The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.
Signed-off-by: Bo Liu <liubo03@inspur.com >
Link: https://patch.msgid.link/20250212075223.4164-2-liubo03@inspur.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-16 16:37:17 +00:00
Tobias Sperling
024b08fee3
iio: adc: Add driver for ADS7128 / ADS7138
...
Add driver for ADS7128 and ADS7138 12-bit, 8-channel analog-to-digital
converters. These ADCs have a wide operating range and a wide feature
set. Communication is based on the I2C interface.
ADS7128 differs in the addition of further hardware features, like a
root-mean-square (RMS) and a zero-crossing-detect (ZCD) module.
Signed-off-by: Tobias Sperling <tobias.sperling@softing.com >
Link: https://patch.msgid.link/20250213-adc_ml-v4-2-66b68f8fdb8c@softing.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-16 15:52:22 +00:00
Tobias Sperling
f3255b0e1c
dt-bindings: iio: adc: Introduce ADS7138
...
Add documentation for the driver of ADS7128 and ADS7138 12-bit, 8-channel
analog-to-digital converters. These ADCs have a wide operating range and
a wide feature set. Communication is based on the I2C interface.
ADS7128 differs in the addition of further hardware features, like a
root-mean-square (RMS) and a zero-crossing-detect (ZCD) module.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Signed-off-by: Tobias Sperling <tobias.sperling@softing.com >
Link: https://patch.msgid.link/20250213-adc_ml-v4-1-66b68f8fdb8c@softing.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-16 15:52:22 +00:00
Esteban Blanc
b29050e8b3
docs: iio: ad4030: add documentation
...
This adds a new page to document how to use the ad4030 ADC driver
Signed-off-by: Esteban Blanc <eblanc@baylibre.com >
Link: https://patch.msgid.link/20250214-eblanc-ad4630_v1-v4-6-135dd66cab6a@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-16 15:40:51 +00:00
Esteban Blanc
ec25cf6f1e
iio: adc: ad4030: add support for ad4632-16 and ad4632-24
...
AD4632-24 and AD4632-16 are 2 channels ADCs. Both channels are
interleaved bit per bit on SDO line.
Both of them do not have evaluation board. As such, the support added
here can't be tested. Support is provided as best effort until someone get
their hands on one.
Signed-off-by: Esteban Blanc <eblanc@baylibre.com >
Link: https://patch.msgid.link/20250214-eblanc-ad4630_v1-v4-5-135dd66cab6a@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-16 15:39:58 +00:00
Esteban Blanc
c8ed843c48
iio: adc: ad4030: add support for ad4630-24 and ad4630-16
...
AD4630-24 and AD4630-16 are 2 channels ADCs. Both channels are
interleaved bit per bit on SDO line.
Signed-off-by: Esteban Blanc <eblanc@baylibre.com >
Link: https://patch.msgid.link/20250214-eblanc-ad4630_v1-v4-4-135dd66cab6a@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-16 15:39:43 +00:00
Esteban Blanc
949abd1ca5
iio: adc: ad4030: add averaging support
...
This add support for the averaging mode of AD4030 using oversampling IIO
attribute
Signed-off-by: Esteban Blanc <eblanc@baylibre.com >
Link: https://patch.msgid.link/20250214-eblanc-ad4630_v1-v4-3-135dd66cab6a@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-16 15:39:15 +00:00
Esteban Blanc
0cb8b32485
iio: adc: ad4030: add driver for ad4030-24
...
This adds a new driver for the Analog Devices INC. AD4030-24 ADC.
The driver implements basic support for the AD4030-24 1 channel
differential ADC with hardware gain and offset control.
Signed-off-by: Esteban Blanc <eblanc@baylibre.com >
Link: https://patch.msgid.link/20250214-eblanc-ad4630_v1-v4-2-135dd66cab6a@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-02-16 15:37:05 +00:00