]> git.ipfire.org Git - thirdparty/kernel/stable.git/log
thirdparty/kernel/stable.git
3 weeks agoiio: accel: adxl313: add inactivity sensing
Lothar Rubusch [Wed, 2 Jul 2025 23:08:16 +0000 (23:08 +0000)] 
iio: accel: adxl313: add inactivity sensing

Enhance the interrupt handler to process inactivity events. Introduce
functions to configure the threshold and period registers for
inactivity detection, as well as to enable or disable the inactivity
feature. Extend the fake IIO channel to handle inactivity events by
combining the x, y, and z axes using a logical AND operation.

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250702230819.19353-6-l.rubusch@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: accel: adxl313: add activity sensing
Lothar Rubusch [Wed, 2 Jul 2025 23:08:15 +0000 (23:08 +0000)] 
iio: accel: adxl313: add activity sensing

Add support for configuring an activity detection threshold. Extend the
interrupt handler to process activity-related interrupts, and provide
functions to set the threshold as well as to enable or disable activity
sensing. Additionally, introduce a virtual channel that represents the
logical AND of the x, y, and z axes in the IIO channel.

This patch serves as a preparatory step; some definitions and functions
introduced here are intended to be extended later to support inactivity
detection.

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250702230819.19353-5-l.rubusch@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: accel: adxl313: add buffered FIFO watermark with interrupt handling
Lothar Rubusch [Wed, 2 Jul 2025 23:08:14 +0000 (23:08 +0000)] 
iio: accel: adxl313: add buffered FIFO watermark with interrupt handling

Cover the following tasks:
- Add scan_mask and scan_index to the IIO channel configuration. The
scan_index sets up buffer usage. According to the datasheet, the ADXL313
uses a 13-bit wide data field in full-resolution mode. Set the
signedness, number of storage bits, and endianness accordingly.

- Parse the devicetree for an optional interrupt line and configure the
interrupt mapping based on its presence. If no interrupt line is
specified, keep the FIFO in bypass mode as currently implemented.

- Set up the interrupt handler. Add register access to detect and
evaluate interrupts. Implement functions to clear status registers and
reset the FIFO.

- Implement FIFO watermark configuration and handling. Allow the
watermark level to be set, evaluate the corresponding interrupt, read
the FIFO contents, and push the data to the IIO channel.

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250702230819.19353-4-l.rubusch@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: accel: adxl313: add function to enable measurement
Lothar Rubusch [Wed, 2 Jul 2025 23:08:13 +0000 (23:08 +0000)] 
iio: accel: adxl313: add function to enable measurement

Refactor the control of measurement and standby modes for the sensor.
Instead of directly writing to the register, encapsulate this operation
in a dedicated function that handles enabling and disabling measurement.
This approach will reduce code duplication wherever sensor configuration
changes are required. In subsequent patches, measurement mode will be
set to standby as part of this process.

Additionally, simplify the control mask to include only the measurement
bit. The sleep bit governs a different behavior—putting the sensor into
sleep mode, not just standby for configuration—and is currently unused.
Therefore, there's no need to include both the sleep and measurement
bits in the same mask.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250702230819.19353-3-l.rubusch@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: accel: adxl313: make use of regmap cache
Lothar Rubusch [Wed, 2 Jul 2025 23:08:12 +0000 (23:08 +0000)] 
iio: accel: adxl313: make use of regmap cache

Setup regmap cache to cache register configuration, reducing bus traffic
for repeated accesses to non volatile registers.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250702230819.19353-2-l.rubusch@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: mt6359: Add support for MediaTek MT6373 PMIC AUXADC
AngeloGioacchino Del Regno [Thu, 3 Jul 2025 14:11:46 +0000 (16:11 +0200)] 
iio: adc: mt6359: Add support for MediaTek MT6373 PMIC AUXADC

MediaTek MT6373 is a PMIC found on MT8196/MT6991 board designs
and communicates with the SoC over SPMI.

This PMIC integrates an Auxiliary ADC (AUXADC) which has a grand
total of 54 channels, of which usually only 9 are used as this
is usually paired with MT6363 on the same board.

For the Auxiliary ADC part, this reuses the same register layout
as the MT6363 PMIC, but exposes only a subset of the ADC chans.

Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250703141146.171431-7-angelogioacchino.delregno@collabora.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: mt6359: Add support for MediaTek MT6363 PMIC AUXADC
AngeloGioacchino Del Regno [Thu, 3 Jul 2025 14:11:45 +0000 (16:11 +0200)] 
iio: adc: mt6359: Add support for MediaTek MT6363 PMIC AUXADC

MediaTek MT6363 is a PMIC found on MT8196/MT6991 board designs
and communicates with the SoC over SPMI.

This PMIC integrates an Auxiliary ADC (AUXADC) which has a grand
total of 54 ADC channels: 49 PMIC-internal channels, 2 external
NTC thermistor channels and 2 generic ADC channels (mapped to 7
PMIC ADC external inputs).

To use a generic ADC channel it is necessary to enable one of
the PMIC ADC inputs at a time and only then start the reading,
so in this case it is possible to read only one external input
for each generic ADC channel.

