Gustavo Silva
a1854d55f5
iio: imu: bmi270: add support for data ready interrupt trigger
...
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-04 13:17:51 +00:00
Gustavo Silva
16c94de2aa
iio: imu: bmi270: rename variable bmi270_device to data
...
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-04 13:17:51 +00:00
Marcelo Schmitt
9b4b9791dd
Documentation: iio: Add ADC documentation
...
ADC inputs can be classified into a few different types according to how
they measure the input signal, how restrained the signal is, and number of
input pins. Even though datasheets tend to provide many details about their
inputs and measurement procedures, it may not always be clear how to model
those inputs into IIO channels.
For example, some differential ADCs can have their inputs configured into
pseudo-differential channels. In that configuration, only one input
connects to the signal of interest as opposed to using two inputs of a
differential input configuration. Datasheets sometimes also refer to
pseudo-differential inputs as single-ended inputs even though they have
distinct physical configuration and measurement procedure.
Document consolidated ADC input types and how they are usually described
and supported in device tree and IIO, respectively.
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/e6ac2a595f06ba2d5ff0eb86e5895479c9dd797f.1739998491.git.marcelo.schmitt@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:51 +00:00
Matti Vaittinen
8c53df1499
iio: adc: Include cleanup.h when using guard()
...
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-04 13:17:51 +00:00
Gustavo Silva
4e0bd62e80
iio: imu: bmi270: move private struct declaration to source file
...
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-04 13:17:51 +00:00
Angelo Dureghello
25331775b5
iio: dac: adi-axi-dac: add io_mode check
...
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-04 13:17:51 +00:00
Jun Yan
583350c1d4
iio: gyro: bmg160_i2c: add BMI088 to of_match_table
...
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-04 13:17:51 +00:00
Lothar Rubusch
b543d881e8
docs: iio: fix wrong driver name in documentation
...
The ADXL380/382 documentation uses in one place a wrong driver name.
Adds no functional change.
Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com >
Link: https://patch.msgid.link/20250221194658.41358-1-l.rubusch@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:51 +00:00
David Lechner
38f898e0b5
iio: adc: ad4695: simplify getting oversampling_ratio
...
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-04 13:17:50 +00:00
David Lechner
cafeb8a997
iio: adc: ad4695: fix out of bounds array access
...
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: 67d63185db ("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-04 13:17:50 +00:00
Nuno Sá
d477cda71a
iio: adc: adi-axi-adc: replace of.h with mod_devicetable.h
...
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-04 13:17:50 +00:00
Nuno Sá
6d5dd486c7
iio: core: make use of simple_write_to_buffer()
...
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-04 13:17:50 +00:00
Nuno Sá
035b498921
iio: backend: make sure to NULL terminate stack buffer
...
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: cdf01e0809 ("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-04 13:17:50 +00:00
Jonathan Cameron
1a21a9842e
iio: adc: Switch to sparse friendly iio_device_claim/release_direct()
...
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-04 13:17:50 +00:00
Jonathan Cameron
0152834768
iio: adc: max11410: 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: 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-04 13:17:50 +00:00
Jonathan Cameron
386c1d6e41
iio: adc: max11410: Factor out writing of sampling frequency to simplify 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-04 13:17:50 +00:00
Jonathan Cameron
71dfa35f7b
iio: adc: max1027: 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: 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-04 13:17:50 +00:00
Jonathan Cameron
2ce5314c68
iio: adc: max1027: Move claim of direct mode up one level and use guard()
...
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-04 13:17:50 +00:00
Jonathan Cameron
173386d036
iio: adc: at91-sama5d2: 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: 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-04 13:17:50 +00:00
Jonathan Cameron
b3179f59c1
iio: adc: at91-sama5d2: Move claim of direct mode up a level and use guard()
...
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-04 13:17:50 +00:00
Jonathan Cameron
6eedf172d9
iio: adc: ad_sigma_delta: 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 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-04 13:17:49 +00:00
Jonathan Cameron
bbd841f9d0
iio: adc: ad799x: 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: 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-04 13:17:49 +00:00
Jonathan Cameron
4d47f64ca8
iio: adc: ad7793: 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: 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-04 13:17:49 +00:00
Jonathan Cameron
f1a4a2e6b8
iio: adc: ad7793: Factor out core of ad7793_write_raw() to simplify error 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-04 13:17:49 +00:00
Jonathan Cameron
85e840ced7
iio: adc: ad7791: 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: 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-04 13:17:49 +00:00
Jonathan Cameron
c05cbf02df
iio: adc: ad7791: Factor out core of ad7791_write_raw() to simplify error 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-04 13:17:49 +00:00
Jonathan Cameron
15bed4f0cb
iio: adc: ad7606: 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 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-04 13:17:49 +00:00
Jonathan Cameron
e76750f50a
iio: adc: ad7768-1: 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: 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-04 13:17:49 +00:00
Jonathan Cameron
0af1c801a1
iio: adc: ad7768-1: Move setting of val a bit later to avoid unnecessary 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-04 13:17:49 +00:00
Jonathan Cameron
4758f987d3
iio: adc: ad7192: 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: 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-04 13:17:49 +00:00
Jonathan Cameron
32143dbd95
iio: adc: ad7192: Factor out core of ad7192_write_raw() to simplify error 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-04 13:17:49 +00:00
Jonathan Cameron
5ff6b02d9b
iio: adc: ad4030: 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: 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-04 13:17:49 +00:00
Jonathan Cameron
e493763302
iio: adc: stm32-dfsdm: 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: 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 >
2025-03-04 13:17:48 +00:00
Jonathan Cameron
728341b0ca
iio: adc: stm32-dfsdm: Factor out core of reading INFO_RAW
...
This allows the claim on direct mode to be release in one place
rather than a lot of error paths, simplifying code.
Reviewed-by: Olivier Moysan <olivier.moysan@foss.st.com >
Link: https://patch.msgid.link/20250217141630.897334-8-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:48 +00:00
Svyatoslav Ryhel
d531b9f789
iio: light: Add support for AL3000a illuminance sensor
...
AL3000a is a simple I2C-based ambient light sensor, which is
closely related to AL3010 and AL3320a, but has significantly
different way of processing data generated by the sensor.
Tested-by: Robert Eckelmann <longnoserob@gmail.com >
Tested-by: Antoni Aloy Torrens <aaloytorrens@gmail.com >
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com >
Reviewed-by: David Heidelberg <david@ixit.cz >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://patch.msgid.link/20250217140336.107476-3-clamor95@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:48 +00:00
Svyatoslav Ryhel
5f763d31a5
dt-bindings: iio: light: al3010: add al3000a support
...
AL3000a is an ambient light sensor quite closely related to
exising AL3010 and can reuse exising schema for AL3010.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com >
Reviewed-by: David Heidelberg <david@ixit.cz >
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://patch.msgid.link/20250217140336.107476-2-clamor95@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:48 +00:00
Jonathan Cameron
3cb26cba4a
iio: accel: Switch to sparse friendly iio_device_claim/release_direct()
...
Single patch for the simple cases in accelerometer drivers.
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: Antoniu Miclaus <antoniu.miclaus@analog.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250217140135.896574-9-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:48 +00:00
Jonathan Cameron
18a53d4012
iio: accel: msa311: 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/20250217140135.896574-8-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:48 +00:00
Jonathan Cameron
60a0cf2eba
iio: accel: msa311: Fix failure to release runtime pm if direct mode claim fails.
...
Reorder the claiming of direct mode and runtime pm calls to simplify
handling a little. For correct error handling, after the reorder
iio_device_release_direct_mode() must be claimed in an error occurs
in pm_runtime_resume_and_get()
Fixes: 1ca2cfbc0c ("iio: add MEMSensing MSA311 3-axis accelerometer driver")
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250217140135.896574-7-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:48 +00:00
Jonathan Cameron
6c21fc09c3
iio: accel: kx022a: 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: Matti Vaittinen <mazziesaccount@gmail.com >
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250217140135.896574-6-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:48 +00:00
Jonathan Cameron
305f655d05
iio: accel: kx022a: Factor out guts of write_raw() to allow direct returns
...
Create a new utility function for the actions taken when direct mode
is held. This allows for direct returns, simplifying the code flow.
Cc: Matti Vaittinen <mazziesaccount@gmail.com >
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250217140135.896574-5-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:48 +00:00
Jonathan Cameron
9ab72adb90
iio: accel: mma8452: 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/20250217140135.896574-4-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:48 +00:00
Jonathan Cameron
cce9172f3d
iio: accel: mma8452: Factor out guts of write_raw() to simplify locking
...
Factoring out those parts of write_raw() in which direct mode is held
allows for direct returns on errors, simplifying the code.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Link: https://patch.msgid.link/20250217140135.896574-3-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-03-04 13:17:48 +00:00
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