summaryrefslogtreecommitdiff
path: root/drivers/iio
AgeCommit message (Collapse)Author
2025-03-11iio: adc: ad4130: Adapt internal names to match official filter_type ABIUwe Kleine-König
Recently the interface to to select a filter was officially blessed to use "filter_type". Adapt the naming of several functions accordingly to make the new standard more present and so make the driver a better template for other drivers. Apart from the comment update this is just s/filter_mode/filter_type/. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-15-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad7173: Fix comparison of channel configsUwe Kleine-König
Checking the binary representation of two structs (of the same type) for equality doesn't have the same semantic as comparing all members for equality. The former might find a difference where the latter doesn't in the presence of padding or when ambiguous types like float or bool are involved. (Floats typically have different representations for single values, like -0.0 vs +0.0, or 0.5 * 2² vs 0.25 * 2³. The type bool has at least 8 bits and the raw values 1 and 2 (probably) both evaluate to true, but memcmp finds a difference.) When searching for a channel that already has the configuration we need, the comparison by member is the one that is needed. Convert the comparison accordingly to compare the members one after another. Also add a static_assert guard to (somewhat) ensure that when struct ad7173_channel_config::config_props is expanded, the comparison is adapted, too. This issue is somewhat theoretic, but using memcmp() on a struct is a bad pattern that is worth fixing. Fixes: 76a1e6a42802 ("iio: adc: ad7173: add AD7173 driver") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-14-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad7124: Fix comparison of channel configsUwe Kleine-König
Checking the binary representation of two structs (of the same type) for equality doesn't have the same semantic as comparing all members for equality. The former might find a difference where the latter doesn't in the presence of padding or when ambiguous types like float or bool are involved. (Floats typically have different representations for single values, like -0.0 vs +0.0, or 0.5 * 2² vs 0.25 * 2³. The type bool has at least 8 bits and the raw values 1 and 2 (probably) both evaluate to true, but memcmp finds a difference.) When searching for a channel that already has the configuration we need, the comparison by member is the one that is needed. Convert the comparison accordingly to compare the members one after another. Also add a static_assert guard to (somewhat) ensure that when struct ad7124_channel_config::config_props is expanded, the comparison is adapted, too. This issue is somewhat theoretic, but using memcmp() on a struct is a bad pattern that is worth fixing. Fixes: 7b8d045e497a ("iio: adc: ad7124: allow more than 8 channels") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-13-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad4130: Fix comparison of channel setupsUwe Kleine-König
Checking the binary representation of two structs (of the same type) for equality doesn't have the same semantic as comparing all members for equality. The former might find a difference where the latter doesn't in the presence of padding or when ambiguous types like float or bool are involved. (Floats typically have different representations for single values, like -0.0 vs +0.0, or 0.5 * 2² vs 0.25 * 2³. The type bool has at least 8 bits and the raw values 1 and 2 (probably) both evaluate to true, but memcmp finds a difference.) When searching for a channel that already has the configuration we need, the comparison by member is the one that is needed. Convert the comparison accordingly to compare the members one after another. Also add a static_assert guard to (somewhat) ensure that when struct ad4130_setup_info is expanded, the comparison is adapted, too. This issue is somewhat theoretic, but using memcmp() on a struct is a bad pattern that is worth fixing. Fixes: 62094060cf3a ("iio: adc: ad4130: add AD4130 driver") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-12-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad_sigma_delta: Disable channel after calibrationUwe Kleine-König
The function ad_sd_calibrate() enables the channel to calibrate at function entry but doesn't disable it on exit. This is problematic because if two (or more) channels are calibrated in a row, the second calibration isn't executed as intended as the first (still enabled) channel is recalibrated and after the first irq (i.e. when the calibration of the first channel completed) the calibration is aborted. This currently affects ad7173 only, as the other drivers using ad_sd_calibrate() never have more than one channel enabled at a time. To fix this, disable the calibrated channel after calibration. Fixes: 031bdc8aee01 ("iio: adc: ad7173: add calibration support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-11-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad7191: add AD7191Alisa-Dariana Roman
AD7191 is a pin-programmable, ultra-low noise 24-bit sigma-delta ADC designed for precision bridge sensor measurements. It features two differential analog input channels, selectable output rates, programmable gain, internal temperature sensor and simultaneous 50Hz/60Hz rejection. Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com> Reviewed-by: David Lechner<dlechner@baylibre.com> Link: https://patch.msgid.link/20250228141327.262488-3-alisa.roman@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-05iio: adc: ad7192: Grab direct mode for calibrationUwe Kleine-König
While a calibration is running, better don't make the device do anything else. To enforce that, grab direct mode during calibration. Fixes: 42776c14c692 ("staging: iio: adc: ad7192: Add system calibration support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/8aade802afca6a89641e24c1ae1d4b8d82cff58d.1740655250.git.u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-05iio: adc: ad7173: Grab direct mode for calibrationUwe Kleine-König
While a calibration is running, better don't make the device do anything else. To enforce that, grab direct mode during calibration. Fixes: 031bdc8aee01 ("iio: adc: ad7173: add calibration support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/8319fa2dc881c9899d60db4eba7fe8e984716617.1740655250.git.u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad7380: add adaq4381-4 supportJulien Stephan
adaq4381-4 is the 14 bits version of adaq4380-1 chip. Add support for it. Signed-off-by: Julien Stephan <jstephan@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250226-ad7380-add-adaq4381-4-support-v1-1-f350ab872d37@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: rockchip_saradc: add rk3562Simon Xue
rk3562 is using v2 saradc with 8 channels. Signed-off-by: Simon Xue <xxm@rock-chips.com> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Link: https://patch.msgid.link/20250227110343.2342017-2-kever.yang@rock-chips.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad4030: fix error pointer dereference in probe()Dan Carpenter
The intention here was obviously to return an error if devm_regmap_init() fails, but the return statement was accidentally left out. This leads to an error pointer dereference when we call: ret = ad4030_detect_chip_info(st); Add the return statement. Fixes: ec25cf6f1ee3 ("iio: adc: ad4030: add support for ad4632-16 and ad4632-24") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/cc67cee7-9c65-46d2-aae3-f860fc3cc461@stanley.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: light: Fix spelling mistake "regist" -> "register"Colin Ian King
There are spelling mistakes in dev_err messages. Fix them. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://patch.msgid.link/20250228090228.679535-1-colin.i.king@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: buffer-dma: Fix docstringsFolker Schwesinger
Fix a typo in the docstring of iio_dma_buffer_read() and fix what looks like a copy-and-paste error in the iio_dma_buffer_write() docstring. Signed-off-by: Folker Schwesinger <dev@folker-schwesinger.de> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/D83IPSTKYWNB.1PUBV1530XI86@folker-schwesinger.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: rockchip_saradc: Add support for RK3528Jonas Karlman
The Successive Approximation ADC (SARADC) in RK3528 uses the v2 controller and support: - 10-bit resolution - Up to 1MS/s sampling rate - 4 single-ended input channels - Current consumption: 0.5mA @ 1MS/s Add support for the 4 channels of 10-bit resolution supported by SARADC in RK3528. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20250227184058.2964204-3-jonas@kwiboo.se Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: imu: adis: fix uninitialized symbol warningsunliming
Fix below kernel warning: smatch warnings: drivers/iio/imu/adis.c:319 __adis_check_status() error: uninitialized symbol 'status_16'. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: sunliming <sunliming@kylinos.cn> Link: https://patch.msgid.link/20250304060518.1834910-1-sunliming@linux.dev Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad4851: Fix signedness bug in ad4851_calibrate()Dan Carpenter
The "c" variable is used to store error codes from ad4851_find_opt() so it has to be signed for the error handling to work. Change it to type int. Fixes: 6250803fe2ec ("iio: adc: ad4851: add ad485x driver") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/f5e260e9-d7a8-4dae-b7ea-f1bbb1760e60@stanley.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: accel: adxl345: reorganize irq handlerLothar Rubusch
Reorganize the IRQ handler. Move the overrun handling to the bottom. Overrun leads to reset the interrupt register. This also happens at evaluation of a particular interrupt event. First evaluate an event if possible, then fall back to overrun handling. Additionally simplify fetching the interrupt status function. Both is in preparation to build interrupt handling up for the handling of different detected events, implemented in follow up patches. Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com> Link: https://patch.msgid.link/20250220104234.40958-4-l.rubusch@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: accel: adxl345: add debug register accessLothar Rubusch
Add the possibility to verify the content of the configuration registers of the sensor in preparation for upcomming feature implementations. Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com> Link: https://patch.msgid.link/20250220104234.40958-3-l.rubusch@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: accel: adxl345: reorganize measurement enableLothar Rubusch
Move the measurement enable function up in order to have it generically available. This is a preparation for upcomming patches. Particular features need to have measuring off while changing settings, and turned on again afterwards. Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com> Link: https://patch.msgid.link/20250220104234.40958-2-l.rubusch@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: imu: bmi270: add support for data ready interrupt triggerGustavo Silva
The BMI270 sensor provides two interrupt pins that can be used for different interrupt sources, including a data ready signal. Add support for configuring one the pins as a trigger source. The interrupt pin can be configured with various options: active high or low, push-pull or open-drain, and latched or non-latched. Acked-by: Alex Lanzano <lanzano.alex@gmail.com> Signed-off-by: Gustavo Silva <gustavograzs@gmail.com> Link: https://patch.msgid.link/20250228-bmi270-irq-v2-3-3f97a4e8f551@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: imu: bmi270: rename variable bmi270_device to dataGustavo Silva
Rename all instances of 'struct bmi270_data' to 'data', to ensure consistency across the driver. Also rename bmi270_data::data to bmi270_data::buffer to avoid naming conflicts. Acked-by: Alex Lanzano <lanzano.alex@gmail.com> Signed-off-by: Gustavo Silva <gustavograzs@gmail.com> Link: https://patch.msgid.link/20250228-bmi270-irq-v2-2-3f97a4e8f551@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: Include cleanup.h when using guard()Matti Vaittinen
Directly include the cleanup.h for the guard() instead of relying it to be included via other files. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://patch.msgid.link/5b352ce7241e5904a317dd26950c7cd4daa59fc0.1740748394.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: imu: bmi270: move private struct declaration to source fileGustavo Silva
The device's private data struct is currently declared in the header file, but it does not need to be exposed there. Move it to the driver's core source file to avoid unnecessary #include directives or forward declarations in the header. Signed-off-by: Gustavo Silva <gustavograzs@gmail.com> Acked-by: Alex Lanzano <lanzano.alex@gmail.com> Link: https://patch.msgid.link/20250219-bmi270-irq-v1-1-145d02bbca3b@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: dac: adi-axi-dac: add io_mode checkAngelo Dureghello
Add safe check to the high bound of the enum values, Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Link: https://patch.msgid.link/20250219-wip-bl-axi-dac-add-enum-check-v1-1-8de9db0b3b1b@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: gyro: bmg160_i2c: add BMI088 to of_match_tableJun Yan
BMI088 is missing from the of_match_table. Let's complete it. Signed-off-by: Jun Yan <jerrysteve1101@gmail.com> Link: https://patch.msgid.link/20250220165001.273325-3-jerrysteve1101@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad4695: simplify getting oversampling_ratioDavid Lechner
We already have a local variable that holds a pointer to st->channels_cfg[chan->scan_index]. Use that to simplify the code. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Trevor Gamblin <tgamblin@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250218-iio-adc-ad4695-fix-out-of-bounds-array-access-v1-2-57fef8c7a3fd@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad4695: fix out of bounds array accessDavid Lechner
Fix some out of bounds array access of st->channels_cfg in the ad4695 driver. This array only has elements for voltage channels, but it was also being accessed for the temperature channel in a few cases causing reading past the end of the array. In some cases, this was harmless because the value was read but not used. However, the in_temp_sampling_frequency attribute shares code with the in_voltageY_sampling_frequency attributes and was trying to read the oversampling ratio from the st->channels_cfg array. This resulted in a garbage value being used in the calculation and the resulting in_temp_sampling_frequency value was incorrect. To fix, make sure we always check that we are dealing with a voltage channel before accessing the st->channels_cfg array and use an oversampling ratio of 1 for the temperature channel (multiplicative identity value) since that channel doesn't support oversampling. Fixes: 67d63185db79 ("iio: adc: ad4695: add offload-based oversampling support") Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Trevor Gamblin <tgamblin@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250218-iio-adc-ad4695-fix-out-of-bounds-array-access-v1-1-57fef8c7a3fd@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: adi-axi-adc: replace of.h with mod_devicetable.hNuno Sá
Don't use of.h in order to include mod_devicetable.h. Use it directly as there no direct dependency on OF. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250218-dev-axi-adc-fix-headers-v1-1-5ddc79221d8c@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: core: make use of simple_write_to_buffer()Nuno Sá
Instead of open coding (kind of) simple_write_to_buffer(), use it. While at it, use ascii representation to terminate the string as that is the more common way of doing it. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250218-dev-iio-misc-v1-2-bf72b20a1eb8@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: backend: make sure to NULL terminate stack bufferNuno Sá
Make sure to NULL terminate the buffer in iio_backend_debugfs_write_reg() before passing it to sscanf(). It is a stack variable so we should not assume it will 0 initialized. Fixes: cdf01e0809a4 ("iio: backend: add debugFs interface") Signed-off-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250218-dev-iio-misc-v1-1-bf72b20a1eb8@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
Single patch for all the relatively simple cases. 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: Olivier Moysan <olivier.moysan@foss.st.com> Cc: Phil Reid <preid@electromag.com.au> Reviewed-by: Mike Looijmans <mike.looijmans@topic.nl> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-30-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: max11410: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
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: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-27-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: max11410: Factor out writing of sampling frequency to simplify ↵Jonathan Cameron
errro paths. Introduce __max11410_write_samp_freq() helper and use guard() to avoid need for manual unlock of the mutex. This allows direct returns and simplifies the resulting error handling. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-26-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: max1027: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
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: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://patch.msgid.link/20250217141630.897334-25-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: max1027: Move claim of direct mode up one level and use guard()Jonathan Cameron
Move iio_device_claim_direct_mode() into the read_raw() callback and use guard() to release a mutex. This enables simpler error handling via direct returns. Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://patch.msgid.link/20250217141630.897334-24-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: at91-sama5d2: Switch to sparse friendly ↵Jonathan Cameron
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: Claudiu Beznea <claudiu.beznea@tuxon.dev> Link: https://patch.msgid.link/20250217141630.897334-23-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: at91-sama5d2: Move claim of direct mode up a level and use guard()Jonathan Cameron
Move iio_device_claim_direct_mode() up one layer in the call stack, and use guard() for scope based unlocking to simplify error handling by allowing direct returns. Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> Link: https://patch.msgid.link/20250217141630.897334-22-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad_sigma_delta: Switch to sparse friendly ↵Jonathan Cameron
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 complex function with a lot more than the release of direct mode to unwind on error. As such no attempt made to factor out the inner code. Cc: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-21-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad799x: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
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: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-20-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad7793: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
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: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-19-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad7793: Factor out core of ad7793_write_raw() to simplify error ↵Jonathan Cameron
handling Factor out everything under the direct mode claim allowing direct returns in error paths. Switch sense of matching in the loop and use a continue to reduce code indent and improve readability. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-18-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad7791: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
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: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-17-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad7791: Factor out core of ad7791_write_raw() to simplify error ↵Jonathan Cameron
handling Factor out everything under the direct mode claim allowing direct returns in error paths. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-16-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad7606: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
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 driver got partly converted during removal of the _scoped form. However some more cases got added in parallel. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-15-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad7768-1: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
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: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-14-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad7768-1: Move setting of val a bit later to avoid unnecessary ↵Jonathan Cameron
return value check The data used is all in local variables so there is no advantage in setting *val = ret with the direct mode claim held. Move it later to after error check. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-13-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad7192: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
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: Alisa-Dariana Roman <alisa.roman@analog.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-12-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad7192: Factor out core of ad7192_write_raw() to simplify error ↵Jonathan Cameron
handling. Factor out everything under the lock, use guard() for the mutex to avoid need to manually unlock, and switch sense of matching checks in loops to reduce indent. There are some functional changes in here as well as the code no longer updates the filter_freq_available if no change has been made to the oversampling ratio. Cc: Alisa-Dariana Roman <alisa.roman@analog.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-11-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad4030: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
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: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-10-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: stm32-dfsdm: Switch to sparse friendly ↵Jonathan Cameron
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: Olivier Moysan <olivier.moysan@foss.st.com> Link: https://patch.msgid.link/20250217141630.897334-9-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>