Due to the lack of documentation, this implementation supports
using only one generic ADC channel, hence supports reading only
one external input at a time.

Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250703141146.171431-6-angelogioacchino.delregno@collabora.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: mt6359: Move reference voltage to platform data
AngeloGioacchino Del Regno [Thu, 3 Jul 2025 14:11:44 +0000 (16:11 +0200)] 
iio: adc: mt6359: Move reference voltage to platform data

In preparation to add support for new PMICs, add a `vref_mv`
member to struct mtk_pmic_auxadc_info and use it in place of
the AUXADC_VOLT_FULL definition.

As a consequence, the definition was also removed.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250703141146.171431-5-angelogioacchino.delregno@collabora.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: mt6359: Add ready register index and mask to channel data
AngeloGioacchino Del Regno [Thu, 3 Jul 2025 14:11:43 +0000 (16:11 +0200)] 
iio: adc: mt6359: Add ready register index and mask to channel data

In preparation for adding support for the AUXADC block found in
the MT6363 PMIC, add the ready register index and mask to the
mtk_pmic_auxadc_chan structure, populate those in the channel
description for all of the already supported SoCs and make use
of them in the .read_imp() callbacks.

Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250703141146.171431-4-angelogioacchino.delregno@collabora.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agodt-bindings: iio: adc: mt6359: Add MT6373 PMIC AuxADC
AngeloGioacchino Del Regno [Thu, 3 Jul 2025 14:11:42 +0000 (16:11 +0200)] 
dt-bindings: iio: adc: mt6359: Add MT6373 PMIC AuxADC

Add a compatible and channel bindings for MediaTek's MT6373 PMIC,
featuring an Auxiliary ADC IP with 15 ADC channels for external
(SoC) temperatures and external voltage inputs.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250703141146.171431-3-angelogioacchino.delregno@collabora.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agodt-bindings: iio: adc: mt6359: Add MT6363 PMIC AuxADC
AngeloGioacchino Del Regno [Thu, 3 Jul 2025 14:11:41 +0000 (16:11 +0200)] 
dt-bindings: iio: adc: mt6359: Add MT6363 PMIC AuxADC

Add a compatible and channel bindings for MediaTek's MT6363 PMIC,
featuring an Auxiliary ADC IP with 15 ADC channels used for both
internal temperatures and voltages and for external voltage inputs.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250703141146.171431-2-angelogioacchino.delregno@collabora.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: ad4000: don't use shift_right()
David Lechner [Wed, 2 Jul 2025 13:23:00 +0000 (08:23 -0500)] 
iio: adc: ad4000: don't use shift_right()

Drop use of shift_right() macro for unsigned value. The shift_right()
macro is intended for signed values and is not needed for unsigned
values.

This was found by a static analysis tool [1].

Link: https://github.com/analogdevicesinc/linux/pull/2831/files#diff-c14a34a6492576d22e7192cc0f61ad0083190aeb627191596fe12462f0c6f21aR557
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250702-iio-adc-ad4000-don-t-use-shift_right-v1-1-041c2d6c3950@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: ad_sigma_delta: add SPI offload support
David Lechner [Tue, 1 Jul 2025 21:37:59 +0000 (16:37 -0500)] 
iio: adc: ad_sigma_delta: add SPI offload support

Add SPI offload support to the ad_sigma_delta module.

When the SPI controller has SPI offload capabilities, the module will
now use that for buffered reads instead of the RDY interrupt trigger.

Drivers that use the ad_sigma_delta module will have to opt into this
by setting supports_spi_offload since each driver will likely need
additional changes before SPI offload can be used. This will allow us
to gradually enable SPI offload support for each driver.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250701-iio-adc-ad7173-add-spi-offload-support-v3-11-42abb83e3dac@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: ad_sigma_delta: use spi_optimize_message()
David Lechner [Tue, 1 Jul 2025 21:37:56 +0000 (16:37 -0500)] 
iio: adc: ad_sigma_delta: use spi_optimize_message()

Use spi_optimize_message() to improve the performance of buffered reads.

By setting up the SPI message and pre-optimizing it in the buffer
postenable callback, we can reduce overhead during each sample read.

A rough estimate shows that this reduced the CPU usage of the interrupt
handler thread from 22% to 16% using an EVAL-AD4112ARDZ board on a
DE10-Nano (measuring a single channel at the default 6.2 kHz sample
rate).

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250701-iio-adc-ad7173-add-spi-offload-support-v3-8-42abb83e3dac@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: ad_sigma_delta: refactor setting read address
David Lechner [Tue, 1 Jul 2025 21:37:55 +0000 (16:37 -0500)] 
iio: adc: ad_sigma_delta: refactor setting read address

Refactor code to set the read address in a separate function.

This code is already duplicated twice and we will need to use it a third
time in a later commit.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250701-iio-adc-ad7173-add-spi-offload-support-v3-7-42abb83e3dac@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: ad_sigma_delta: audit included headers
David Lechner [Tue, 1 Jul 2025 21:37:54 +0000 (16:37 -0500)] 
iio: adc: ad_sigma_delta: audit included headers

Drop linux/iio/sysfs.h since it is unused and replace linux/kernel.h
with more explicit headers. There are a couple of other headers added
weren't covered by kernel.h, like linux/gpio/consumer.h that are added
since the module makes use of those APIs as well.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250701-iio-adc-ad7173-add-spi-offload-support-v3-6-42abb83e3dac@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: ad_sigma_delta: use BITS_TO_BYTES() macro
David Lechner [Tue, 1 Jul 2025 21:37:53 +0000 (16:37 -0500)] 
iio: adc: ad_sigma_delta: use BITS_TO_BYTES() macro

Use the BITS_TO_BYTES() macro instead of dividing by 8 to convert bits
to bytes.

This makes it more obvious what unit conversion is taking place.

In one instance, we also avoid the temporary assignment to a variable
as it was confusing that reg_size was being used with two different
units (bits and bytes).

scan_type is factored out to reduce line wrapping.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250701-iio-adc-ad7173-add-spi-offload-support-v3-5-42abb83e3dac@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: ad_sigma_delta: use sizeof() in ALIGN()
David Lechner [Tue, 1 Jul 2025 21:37:52 +0000 (16:37 -0500)] 
iio: adc: ad_sigma_delta: use sizeof() in ALIGN()

Use sizeof() instead of hardcoding the size of the timestamp in the
ALIGN() macro. This makes it a bit more obvious what the intention of
the code is.

Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250701-iio-adc-ad7173-add-spi-offload-support-v3-4-42abb83e3dac@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: ad_sigma_delta: use u8 instead of uint8_t
David Lechner [Tue, 1 Jul 2025 21:37:51 +0000 (16:37 -0500)] 
iio: adc: ad_sigma_delta: use u8 instead of uint8_t

Replace uint8_t with u8 in the ad_sigma_delta driver.

Technically, uint8_t comes from the C standard library, while u8 is a
Linux kernel type. Since we don't use the C standard library in the
kernel, we should use the kernel types instead.

There is also one instance where int64_t is replaced with s64.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250701-iio-adc-ad7173-add-spi-offload-support-v3-3-42abb83e3dac@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: ad_sigma_delta: sort includes
David Lechner [Tue, 1 Jul 2025 21:37:50 +0000 (16:37 -0500)] 
iio: adc: ad_sigma_delta: sort includes

Sort includes in alphabetical order and fix grouping before we add more.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250701-iio-adc-ad7173-add-spi-offload-support-v3-2-42abb83e3dac@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: ad_sigma_delta: don't overallocate scan buffer
David Lechner [Tue, 1 Jul 2025 21:37:49 +0000 (16:37 -0500)] 
iio: adc: ad_sigma_delta: don't overallocate scan buffer

Fix overallocating the size of the scan buffer by converting bits to
bytes. The size is meant to be in bytes, so scanbits needs to be
divided by 8.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250701-iio-adc-ad7173-add-spi-offload-support-v3-1-42abb83e3dac@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: imu: inv_mpu6050: Replace scnprintf with sysfs_emit
Chelsy Ratnawat [Tue, 1 Jul 2025 15:47:20 +0000 (08:47 -0700)] 
iio: imu: inv_mpu6050: Replace scnprintf with sysfs_emit

Documentation/filesystems/sysfs.rst mentions that show() should only
use sysfs_emit() or sysfs_emit_at() when formating the value to be
returned to user space. So replace scnprintf() with sysfs_emit().

Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20250701154720.54276-1-chelsyratnawat2001@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: pressure: dlhl60d: Use separate structures rather than an array for chip info
David Lechner [Sat, 28 Jun 2025 18:15:10 +0000 (13:15 -0500)] 
iio: pressure: dlhl60d: Use separate structures rather than an array for chip info

Change the dlhl60d driver to use individual chip info structures instead
of an array. This reduces the verbosity of the code. Also, the data is
now const as it should have been in the first place.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-24-v2-1-1c90073d1323@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: light: cm3232: make struct cm3232_als_info const
David Lechner [Sat, 28 Jun 2025 17:52:31 +0000 (12:52 -0500)] 
iio: light: cm3232: make struct cm3232_als_info const

Add const qualifier to struct cm3232_als_info. This is read-only data so
it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-20-v1-2-2bf90b03f9f1@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: light: cm3232: move calibscale to struct cm3232_chip
David Lechner [Sat, 28 Jun 2025 17:52:30 +0000 (12:52 -0500)] 
iio: light: cm3232: move calibscale to struct cm3232_chip

Move the calibscale field from struct cm3232_als_info to struct
cm3232_chip. The chip info struct is supposed to be const while the
driver data struct should contain mutable fields. Since calibscale
is a mutable field, it should be in the driver data struct.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-20-v1-1-2bf90b03f9f1@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: imu: adis16400: Use separate structures rather than an array for chip info
David Lechner [Sat, 28 Jun 2025 17:27:46 +0000 (12:27 -0500)] 
iio: imu: adis16400: Use separate structures rather than an array for chip info

Change the adis16400 driver to use individual chip info structures
instead of an array. This reduces the verbosity of the code. Also, the
data is now const as it should have been in the first place.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-17-v1-1-a215ebb653ec@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: ad7768-1: add low pass -3dB cutoff attribute
Jonathan Santos [Wed, 11 Jun 2025 11:52:03 +0000 (08:52 -0300)] 
iio: adc: ad7768-1: add low pass -3dB cutoff attribute

Ad7768-1 has a different -3db frequency multiplier depending on
the filter type configured. The cutoff frequency also varies according
to the current ODR.

Add a readonly low pass -3dB frequency cutoff attribute to clarify to
the user which bandwidth is being allowed depending on the filter
configurations.

Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
Link: https://patch.msgid.link/804d66f1858014d7278aec3344d81c223661e878.1749569957.git.Jonathan.Santos@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: adc: ad7124: Use separate structures rather than array for chip info
David Lechner [Sat, 28 Jun 2025 16:16:51 +0000 (11:16 -0500)] 
iio: adc: ad7124: Use separate structures rather than array for chip info

Change the ad7124 driver to use individual chip info structures instead
of an array. This reduces the verbosity of the code. Also, the data is
now const as it should have been in the first place.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-5-v1-1-9e56c2f77979@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: proximity: vcnl3020: make vcnl3020_property const
David Lechner [Sat, 28 Jun 2025 18:23:49 +0000 (13:23 -0500)] 
iio: proximity: vcnl3020: make vcnl3020_property const

Add const qualifier to struct vcnl3020_property
vcnl3020_led_current_property. This is read-only data so it can be made
const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-25-v1-2-5d99cf17790e@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: proximity: vcnl3020: pass struct vcnl3020_property by pointer
David Lechner [Sat, 28 Jun 2025 18:23:48 +0000 (13:23 -0500)] 
iio: proximity: vcnl3020: pass struct vcnl3020_property by pointer

Pass struct vcnl3020_property by pointer instead of by value to avoid
copying the entire struct.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-25-v1-1-5d99cf17790e@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: pressure: abp060mg: make abp_config const
David Lechner [Sat, 28 Jun 2025 17:58:11 +0000 (12:58 -0500)] 
iio: pressure: abp060mg: make abp_config const

Add const qualifier to struct abp_config abp_config[]. This is
read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-23-v1-1-542cfadce9d0@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: light: zopt2201: make zopt2201_scale const
David Lechner [Sat, 28 Jun 2025 17:56:30 +0000 (12:56 -0500)] 
iio: light: zopt2201: make zopt2201_scale const

Add const qualifier to struct zopt2201_scale zopt2201_scale_*[]. This
is read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-22-v1-1-fc9ebdc5f5c3@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 weeks agoiio: light: isl76682: make isl76682_range_table const
David Lechner [Sat, 28 Jun 2025 17:54:37 +0000 (12:54 -0500)] 
iio: light: isl76682: make isl76682_range_table const

Add const qualifier to struct isl76682_range isl76682_range_table[].
This is read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-21-v1-1-2597d8eda30f@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: imu: bmi160: make bmi160_regs const
David Lechner [Sat, 28 Jun 2025 17:31:43 +0000 (12:31 -0500)] 
iio: imu: bmi160: make bmi160_regs const

Add const qualifier to struct bmi160_regs bmi160_regs[]. This is
read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-18-v1-1-dad85ac392ae@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: dac: ltc2688: make ltc2688_dither_ext_info const
David Lechner [Sat, 28 Jun 2025 17:15:24 +0000 (12:15 -0500)] 
iio: dac: ltc2688: make ltc2688_dither_ext_info const

Add const qualifier to struct iio_chan_spec_ext_info
ltc2688_dither_ext_info[]. This is read-only data so it can be made
const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-16-v1-1-9b6514588b05@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: dac: ad5770r: make ad5770r_rng_tbl const
David Lechner [Sat, 28 Jun 2025 17:11:46 +0000 (12:11 -0500)] 
iio: dac: ad5770r: make ad5770r_rng_tbl const

Add const qualifier to struct ad5770r_output_modes ad5770r_rng_tbl[].
This is read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-15-v1-1-b86ae055004c@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: common: hid-sensor-attributes: make unit_conversion const
David Lechner [Sat, 28 Jun 2025 17:09:26 +0000 (12:09 -0500)] 
iio: common: hid-sensor-attributes: make unit_conversion const

Add const qualifier to struct unit_conversion[]. This is read-only data
so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-14-v1-1-4faa8015e122@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: chemical: atlas-ezo-sensor: make atlas_ezo_devices const
David Lechner [Sat, 28 Jun 2025 17:06:35 +0000 (12:06 -0500)] 
iio: chemical: atlas-ezo-sensor: make atlas_ezo_devices const

Add const qualifier to struct atlas_ezo_device atlas_ezo_devices[]. This
is read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-13-v1-1-2a7fd592a07c@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: amplifiers: ad8366: make ad8366_info const
David Lechner [Sat, 28 Jun 2025 17:01:29 +0000 (12:01 -0500)] 
iio: amplifiers: ad8366: make ad8366_info const

Add const qualifier to struct ad8366_info ad8366_infos[]. This
is read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-12-v1-1-88029e48a26b@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: adc: stm32-adc: make stm32_adc_trig_info const
David Lechner [Sat, 28 Jun 2025 16:39:33 +0000 (11:39 -0500)] 
iio: adc: stm32-adc: make stm32_adc_trig_info const

Add const qualifier to struct stm32_adc_trig_info. This is read-only
data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-10-v1-1-0ba93ac792c8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: adc: qcom-vadc: make scale_adc5_fn const
David Lechner [Sat, 28 Jun 2025 16:36:01 +0000 (11:36 -0500)] 
iio: adc: qcom-vadc: make scale_adc5_fn const

Add const qualifier to struct qcom_adc5_scale_type scale_adc5_fn[]. This
is read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-9-v1-1-188ca6e904ee@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: adc: mp2629_adc: make mp2629_channels const
David Lechner [Sat, 28 Jun 2025 16:31:02 +0000 (11:31 -0500)] 
iio: adc: mp2629_adc: make mp2629_channels const

Add const qualifier to struct iio_chan_spec mp2629_channels[]. This
is read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-8-v1-1-32ce79494d4a@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: adc: axp20x_adc: make axp717_maps const
David Lechner [Sat, 28 Jun 2025 16:23:58 +0000 (11:23 -0500)] 
iio: adc: axp20x_adc: make axp717_maps const

Add const qualifier to struct iio_map axp717_maps[]. This is read-only
data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-7-v1-1-10008d0a4c2f@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: adc: at91_adc: make at91_adc_caps const
David Lechner [Sat, 28 Jun 2025 16:19:36 +0000 (11:19 -0500)] 
iio: adc: at91_adc: make at91_adc_caps const

Add const qualifier to struct at91_adc_caps at91sam*_caps. This is
read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-6-v1-1-fbb1ca5edc8d@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: adc: ad7091r8: make ad7091r_init_info const
David Lechner [Sat, 28 Jun 2025 16:09:25 +0000 (11:09 -0500)] 
iio: adc: ad7091r8: make ad7091r_init_info const

Add const qualifier to struct ad7091r_init_info ad7091r*_init_info. This
is read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Acked-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250628-iio-const-data-4-v1-1-4e0f93c9cf83@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: adc: ad7091r5: make ad7091r5_init_info const
David Lechner [Sat, 28 Jun 2025 16:06:48 +0000 (11:06 -0500)] 
iio: adc: ad7091r5: make ad7091r5_init_info const

Add const qualifier to struct ad7091r_init_info ad7091r5_init_info. This
is read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Acked-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250628-iio-const-data-3-v1-1-13d3f0af5f3f@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: accel: mma9553: make mma9553_event_info const
David Lechner [Sat, 28 Jun 2025 16:00:07 +0000 (11:00 -0500)] 
iio: accel: mma9553: make mma9553_event_info const

Add const qualifier to struct mma9553_event_info mma9553_event_info[].
This is read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-2-v1-1-a61da3a0941e@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: accel: adxl345: make adxl345_events const
David Lechner [Sat, 28 Jun 2025 15:56:20 +0000 (10:56 -0500)] 
iio: accel: adxl345: make adxl345_events const

Add const qualifier to struct iio_event_spec adxl345_events[]. This
is read-only data so it can be made const.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250628-iio-const-data-1-v1-1-a32d96d01c2f@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agodt-bindings: iio: adc: nxp,lpc3220-adc: allow clocks property
Frank Li [Tue, 24 Jun 2025 20:13:02 +0000 (16:13 -0400)] 
dt-bindings: iio: adc: nxp,lpc3220-adc: allow clocks property

Allow clocks property to fix below CHECK_DTB warning:
  arch/arm/boot/dts/nxp/lpc/lpc3250-ea3250.dtb: adc@40048000 (nxp,lpc3220-adc): 'clocks' does not match any of the regexes: 'pinctrl-[0-9]+'

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20250624201302.2515391-1-Frank.Li@nxp.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: adc: ad7380: remove unused oversampling_ratio getter
David Lechner [Tue, 24 Jun 2025 22:44:51 +0000 (22:44 +0000)] 
iio: adc: ad7380: remove unused oversampling_ratio getter

Remove a call to ad7380_get_osr() in ad7380_init_offload_msg. The
returned value is never used.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250624-iio-adc-ad7380-remove-unused-oversampling_ratio-getter-v1-1-26cbee356860@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: adc: ad4851: add spi 3-wire support
Antoniu Miclaus [Thu, 26 Jun 2025 10:40:24 +0000 (13:40 +0300)] 
iio: adc: ad4851: add spi 3-wire support

Add support for 3-wire configuration within the driver.
By default 4-wire configuration is used.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250626104024.8645-2-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agodt-bindings: iio: adc: ad4851: add spi-3wire
Antoniu Miclaus [Thu, 26 Jun 2025 10:40:23 +0000 (13:40 +0300)] 
dt-bindings: iio: adc: ad4851: add spi-3wire

Add devicetree support for spi 3-wire configuration.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20250626104024.8645-1-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: adc: ad7173: simplify clock enable/disable
David Lechner [Fri, 20 Jun 2025 14:30:46 +0000 (09:30 -0500)] 
iio: adc: ad7173: simplify clock enable/disable

Use devm_clk_get_enabled() instead of devm_clk_get(),
clk_prepare_enable(), devm_add_action_or_reset() to simplify the
code as it effectively does the same thing.

We can also drop ext_clk from struct ad7173_state since it is not used
anywhere else.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250620-iio-adc-ad7173-simplify-clock-enable-disable-v1-1-8bc693b190ec@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: imu: bmi270: add step counter watermark event
Gustavo Silva [Mon, 16 Jun 2025 23:53:10 +0000 (20:53 -0300)] 
iio: imu: bmi270: add step counter watermark event

Add support for generating events when the step counter reaches the
configurable watermark.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Gustavo Silva <gustavograzs@gmail.com>
Link: https://patch.msgid.link/20250616-bmi270-events-v3-2-16e37588604f@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 weeks agoiio: imu: bmi270: add channel for step counter
Gustavo Silva [Mon, 16 Jun 2025 23:53:09 +0000 (20:53 -0300)] 
iio: imu: bmi270: add channel for step counter

Add a channel for enabling/disabling the step counter, reading the
number of steps and resetting the counter.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Gustavo Silva <gustavograzs@gmail.com>
Link: https://patch.msgid.link/20250616-bmi270-events-v3-1-16e37588604f@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: imu: inv_icm42600: Convert to uXX and sXX integer types
Andy Shevchenko [Mon, 16 Jun 2025 09:03:21 +0000 (12:03 +0300)] 
iio: imu: inv_icm42600: Convert to uXX and sXX integer types

The driver code is full of intXX_t and uintXX_t types which is
not the pattern we use in the IIO subsystem. Switch the driver
to use kernel internal types for that. No functional changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20250616090423.575736-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: temperature: tmp006: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:20 +0000 (17:39 -0500)] 
iio: temperature: tmp006: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-28-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: proximity: irsd200: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:19 +0000 (17:39 -0500)] 
iio: proximity: irsd200: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-27-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: pressure: zpa2326: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:18 +0000 (17:39 -0500)] 
iio: pressure: zpa2326: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-26-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: pressure: mprls0025pa: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:17 +0000 (17:39 -0500)] 
iio: pressure: mprls0025pa: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

The initialize of the cmd value is trivial so it can be moved to the
array initializer as well.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-25-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: pressure: mpl3115: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:16 +0000 (17:39 -0500)] 
iio: pressure: mpl3115: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-24-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: pressure: bmp280: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:15 +0000 (17:39 -0500)] 
iio: pressure: bmp280: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-23-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: magnetometer: af8133j: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:14 +0000 (17:39 -0500)] 
iio: magnetometer: af8133j: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-22-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: light: veml6030: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:13 +0000 (17:39 -0500)] 
iio: light: veml6030: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Tested-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-21-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: light: opt4060: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:12 +0000 (17:39 -0500)] 
iio: light: opt4060: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-20-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: light: ltr501: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:11 +0000 (17:39 -0500)] 
iio: light: ltr501: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-19-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: light: bh1745: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:10 +0000 (17:39 -0500)] 
iio: light: bh1745: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-18-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: imu: inv_mpu6050: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:09 +0000 (17:39 -0500)] 
iio: imu: inv_mpu6050: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-17-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: imu: inv_icm42600: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:08 +0000 (17:39 -0500)] 
iio: imu: inv_icm42600: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-16-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: dac: ad3552r: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:07 +0000 (17:39 -0500)] 
iio: dac: ad3552r: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-15-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: chemical: sunrise_co2: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:06 +0000 (17:39 -0500)] 
iio: chemical: sunrise_co2: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-14-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: chemical: scd30: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:05 +0000 (17:39 -0500)] 
iio: chemical: scd30: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-13-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: chemical: scd4x: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:04 +0000 (17:39 -0500)] 
iio: chemical: scd4x: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-12-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: ti-tsc2046: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:03 +0000 (17:39 -0500)] 
iio: adc: ti-tsc2046: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-11-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: ti-lmp92064: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:02 +0000 (17:39 -0500)] 
iio: adc: ti-lmp92064: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-10-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: ti-ads1119: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:01 +0000 (17:39 -0500)] 
iio: adc: ti-ads1119: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-9-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: ti-ads1015: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:39:00 +0000 (17:39 -0500)] 
iio: adc: ti-ads1015: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-8-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: stm32-adc: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:38:59 +0000 (17:38 -0500)] 
iio: adc: stm32-adc: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-7-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: rtq6056: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:38:58 +0000 (17:38 -0500)] 
iio: adc: rtq6056: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-6-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: rockchip_saradc: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:38:57 +0000 (17:38 -0500)] 
iio: adc: rockchip_saradc: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-5-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: mt6360-adc: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:38:56 +0000 (17:38 -0500)] 
iio: adc: mt6360-adc: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-4-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: dln2-adc: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:38:55 +0000 (17:38 -0500)] 
iio: adc: dln2-adc: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-3-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: accel: msa311: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:38:54 +0000 (17:38 -0500)] 
iio: accel: msa311: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-2-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: accel: adxl372: use = { } instead of memset()
David Lechner [Wed, 11 Jun 2025 22:38:53 +0000 (17:38 -0500)] 
iio: accel: adxl372: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-1-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: accel: adxl345: replace magic numbers by unit expressions
Lothar Rubusch [Tue, 10 Jun 2025 21:59:28 +0000 (21:59 +0000)] 
iio: accel: adxl345: replace magic numbers by unit expressions

Replace absolute numbers by their expressions from units.h to avoid
using magic numbers. Use uniform expressions to clarify their usage.

This is a refactoring change and should not impact functionality.

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
Link: https://patch.msgid.link/20250610215933.84795-7-l.rubusch@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: accel: adxl345: simplify measure enable
Lothar Rubusch [Tue, 10 Jun 2025 21:59:25 +0000 (21:59 +0000)] 
iio: accel: adxl345: simplify measure enable

Simplify the function to enable or disable measurement. Replace the
separate decision logic and call to regmap_update_bits() by a single
call to regmap_assign_bits() taking a boolean argument directly.

This is a refactoring change and should not impact functionality.

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
Link: https://patch.msgid.link/20250610215933.84795-4-l.rubusch@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: accel: adxl345: make data struct variable irq function local
Lothar Rubusch [Tue, 10 Jun 2025 21:59:24 +0000 (21:59 +0000)] 
iio: accel: adxl345: make data struct variable irq function local

Remove variable irq from the struct state and make it a function local
variable, because it is not necessary to be kept struct-wise.

This is a refactoring change and should not impact functionality.

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
Link: https://patch.msgid.link/20250610215933.84795-3-l.rubusch@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: amplifiers: ada4250: use dev_err_probe()
David Lechner [Wed, 11 Jun 2025 21:33:05 +0000 (16:33 -0500)] 
iio: amplifiers: ada4250: use dev_err_probe()

Use dev_err_probe() when returning an error in the probe function.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-amplifiers-ada4250-simplify-data-buffer-in-init-v3-5-bf85ddea79f2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: amplifiers: ada4250: move offset_uv in struct
David Lechner [Wed, 11 Jun 2025 21:33:04 +0000 (16:33 -0500)] 
iio: amplifiers: ada4250: move offset_uv in struct

Move offset_uv in struct ada4250_state. This keeps things logically
grouped and reduces holes in the struct.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-amplifiers-ada4250-simplify-data-buffer-in-init-v3-4-bf85ddea79f2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: amplifiers: ada4250: use devm_regulator_get_enable_read_voltage()
David Lechner [Wed, 11 Jun 2025 21:33:03 +0000 (16:33 -0500)] 
iio: amplifiers: ada4250: use devm_regulator_get_enable_read_voltage()

Use devm_regulator_get_enable_read_voltage() to simplify the code.

Replace 1000000 with MICRO while we are touching this for better
readability.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-amplifiers-ada4250-simplify-data-buffer-in-init-v3-3-bf85ddea79f2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: amplifiers: ada4250: don't fail on bad chip ID
David Lechner [Wed, 11 Jun 2025 21:33:02 +0000 (16:33 -0500)] 
iio: amplifiers: ada4250: don't fail on bad chip ID

Only print an information message instead of error message and failing
to probe the device if the chip ID is not recognized. Experience shows
that this can be fragile and some devices may not return the expected
chip ID even though the driver is still able to work with them.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Closes: https://lore.kernel.org/linux-iio/20250421122409.79f5580c@jic23-huawei/
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-amplifiers-ada4250-simplify-data-buffer-in-init-v3-2-bf85ddea79f2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: amplifiers: ada4250: used dev local variable
David Lechner [Wed, 11 Jun 2025 21:33:01 +0000 (16:33 -0500)] 
iio: amplifiers: ada4250: used dev local variable

Replace local spi variable with dev in ada4250_init() since spi is not
used directly.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611-iio-amplifiers-ada4250-simplify-data-buffer-in-init-v3-1-bf85ddea79f2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: accel: sca3000: replace error_ret labels by simple returns
Andrew Ijano [Wed, 11 Jun 2025 19:39:19 +0000 (16:39 -0300)] 
iio: accel: sca3000: replace error_ret labels by simple returns

Replace usage of error_ret labels by returning directly when handling
errors. Cases that do a mutex unlock were not changed.

Signed-off-by: Andrew Ijano <andrew.lopes@alumni.usp.br>
Co-developed-by: Gustavo Bastos <gustavobastos@usp.br>
Signed-off-by: Gustavo Bastos <gustavobastos@usp.br>
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250611194648.18133-2-andrew.lopes@alumni.usp.br
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: light: apds9306: Refactor threshold get/set functions to use helper
Nattan Ferreira [Wed, 11 Jun 2025 17:42:53 +0000 (14:42 -0300)] 
iio: light: apds9306: Refactor threshold get/set functions to use helper

Refactor the apds9306_event_thresh_get() and apds9306_event_thresh_set()
functions to use a helper function (apds9306_get_thresh_reg()) for
obtaining the correct register based on the direction of the event. This
improves code readability and maintains consistency in accessing
threshold registers.

Signed-off-by: Nattan Ferreira <nattanferreira58@gmail.com>
Co-developed-by: Lucas Antonio <lucasantonio.santos@usp.br>
Signed-off-by: Lucas Antonio <lucasantonio.santos@usp.br>
Acked-by: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>
Link: https://patch.msgid.link/20250611174253.16578-1-nattanferreira58@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: ad7768-1: add filter type and oversampling ratio attributes
Jonathan Santos [Wed, 11 Jun 2025 11:51:50 +0000 (08:51 -0300)] 
iio: adc: ad7768-1: add filter type and oversampling ratio attributes

Separate filter type and decimation rate from the sampling frequency
attribute. The new filter type attribute enables sinc3, sinc3+rej60
and wideband filters, which were previously unavailable.

Previously, combining decimation and MCLK divider in the sampling
frequency obscured performance trade-offs. Lower MCLK divider
settings increase power usage, while lower decimation rates reduce
precision by decreasing averaging. By creating an oversampling
attribute, which controls the decimation, users gain finer control
over performance.

The addition of those attributes allows a wider range of sampling
frequencies and more access to the device features. Sampling frequency
table is updated after every digital filter parameter change.

Changes in the sampling frequency are not allowed anymore while in
buffered mode.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Co-developed-by: Pop Paul <paul.pop@analog.com>
Signed-off-by: Pop Paul <paul.pop@analog.com>
Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/cd3b60c44847d5c35cecc4385bbda6533be6825e.1749569957.git.Jonathan.Santos@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: ad7768-1: replace manual attribute declaration
Jonathan Santos [Wed, 11 Jun 2025 11:51:38 +0000 (08:51 -0300)] 
iio: adc: ad7768-1: replace manual attribute declaration

Use read_avail callback from struct iio_info to replace the manual
declaration of sampling_frequency_available attribute.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/b2653d270131b2c873373a6f81cde9a5bdf5d1ff.1749569957.git.Jonathan.Santos@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: ad7768-1: add support for Synchronization over SPI
Jonathan Santos [Wed, 11 Jun 2025 11:51:23 +0000 (08:51 -0300)] 
iio: adc: ad7768-1: add support for Synchronization over SPI

The synchronization method using GPIO requires the generated pulse to be
truly synchronous with the base MCLK signal. When it is not possible to
do that in hardware, the datasheet recommends using synchronization over
SPI, where the generated pulse is already synchronous with MCLK. This
requires the SYNC_OUT pin to be connected to the SYNC_IN pin.

Use trigger-sources property to enable device synchronization over SPI
and multi-device synchronization while replacing sync-in-gpios property.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/05aea6d1551fce94f290d68f1dba548513e1632f.1749569957.git.Jonathan.Santos@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: ad7768-1: add multiple scan types to support 16-bits mode
Jonathan Santos [Wed, 11 Jun 2025 11:51:11 +0000 (08:51 -0300)] 
iio: adc: ad7768-1: add multiple scan types to support 16-bits mode

When the device is configured to decimation x8, only possible in the
sinc5 filter, output data is reduced to 16 bits in order to support
1 MHz of sampling frequency due to clock limitation.

Use multiple scan types feature to enable the driver to switch
scan type at runtime, making it possible to support both 24-bit and
16-bit resolution.

Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/08780fd4a59885f1f250759ce655420bd1dbb383.1749569957.git.Jonathan.Santos@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: ad7768-1: Add GPIO controller support
Sergiu Cuciurean [Wed, 11 Jun 2025 11:50:56 +0000 (08:50 -0300)] 
iio: adc: ad7768-1: Add GPIO controller support

The AD7768-1 has the ability to control other local hardware (such as gain
stages),to power down other blocks in the signal chain, or read local
status signals over the SPI interface.

Add direct mode conditional locks in the GPIO callbacks to prevent register
access when the device is in buffered mode.

This change exports the AD7768-1's four GPIOs and makes them accessible
at an upper layer.

Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
Co-developed-by: Jonathan Santos <Jonathan.Santos@analog.com>
Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
Link: https://patch.msgid.link/8abca580f43cb31d7088d07a7414b5f7efe91ead.1749569957.git.Jonathan.Santos@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 weeks agoiio: adc: ad7768-1: add regulator to control VCM output
Jonathan Santos [Wed, 11 Jun 2025 11:50:44 +0000 (08:50 -0300)] 
iio: adc: ad7768-1: add regulator to control VCM output

The VCM output voltage can be used as a common-mode voltage within the
amplifier preconditioning circuits external to the AD7768-1.

This change allows the user to configure VCM output using the regulator
framework.

Acked-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
Link: https://patch.msgid.link/1f02312fdc4131168b194d59f4b1688dc68ea36e.1749569957.git.Jonathan.Santos@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>