linux-block.git
7 months agoiio: adc: ti-ads1298: Add driver
Mike Looijmans [Fri, 16 Feb 2024 15:30:20 +0000 (16:30 +0100)]
iio: adc: ti-ads1298: Add driver

Skeleton driver for the TI ADS1298 medical ADC. This device is
typically used for ECG and similar measurements. Supports data
acquisition at configurable scale and sampling frequency.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Link: https://lore.kernel.org/r/20240216153020.485201-2-mike.looijmans@topic.nl
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: adc: ti-ads1298: Add bindings
Mike Looijmans [Fri, 16 Feb 2024 15:30:19 +0000 (16:30 +0100)]
dt-bindings: iio: adc: ti-ads1298: Add bindings

Bindings for the TI ADS1298 medical ADC. This device is
typically used for ECG and similar measurements. Supports data
acquisition at configurable scale and sampling frequency.

The device has so many options for connecting stuff, at this
point the bindings aren't nearly complete but partial bindings
are better than no bindings at all.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240216153020.485201-1-mike.looijmans@topic.nl
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: pressure: hsc030pa add triggered buffer
Petre Rodan [Sun, 11 Feb 2024 07:56:37 +0000 (09:56 +0200)]
iio: pressure: hsc030pa add triggered buffer

Add triggered buffer feature.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20240211075645.28777-7-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: pressure: hsc030pa add mandatory delay
Petre Rodan [Sun, 11 Feb 2024 07:56:36 +0000 (09:56 +0200)]
iio: pressure: hsc030pa add mandatory delay

Add a mandatory 2ms delay between consecutive chip reads.

A Technical Note pdf specifies that the measurement cycle in these
chips takes around 1.26ms. By adding this 2ms delay we make sure that
we never get stale measurements.

For more details, please see "Figure 1" in the pdf below:

https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/common/documents/sps-siot-sleep-mode-technical-note-008286-1-en-ciid-155793.pdf

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20240211075645.28777-6-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: pressure: hsc030pa: update datasheet URLs
Petre Rodan [Sun, 11 Feb 2024 07:56:35 +0000 (09:56 +0200)]
iio: pressure: hsc030pa: update datasheet URLs

Provide bus-specific technical datasheet in the _i2c.c _spi.c headers
instead of the generic one.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20240211075645.28777-5-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: pressure: hsc030pa: include cleanup
Petre Rodan [Sun, 11 Feb 2024 07:56:34 +0000 (09:56 +0200)]
iio: pressure: hsc030pa: include cleanup

Add includes based on prior reviews from Andy.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20240211075645.28777-4-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: pressure: hsc030pa: use signed type to hold div_64() result
Petre Rodan [Sun, 11 Feb 2024 07:56:33 +0000 (09:56 +0200)]
iio: pressure: hsc030pa: use signed type to hold div_64() result

Use signed type to variable holding the result given by div_s64().

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20240211075645.28777-3-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: pressure: honeywell,hsc030pa.yaml add spi props
Petre Rodan [Sun, 11 Feb 2024 07:56:32 +0000 (09:56 +0200)]
dt-bindings: iio: pressure: honeywell,hsc030pa.yaml add spi props

Add spi-peripheral-props.yaml requirement needed by the
spi-max-frequency property.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20240211075645.28777-2-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: st_sensors: lsm9ds0: Use common style for terminator in ID tables
andy.shevchenko@gmail.com [Sun, 11 Feb 2024 20:14:34 +0000 (22:14 +0200)]
iio: st_sensors: lsm9ds0: Use common style for terminator in ID tables

Use common style for a terminator entry in the ID tables.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240211201526.1518165-4-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: st_sensors: lsm9ds0: Don't use "proxy" headers
andy.shevchenko@gmail.com [Sun, 11 Feb 2024 20:14:33 +0000 (22:14 +0200)]
iio: st_sensors: lsm9ds0: Don't use "proxy" headers

Update header inclusions to follow IWYU (Include What You Use)
principle.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240211201526.1518165-3-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: st_sensors: lsm9ds0: Use dev_err_probe() everywhere
andy.shevchenko@gmail.com [Sun, 11 Feb 2024 20:14:32 +0000 (22:14 +0200)]
iio: st_sensors: lsm9ds0: Use dev_err_probe() everywhere

Use dev_err_probe() everywhere where it is appropriate.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240211201526.1518165-2-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: adc: adi-axi-adc: move to backend framework
Nuno Sa [Sat, 10 Feb 2024 20:57:19 +0000 (21:57 +0100)]
iio: adc: adi-axi-adc: move to backend framework

Move to the IIO backend framework. Devices supported by adi-axi-adc now
register themselves as backend devices.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240210-iio-backend-v11-7-f5242a5fb42a@analog.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: adc: ad9467: convert to backend framework
Nuno Sa [Sat, 10 Feb 2024 20:57:18 +0000 (21:57 +0100)]
iio: adc: ad9467: convert to backend framework

Convert the driver to use the new IIO backend framework. The device
functionality is expected to be the same (meaning no added or removed
features).

Also note this patch effectively breaks ABI and that's needed so we can
properly support this device and add needed features making use of the
new IIO framework.

Given the lack of features (and devices supported) in the ad9467 driver
compared with the ADI out of tree version, we don't expect any user of
the upstream driver so no one should notice the ABI breakage. However,
if someone is affected by this, ADI will happily support transitioning
to the backend framework.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240210-iio-backend-v11-6-f5242a5fb42a@analog.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: add the IIO backend framework
Nuno Sa [Sat, 10 Feb 2024 20:57:17 +0000 (21:57 +0100)]
iio: add the IIO backend framework

This is a Framework to handle complex IIO aggregate devices.

The typical architecture is to have one device as the frontend device which
can be "linked" against one or multiple backend devices. All the IIO and
userspace interface is expected to be registers/managed by the frontend
device which will callback into the backends when needed (to get/set
some configuration that it does not directly control).

The basic framework interface is pretty simple:
 - Backends should register themselves with @devm_iio_backend_register()
 - Frontend devices should get backends with @devm_iio_backend_get()

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240210-iio-backend-v11-5-f5242a5fb42a@analog.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: buffer-dmaengine: export buffer alloc and free functions
Nuno Sa [Sat, 10 Feb 2024 20:57:16 +0000 (21:57 +0100)]
iio: buffer-dmaengine: export buffer alloc and free functions

Export iio_dmaengine_buffer_free() and iio_dmaengine_buffer_alloc().
This is in preparation of introducing IIO backends support. This will
allow us to allocate a buffer and control it's lifetime from a device
different from the one holding the DMA firmware properties. Effectively,
in this case the struct device holding the firmware information about
the DMA channels is not the same as iio_dev->dev.parent (typical case).

While at it, namespace the buffer-dmaengine exports and update the
current user of these buffers.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240210-iio-backend-v11-4-f5242a5fb42a@analog.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoof: property: add device link support for io-backends
Olivier Moysan [Sat, 10 Feb 2024 20:57:15 +0000 (21:57 +0100)]
of: property: add device link support for io-backends

Add support for creating device links out of more DT properties.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240210-iio-backend-v11-3-f5242a5fb42a@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: adc: axi-adc: update bindings for backend framework
Nuno Sa [Sat, 10 Feb 2024 20:57:14 +0000 (21:57 +0100)]
dt-bindings: adc: axi-adc: update bindings for backend framework

'adi,adc-dev' is now deprecated and must not be used anymore. Hence,
also remove it from being required.

The reason why it's being deprecated is because the axi-adc CORE is now
an IIO service provider hardware (IIO backends) for consumers to make use
of. Before, the logic with 'adi,adc-dev' was the opposite (it was kind
of consumer referencing other nodes/devices) and that proved to be wrong
and to not scale.

Now, IIO consumers of this hardware are expected to reference it using the
io-backends property. Hence, the new '#io-backend-cells' is being added
so the device is easily identified as a provider.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240210-iio-backend-v11-2-f5242a5fb42a@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: adc: ad9467: add new io-backend property
Nuno Sa [Sat, 10 Feb 2024 20:57:13 +0000 (21:57 +0100)]
dt-bindings: adc: ad9467: add new io-backend property

The ad9467 will make use of the new IIO backend framework which is a
provider - consumer interface where IIO backends provide services to
consumers. As such, and being this device a consumer,  add the new
generic io-backend property to the bindings.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240210-iio-backend-v11-1-f5242a5fb42a@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: gts-helper: Fix division loop
Matti Vaittinen [Mon, 12 Feb 2024 11:20:09 +0000 (13:20 +0200)]
iio: gts-helper: Fix division loop

The loop based 64bit division may run for a long time when dividend is a
lot bigger than the divider. Replace the division loop by the
div64_u64() which implementation may be significantly faster.

Tested-by: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Fixes: 38416c28e168 ("iio: light: Add gain-time-scale helpers")
Link: https://lore.kernel.org/r/Zcn-6e-0-nh2WcfU@drtxq0yyyyyyyyyyyyyby-3.rev.dnainternet.fi
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: humidity: hdc3020: add threshold events support
Dimitri Fedrau [Wed, 14 Feb 2024 08:53:45 +0000 (09:53 +0100)]
iio: humidity: hdc3020: add threshold events support

Add threshold events support for temperature and relative humidity. To
enable them the higher and lower threshold registers must be programmed
and the higher threshold must be greater then or equal to the lower
threshold. Otherwise the event is disabled. Invalid hysteresis values
are ignored by the device. There is no further configuration possible.

Tested by setting thresholds/hysteresis and turning the heater on/off.
Used iio_event_monitor in tools/iio to catch events while constantly
displaying temperature and humidity values.

Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Tested-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240214085350.19382-4-dima.fedrau@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: humidity: hdc3020: add interrupt bindings in example
Dimitri Fedrau [Wed, 14 Feb 2024 08:53:44 +0000 (09:53 +0100)]
dt-bindings: iio: humidity: hdc3020: add interrupt bindings in example

Add interrupt bindings in example.

Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20240214085350.19382-3-dima.fedrau@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: humidity: hdc3020: switch to 16bit register defines
Dimitri Fedrau [Wed, 14 Feb 2024 08:53:43 +0000 (09:53 +0100)]
iio: humidity: hdc3020: switch to 16bit register defines

Switch to 16bit register defines and drop the const u8 register pairs.
By doing so we change the parameter of functions for reading and writing
to the device. Additionally create helper functions that are aware of the
new register format and apply them wherever possible.

Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Link: https://lore.kernel.org/r/20240214085350.19382-2-dima.fedrau@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: afe: voltage-divider: Add io-channel-cells
Naresh Solanki [Tue, 6 Feb 2024 10:55:01 +0000 (16:25 +0530)]
dt-bindings: iio: afe: voltage-divider: Add io-channel-cells

Enable the voltage divider to both receive and provide measurement
services by adding #io-channel-cells.

This is especially valuable in scenarios where an ADC has an analog
frontend, like a voltage divider, and obtaining its raw value isn't
interesting. It is desired to get the real voltage before the voltage
divider.

Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240206105502.648255-1-naresh.solanki@9elements.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: hid-sensor-als: Add light chromaticity support
Basavaraj Natikar [Mon, 5 Feb 2024 18:59:26 +0000 (10:59 -0800)]
iio: hid-sensor-als: Add light chromaticity support

On some platforms, ambient color sensors also support the x and y light
colors, which represent the coordinates on the CIE 1931 chromaticity
diagram. Add light chromaticity x and y.

Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20240205185926.3030521-5-srinivas.pandruvada@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: hid-sensor-als: Add light color temperature support
Basavaraj Natikar [Mon, 5 Feb 2024 18:59:25 +0000 (10:59 -0800)]
iio: hid-sensor-als: Add light color temperature support

On some platforms, ambient color sensors also support light color
temperature. Add support of light color temperature.

Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20240205185926.3030521-4-srinivas.pandruvada@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: hid-sensor-als: Remove hardcoding of values for enums
Srinivas Pandruvada [Mon, 5 Feb 2024 18:59:24 +0000 (10:59 -0800)]
iio: hid-sensor-als: Remove hardcoding of values for enums

Remove hardcoding of values for enum CHANNEL_SCAN_INDEX_INTENSITY and
CHANNEL_SCAN_INDEX_ILLUM.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20240205185926.3030521-3-srinivas.pandruvada@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: hid-sensor-als: Assign channels dynamically
Srinivas Pandruvada [Mon, 5 Feb 2024 18:59:23 +0000 (10:59 -0800)]
iio: hid-sensor-als: Assign channels dynamically

Instead of assuming that every channel defined statically by
als_channels[] is present, assign dynamically based on presence of the
respective usage id in the descriptor. This will allow to register ALS
with limited channel support. Append the timestamp as the last channel.

Update available_scan_mask to specify all channels which are present.

There is no intentional function changes done.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20240205185926.3030521-2-srinivas.pandruvada@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoAdd 10EC5280 to bmi160_i2c ACPI IDs to allow binding on some devices
Jesus Gonzalez [Wed, 7 Feb 2024 19:55:50 +0000 (20:55 +0100)]
Add 10EC5280 to bmi160_i2c ACPI IDs to allow binding on some devices

"10EC5280" is used by several manufacturers like Lenovo, GPD, or AYA (and
probably others) in their ACPI table as the ID for the bmi160 IMU. This
means the bmi160_i2c driver won't bind to it, and the IMU is unavailable
to the user. Manufacturers have been approached on several occasions to
try getting a BIOS with a fixed ID, mostly without actual positive
results, and since affected devices are already a few years old, this is
not expected to change. This patch enables using the bmi160_i2c driver for
the bmi160 IMU on these devices.

Here is the relevant extract from the DSDT of a GPD Win Max 2 (AMD 6800U
model) with the latest firmware 1.05 installed. GPD sees this as WONTFIX
with the argument of the device working with the Windows drivers.

Device (BMA2)
{
    Name (_ADR, Zero)  // _ADR: Address
    Name (_HID, "10EC5280")  // _HID: Hardware ID
    Name (_CID, "10EC5280")  // _CID: Compatible ID
    Name (_DDN, "Accelerometer")  // _DDN: DOS Device Name
    Name (_UID, One)  // _UID: Unique ID
    Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
    {
Name (RBUF, ResourceTemplate ()
{
    I2cSerialBusV2 (0x0069, ControllerInitiated, 0x00061A80,
        AddressingMode7Bit, "\\_SB.I2CC",
        0x00, ResourceConsumer, , Exclusive,
        )
})
Return (RBUF) /* \_SB_.I2CC.BMA2._CRS.RBUF */
    }

    ...

}

Signed-off-by: Jesus Gonzalez <jesusmgh@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240207195549.37994-2-jesusmgh@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: core: make iio_bus_type const
Ricardo B. Marliere [Thu, 8 Feb 2024 19:37:19 +0000 (16:37 -0300)]
iio: core: make iio_bus_type const

Now that the driver core can properly handle constant struct bus_type,
move the iio_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Acked-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240208-bus_cleanup-iio-v1-1-4a167c3b5fb3@marliere.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: imu: st_lsm6dsx: add asm330lhhxg1
Lorenzo Bianconi [Sat, 3 Feb 2024 12:01:38 +0000 (13:01 +0100)]
dt-bindings: iio: imu: st_lsm6dsx: add asm330lhhxg1

Add device bindings for asm330lhhxg1 IMU sensor.
The lsm6dsr supports the features and functionality provided by
the asm330lhhxg1 via identical interfaces and so is a suitable
fallback compatible.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/942452ec9626bc1166501cec0fa88c369e28ec6f.1706961432.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: imu: st_lsm6dsx: add support to ASM330LHHXG1
Lorenzo Bianconi [Sat, 3 Feb 2024 12:01:37 +0000 (13:01 +0100)]
iio: imu: st_lsm6dsx: add support to ASM330LHHXG1

Add support to STM ASM330LHHXG1 (accelerometer and gyroscope) Mems
sensor.
The ASM330LHHXG1 sensor can use LSM6DSR as fallback device since LSM6DSR
implements all the ASM330LHHXG1 features currently implemented in
st_lsm6dsx.

Link: https://www.st.com/resource/en/datasheet/asm330lhhxg1.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/e3dbe4720cdf407d0152e93b1331306a8c7f5df3.1706961432.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: imu: st_lsm6dsx: improve kernel docs and comments
Lorenzo Bianconi [Sat, 3 Feb 2024 12:01:36 +0000 (13:01 +0100)]
iio: imu: st_lsm6dsx: improve kernel docs and comments

Improve kernel docs and comments reporting supported sensors in a list in
order to make more easy to add new devices in the future.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/d365d048253d2ff9ee0092d391bbaa9cf0737cff.1706961432.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: adc: ad7091r-base: Use auto cleanup of locks.
Jonathan Cameron [Sun, 28 Jan 2024 15:05:37 +0000 (15:05 +0000)]
iio: adc: ad7091r-base: Use auto cleanup of locks.

Done to reduce boilerplate and simplify code flow by allowing early
returns with the lock automatically released.

Reviewed-by: Nuno Sa <nuno.a@analog.com>
Link: https://lore.kernel.org/r/20240128150537.44592-11-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: adc: ad4130: Use automatic cleanup of locks and direct mode.
Jonathan Cameron [Sun, 28 Jan 2024 15:05:36 +0000 (15:05 +0000)]
iio: adc: ad4130: Use automatic cleanup of locks and direct mode.

Reduces boilerplate and allows for simpler to follow direct returns.

Reviewed-by: Nuno Sa <nuno.a@analog.com>
Link: https://lore.kernel.org/r/20240128150537.44592-10-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: proximity: sx9310: Use automated cleanup for locks and IIO mode claiming.
Jonathan Cameron [Sun, 28 Jan 2024 15:05:35 +0000 (15:05 +0000)]
iio: proximity: sx9310: Use automated cleanup for locks and IIO mode claiming.

This simplifies error handling paths and generallly removes a bunch
of boilerplate.

Reviewed-by: Nuno Sa <nuno.a@analog.com>
Link: https://lore.kernel.org/r/20240128150537.44592-9-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: proximity: sx9324: Use automated cleanup for locks and IIO mode claiming.
Jonathan Cameron [Sun, 28 Jan 2024 15:05:34 +0000 (15:05 +0000)]
iio: proximity: sx9324: Use automated cleanup for locks and IIO mode claiming.

This simplifies error handling paths and generallly removes a bunch
of boilerplate.

Reviewed-by: Nuno Sa <nuno.a@analog.com>
Link: https://lore.kernel.org/r/20240128150537.44592-8-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: proximity: sx9360: Use automated cleanup for locks and IIO mode claiming.
Jonathan Cameron [Sun, 28 Jan 2024 15:05:33 +0000 (15:05 +0000)]
iio: proximity: sx9360: Use automated cleanup for locks and IIO mode claiming.

This simplifies error handling paths and generallly removes a bunch
of boilerplate.

Reviewed-by: Nuno Sa <nuno.a@analog.com>
Link: https://lore.kernel.org/r/20240128150537.44592-7-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: adc: max1363: Use automatic cleanup for locks and iio mode claiming.
Jonathan Cameron [Sun, 28 Jan 2024 15:05:32 +0000 (15:05 +0000)]
iio: adc: max1363: Use automatic cleanup for locks and iio mode claiming.

This simplifies error return paths.

Reviewed-by: Nuno Sa <nuno.a@analog.com>
Link: https://lore.kernel.org/r/20240128150537.44592-6-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: imu: bmi323: Use cleanup handling for iio_device_claim_direct_mode()
Jonathan Cameron [Sun, 28 Jan 2024 15:05:31 +0000 (15:05 +0000)]
iio: imu: bmi323: Use cleanup handling for iio_device_claim_direct_mode()

Similar to existing use of guard() in this driver,
iio_device_claim_direct_scoped() will ensure that scope based cleanup
occurs.

Reviewed-by: Nuno Sa <nuno.a@analog.com>
Link: https://lore.kernel.org/r/20240128150537.44592-5-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: adxl367: Use automated cleanup for locks and iio direct mode.
Jonathan Cameron [Sun, 28 Jan 2024 15:05:30 +0000 (15:05 +0000)]
iio: accel: adxl367: Use automated cleanup for locks and iio direct mode.

Switching to the iio_device_claim_direct_scoped() for state
and to guard() based unlocking of mutexes simplifies error handling
by allowing direct returns when an error is encountered.

Reviewed-by: Nuno Sa <nuno.a@analog.com>
Link: https://lore.kernel.org/r/20240128150537.44592-4-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dummy: Use automatic lock and direct mode cleanup.
Jonathan Cameron [Sun, 28 Jan 2024 15:05:29 +0000 (15:05 +0000)]
iio: dummy: Use automatic lock and direct mode cleanup.

Given we now have iio_device_claim_direct_scoped() to perform automatic
releasing of direct mode at exit from the scope that follows it, this can
be used in conjunction with guard(mutex) etc remove a lot of special case
handling.

Note that in this particular example code, there is no real reason you can't
read channels via sysfs at the same time as filling the software buffer.
To make it look more like a real driver constrain raw and processed
channel reads from occurring whilst the buffer is in use.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sa <nuno.a@analog.com>
Link: https://lore.kernel.org/r/20240128150537.44592-3-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: locking: introduce __cleanup() based direct mode claiming infrastructure
Jonathan Cameron [Sun, 28 Jan 2024 15:05:28 +0000 (15:05 +0000)]
iio: locking: introduce __cleanup() based direct mode claiming infrastructure

Allows use of:

       iio_device_claim_direct_scoped(return -EBUSY, indio_dev) {
       }

to automatically call iio_device_release_direct_mode() based on scope.
Typically seen in combination with local device specific locks which
are already have automated cleanup options via guard(mutex)(&st->lock)
and scoped_guard(). Using both together allows most error handling to
be automated.

Reviewed-by: Nuno Sa <nuno.a@analog.com>
Link: https://lore.kernel.org/r/20240128150537.44592-2-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: sx9324: avoid copying property strings
Justin Stitt [Thu, 1 Feb 2024 18:55:03 +0000 (18:55 +0000)]
iio: sx9324: avoid copying property strings

We're doing some needless string copies when trying to assign the proper
`prop` string. We can make `prop` a const char* and simply assign to
string literals.

For the case where a format string is used, let's extract the parsing
logic out into sx9324_parse_phase_prop(). We no longer need to create
copies or allocate new memory.

sx9324_parse_phase_prop() will simply return the default def value if it
fails.

This also cleans up some deprecated strncpy() uses [1].

Furthermore, let's clean up this code further by removing some unused
defines:
|  #define SX9324_PIN_DEF "semtech,ph0-pin"
|  #define SX9324_RESOLUTION_DEF "semtech,ph01-resolution"
|  #define SX9324_PROXRAW_DEF "semtech,ph01-proxraw-strength"

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20240201-strncpy-drivers-iio-proximity-sx9324-c-v5-1-78dde23553bc@google.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: mxc4005: new ACPI ID for the MXC6655 accelerometer
Nikita Mikhailevich [Thu, 1 Feb 2024 15:18:48 +0000 (16:18 +0100)]
iio: accel: mxc4005: new ACPI ID for the MXC6655 accelerometer

New ID was introduced by Chuwi on Minibook X 2023.

Signed-off-by: Nikita Mikhailevich <ermyril@gmail.com>
Link: https://lore.kernel.org/r/20240201151848.1666245-1-ermyril@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: frequency: admfm2000: New driver
Kim Seer Paller [Tue, 23 Jan 2024 08:10:59 +0000 (16:10 +0800)]
iio: frequency: admfm2000: New driver

Dual microwave down converter module with input RF and LO frequency
ranges from 0.5 to 32 GHz and an output IF frequency range from 0.1 to
8 GHz. It consists of a LNA, mixer, IF filter, DSA, and IF amplifier
for each down conversion path.

Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
Link: https://lore.kernel.org/r/20240123081059.5746-2-kimseer.paller@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: frequency: add admfm2000
Kim Seer Paller [Tue, 23 Jan 2024 08:10:58 +0000 (16:10 +0800)]
dt-bindings: iio: frequency: add admfm2000

Dual microwave down converter module with input RF and LO frequency
ranges from 0.5 to 32 GHz and an output IF frequency range from 0.1 to
8 GHz. It consists of a LNA, mixer, IF filter, DSA, and IF amplifier
for each down conversion path.

Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240123081059.5746-1-kimseer.paller@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: health: afe4404: Use devm IIO helpers
Andrew Davis [Tue, 23 Jan 2024 14:09:18 +0000 (08:09 -0600)]
iio: health: afe4404: Use devm IIO helpers

Use a device lifecycle managed IIO helper functions. This helps prevent
mistakes like unregistering and freeing out of order in cleanup functions
and forgetting to unregister and free on error paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240123140918.215818-4-afd@ti.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: health: afe4404: Use devm action helper for regulator disable
Andrew Davis [Tue, 23 Jan 2024 14:09:17 +0000 (08:09 -0600)]
iio: health: afe4404: Use devm action helper for regulator disable

Use a device lifecycle managed action for regulator disable function.
This helps prevent mistakes like unregistering out of order in cleanup
functions and forgetting to unregister on error paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240123140918.215818-3-afd@ti.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: health: afe4403: Use devm IIO helpers
Andrew Davis [Tue, 23 Jan 2024 14:09:16 +0000 (08:09 -0600)]
iio: health: afe4403: Use devm IIO helpers

Use a device lifecycle managed IIO helper functions. This helps prevent
mistakes like unregistering and freeing out of order in cleanup functions
and forgetting to unregister and free on error paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240123140918.215818-2-afd@ti.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: health: afe4403: Use devm action helper for regulator disable
Andrew Davis [Tue, 23 Jan 2024 14:09:15 +0000 (08:09 -0600)]
iio: health: afe4403: Use devm action helper for regulator disable

Use a device lifecycle managed action for regulator disable function.
This helps prevent mistakes like unregistering out of order in cleanup
functions and forgetting to unregister on error paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240123140918.215818-1-afd@ti.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoMAINTAINERS: add IIO GTS tests
Matti Vaittinen [Mon, 15 Jan 2024 14:26:33 +0000 (16:26 +0200)]
MAINTAINERS: add IIO GTS tests

Add undersigned as a maintainer for IIO GTS helper's KUnit tests.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/52c66fe2798192529738ac2ab98a27230a6ad8cd.1705328293.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: test: test gain-time-scale helpers
Matti Vaittinen [Mon, 15 Jan 2024 14:26:07 +0000 (16:26 +0200)]
iio: test: test gain-time-scale helpers

Some light sensors can adjust both the HW-gain and integration time.
There are cases where adjusting the integration time has similar impact
to the scale of the reported values as gain setting has.

IIO users do typically expect to handle scale by a single writable 'scale'
entry. Driver should then adjust the gain/time accordingly.

It however is difficult for a driver to know whether it should change
gain or integration time to meet the requested scale. Usually it is
preferred to have longer integration time which usually improves
accuracy, but there may be use-cases where long measurement times can be
an issue. Thus it can be preferable to allow also changing the
integration time - but mitigate the scale impact by also changing the gain
underneath. Eg, if integration time change doubles the measured values,
the driver can reduce the HW-gain to half.

The theory of the computations of gain-time-scale is simple. However,
some people (undersigned) got that implemented wrong for more than once.
Hence some gain-time-scale helpers were introduced.

Add some simple tests to verify the most hairy functions.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/0f7505b43f91394dc3bb636369489c897b7e01a7.1705328293.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: vcnl4000: Set ps high definition for 4040/4200
MÃ¥rten Lindahl [Mon, 15 Jan 2024 11:44:36 +0000 (12:44 +0100)]
iio: light: vcnl4000: Set ps high definition for 4040/4200

The vcnl4040/vcnl4200 proximity sensor defaults to 12 bit data
resolution, but the chip also supports 16 bit data resolution, which is
called proximity high definition (PS_HD).

Make the vcnl4040/vcnl4200 proximity sensor use the high definition for
all data readings. Please note that in order to preserve the 12 bit
integer part of the in_proximity_raw output, the format is changed from
integer to fixed point.

Signed-off-by: MÃ¥rten Lindahl <marten.lindahl@axis.com>
Link: https://lore.kernel.org/r/20231221-vcnl4000-ps-hd-v3-1-6dcc889372be@axis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: adc: ad_sigma_delta: allow overwriting the IRQ flags
Nuno Sa [Wed, 17 Jan 2024 12:41:04 +0000 (13:41 +0100)]
iio: adc: ad_sigma_delta: allow overwriting the IRQ flags

Make sure we can specify the IRQ trigger type from firmware and drivers
won't ignore it. In fact, this how it should be done but since someone
might be already depending on the driver to hardcode the trigger type
(and not specifying it in firmware), let's do it like this so there's
no possible breakage.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240117-dev_sigma_delta_no_irq_flags-v1-2-db39261592cf@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: imu: adis16480: make use of irq_get_trigger_type()
Nuno Sa [Wed, 17 Jan 2024 13:10:51 +0000 (14:10 +0100)]
iio: imu: adis16480: make use of irq_get_trigger_type()

There's no need to call both irq_get_irq_data() and
irqd_get_trigger_type() as we already have an helper for that. This
allows for code simplification.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240117-adis-improv-v1-3-7f90e9fad200@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: imu: adis16475: make use of irq_get_trigger_type()
Nuno Sa [Wed, 17 Jan 2024 13:10:50 +0000 (14:10 +0100)]
iio: imu: adis16475: make use of irq_get_trigger_type()

There's no need to call both irq_get_irq_data() and
irqd_get_trigger_type() as we already have an helper for that. This
allows for code simplification.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240117-adis-improv-v1-2-7f90e9fad200@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dummy_evgen: remove Excess kernel-doc comments
Randy Dunlap [Sun, 21 Jan 2024 05:50:05 +0000 (21:50 -0800)]
iio: dummy_evgen: remove Excess kernel-doc comments

Drop kernel-doc comments for struct fields that were removed to
prevent kernel-doc warnings:

iio_dummy_evgen.c:43: warning: Excess struct member 'irq_sim' description in 'iio_dummy_eventgen'
iio_dummy_evgen.c:43: warning: Excess struct member 'base' description in 'iio_dummy_eventgen'

Fixes: 337cbeb2c13e ("genirq/irq_sim: Simplify the API")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20240121055005.20042-1-rdunlap@infradead.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: adc: rtq6056: Add support for the whole RTQ6056 family
ChiYuan Huang [Mon, 8 Jan 2024 01:47:28 +0000 (09:47 +0800)]
iio: adc: rtq6056: Add support for the whole RTQ6056 family

RTQ6053 and RTQ6059 are the same series of RTQ6056.

The respective differences with RTQ6056 are listed below
RTQ6053
- chip package type

RTQ6059
- Reduce the pinout for vbus sensing pin
- Some internal ADC scaling change

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://lore.kernel.org/r/3541207c4727e3a76b9a3caf88ef812a4d47b764.1704676198.git.cy_huang@richtek.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agodt-bindings: iio: adc: rtq6056: add support for the whole RTQ6056 family
ChiYuan Huang [Mon, 8 Jan 2024 01:47:27 +0000 (09:47 +0800)]
dt-bindings: iio: adc: rtq6056: add support for the whole RTQ6056 family

Add compatible support for RTQ6053 and RTQ6059.

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/c1abb261bb00846f456eb8fe9b5919f59f287c24.1704676198.git.cy_huang@richtek.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: buffer-dmaengine: make use of the 'struct device *' argument
Nuno Sa [Tue, 9 Jan 2024 14:03:16 +0000 (15:03 +0100)]
iio: buffer-dmaengine: make use of the 'struct device *' argument

Respect the @dev argument in devm_iio_dmaengine_buffer_setup() and bind the
IIO DMA buffer lifetime to that device.

For the only user of this function, the IIO parent device is the
struct device being passed to the API so no real fix in here (just
consistency with other IIO APIs).

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240109-dmaengine_use_device-v1-1-1cbdb7fe9f29@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: core: use INDIO_ALL_BUFFER_MODES in iio_buffer_enabled()
David Lechner [Mon, 8 Jan 2024 20:06:44 +0000 (14:06 -0600)]
iio: core: use INDIO_ALL_BUFFER_MODES in iio_buffer_enabled()

This replaces use of individual buffer mode flags with
INDIO_ALL_BUFFER_MODES in the iio_buffer_enabled() function.

This simplifies the code and makes it robust in case of the addition of
new buffer modes.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240108200647.3916681-1-dlechner@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoMAINTAINERS: correct file entry for AD7091R
Amit Dhingra [Sat, 6 Jan 2024 20:08:35 +0000 (12:08 -0800)]
MAINTAINERS: correct file entry for AD7091R

File entry has driver/iio/adc two times. Fix the file entry

Found by ./scripts/get_maintainer.pl --self-test=patterns

Signed-off-by: Amit Dhingra <mechanicalamit@gmail.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/CAO=gReEUr4B+E2mQsSrncHf41f0A915SuoWgA522_2Ts-dZbSg@mail.gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agotools: iio: replace seekdir() in iio_generic_buffer
Petre Rodan [Mon, 8 Jan 2024 10:32:20 +0000 (12:32 +0200)]
tools: iio: replace seekdir() in iio_generic_buffer

Replace seekdir() with rewinddir() in order to fix a localized glibc bug.

One of the glibc patches that stable Gentoo is using causes an improper
directory stream positioning bug on 32bit arm. That in turn ends up as a
floating point exception in iio_generic_buffer.

The attached patch provides a fix by using an equivalent function which
should not cause trouble for other distros and is easier to reason about
in general as it obviously always goes back to to the start.

https://sourceware.org/bugzilla/show_bug.cgi?id=31212

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20240108103224.3986-1-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: invensense: remove redundant initialization of variable period
Colin Ian King [Sat, 6 Jan 2024 15:32:02 +0000 (15:32 +0000)]
iio: invensense: remove redundant initialization of variable period

The variable period is being initialized with a value that is never
read, it is being re-assigned a new value later on before it is read.
The initialization is redundant and can be removed.

Cleans up clang scan build warning:
Value stored to 'period' during its initialization is never
read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://lore.kernel.org/r/20240106153202.54861-1-colin.i.king@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: accel: bmi088: add i2c support for bmi088 accel driver
Jun Yan [Tue, 19 Dec 2023 15:04:40 +0000 (23:04 +0800)]
iio: accel: bmi088: add i2c support for bmi088 accel driver

The BMI088, BMI085 and BMI090L accelerometer also support
I2C protocol, so let's add the missing I2C support.

The I2C interface of the {BMI085,BMI088,BMI090L} is compatible with
the I2C Specification UM10204 Rev. 03 (19 June 2007), available at
http://www.nxp.com. The {BMI085,BMI088,BMI090L} supports I2C standard
mode and fast mode, only 7-bit address mode is supported.

Datasheet: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmi085-ds001.pdf
Datasheet: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmi088-ds001.pdf
Datasheet: https://mm.digikey.com/Volume0/opasdata/d220001/medias/docus/4807/BST-BMI090L-DS000-00.pdf
Signed-off-by: Jun Yan <jerrysteve1101@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202312191325.jfiyeL5F-lkp@intel.com/
Link: https://lore.kernel.org/r/20231219150440.264033-1-jerrysteve1101@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: adc: ti-adc109s102: drop ACPI_PTR() and CONFIG_ACPI guards
Jonathan Cameron [Sun, 31 Dec 2023 18:35:14 +0000 (18:35 +0000)]
iio: adc: ti-adc109s102: drop ACPI_PTR() and CONFIG_ACPI guards

The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. This example was doing it correctly
but I am proposing dropping this so as to reduce chance of cut and paste
where it is done wrong.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-25-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: light: max44000: drop ACPI_PTR() and CONFIG_ACPI guards
Jonathan Cameron [Sun, 31 Dec 2023 18:35:13 +0000 (18:35 +0000)]
iio: light: max44000: drop ACPI_PTR() and CONFIG_ACPI guards

The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. This example was doing it correctly
but I am proposing dropping this so as to reduce chance of cut and paste
where it is done wrong.  Also drop now unneeded linux/acpi.h include and
added linux/mod_devicetable.h for struct acpi_device_id definition.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-24-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: pressure: hp206c: drop ACPI_PTR() and CONFIG_ACPI guards
Jonathan Cameron [Sun, 31 Dec 2023 18:35:12 +0000 (18:35 +0000)]
iio: pressure: hp206c: drop ACPI_PTR() and CONFIG_ACPI guards

The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. This example was doing it correctly
but I am proposing dropping this so as to reduce chance of cut and paste
where it is done wrong.  Also drop now unneeded linux/acpi.h include and
added linux/mod_devicetable.h for struct acpi_device_id definition.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-23-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: st_sensors: drop ACPI_PTR() and CONFIG_ACPI guards
Jonathan Cameron [Sun, 31 Dec 2023 18:35:11 +0000 (18:35 +0000)]
iio: st_sensors: drop ACPI_PTR() and CONFIG_ACPI guards

The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. This example was doing it correctly
but I am proposing dropping this so as to reduce chance of cut and paste
where it is done wrong.  Also drop now unneeded linux/acpi.h include.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Denis CIOCCA <denis.ciocca@st.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-22-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: potentiometer: max5487: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:35:10 +0000 (18:35 +0000)]
iio: potentiometer: max5487: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Switch include from acpi.h to mod_devicetable.h which includes the
definition of struct acpi_device_id.

Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-21-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: magnetometer: mmc35240: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:35:09 +0000 (18:35 +0000)]
iio: magnetometer: mmc35240: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Switch include from acpi.h to mod_devicetable.h which includes the
definition of struct acpi_device_id.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-20-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: magnetometer: bmc150: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:35:08 +0000 (18:35 +0000)]
iio: magnetometer: bmc150: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Drop unused linux/acpi.h includes.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202312040109.Csnmqnb2-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202311171116.47sUbZV5-lkp@intel.com/
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-19-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: light: us5182d: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:35:07 +0000 (18:35 +0000)]
iio: light: us5182d: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Switch include from acpi.h to mod_devicetable.h which includes the
definition of struct acpi_device_id.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311190738.gldzuIXo-lkp@intel.com/
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-18-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: light: stk3310: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:35:06 +0000 (18:35 +0000)]
iio: light: stk3310: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Switch include from acpi.h to mod_devicetable.h which includes the
definition of struct acpi_device_id.

Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-17-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: light: rpr0521: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:35:05 +0000 (18:35 +0000)]
iio: light: rpr0521: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Switch include from acpi.h to mod_devicetable.h which includes the
definition of struct acpi_device_id.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-16-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: light: ltr501: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:35:04 +0000 (18:35 +0000)]
iio: light: ltr501: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Include linux/mod_devicetable.h which includes the definition of
struct acpi_device_id (hence somewhat related to the main change)

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-15-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: light: jsa1212: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:35:03 +0000 (18:35 +0000)]
iio: light: jsa1212: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Switch include from acpi.h to mod_devicetable.h which includes the
definition of struct acpi_device_id.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-14-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: imu: kmx61: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:35:02 +0000 (18:35 +0000)]
iio: imu: kmx61: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-13-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: imu: fxos8700: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:35:01 +0000 (18:35 +0000)]
iio: imu: fxos8700: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Drop unused acpi.h include.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311231427.vEQAuxvI-lkp@intel.com/
Cc: Carlos Song <carlos.song@nxp.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-12-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: humidity: hts221: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:35:00 +0000 (18:35 +0000)]
iio: humidity: hts221: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Switch include to mod_devicetable.h as that contains the only
ACPI specific definitions needed in this driver.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-11-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: gyro: bmg160: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:34:59 +0000 (18:34 +0000)]
iio: gyro: bmg160: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Switch include to mod_devicetable.h as that contains the only
ACPI specific definitions needed in this driver.

Cc: Mike Looijmans <mike.looijmans@topic.nl>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-10-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: accel: bmc150: Drop ACPI_PTR()
Jonathan Cameron [Sun, 31 Dec 2023 18:34:58 +0000 (18:34 +0000)]
iio: accel: bmc150: Drop ACPI_PTR()

In general the complexity of avoiding maybe unused variable warnings is
not worth dealing with for the small amount of data saved. In thie
case, the i2c driver does include some other code under a CONFIG_ACPI
guard but remove the ACPI_PTR() usage anyway to bring keep it inline
with the spi driver.

Drop include of linux/acpi.h in the spi driver that doesn't need
it as struct acpi_device_id is defined in mod_devicetable.h which
is already included.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-9-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: accel: stk8ba50: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:34:57 +0000 (18:34 +0000)]
iio: accel: stk8ba50: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Switch include to mod_devicetable.h as that contains the only
ACPI specific definitions needed in this driver.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-8-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: accel: mxc6255: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:34:56 +0000 (18:34 +0000)]
iio: accel: mxc6255: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Switch include to mod_devicetable.h as that contains the only
ACPI specific definitions needed in this driver.

Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-7-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: accel: mxc4005: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:34:55 +0000 (18:34 +0000)]
iio: accel: mxc4005: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Switch include to mod_devicetable.h as that contains the only
ACPI specific definitions needed in this driver.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311181952.1usxCcup-lkp@intel.com/
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-6-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: accel: mma9553: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:34:54 +0000 (18:34 +0000)]
iio: accel: mma9553: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Whilst here tidy up a trivial bit of unusual indentation.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-5-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: accel: mma9551: Drop ACPI_PTR() usage
Jonathan Cameron [Sun, 31 Dec 2023 18:34:53 +0000 (18:34 +0000)]
iio: accel: mma9551: Drop ACPI_PTR() usage

Avoiding unused variable warnings when using this macro adds
complexity that in simple cases like this one is not justified
for the small saving in data.

Whilst here tidy up a trivial bit of unusual indentation.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-4-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: accel: kxcjk-1013: Move acpi_device_id table under ifdef CONFIG_ACPI
Jonathan Cameron [Sun, 31 Dec 2023 18:34:52 +0000 (18:34 +0000)]
iio: accel: kxcjk-1013: Move acpi_device_id table under ifdef CONFIG_ACPI

This avoids a build warning due to the use of ACPI_PTR().
Given the driver already has APCI specific code under CONFIG_ACPI move
the table rather than removing the ACPI_PTR() call as we already
have the complexity of CONFIG_ACPI.

Dropped a pointless comma after {} terminator whilst moving the code.

Cc: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-3-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: accel: da280: Stop using ACPI_PTR()
Jonathan Cameron [Sun, 31 Dec 2023 18:34:51 +0000 (18:34 +0000)]
iio: accel: da280: Stop using ACPI_PTR()

In general using ACPI_PTR() leads to more fragile code for a very
minor saving in storage in the case of !CONFIG_ACPI so in IIO we
prefer not to use it if the only ACPI specific code is the acpi_device_id
table.

In this case will also suppress a unused variable warning.

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202302142222.vVU0E4eu-lkp@intel.com/
Cc: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-2-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: pressure: mprls0025pa add SPI driver
Petre Rodan [Fri, 29 Dec 2023 09:24:38 +0000 (11:24 +0200)]
iio: pressure: mprls0025pa add SPI driver

Add SPI component of the driver.

Tested-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20231229092445.30180-11-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: pressure: mprls0025pa add triplet property
Petre Rodan [Fri, 29 Dec 2023 09:24:37 +0000 (11:24 +0200)]
iio: pressure: mprls0025pa add triplet property

Add honeywell,pressure-triplet property that automatically initializes
pmin-pascal, pmax-pascal so that the user is not required to look-up
the chip in the datasheet and convert various units to pascals himself.

Co-developed-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20231229092445.30180-10-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: pressure: mprls0025pa refactor to split core and i2c parts.
Petre Rodan [Fri, 29 Dec 2023 09:24:36 +0000 (11:24 +0200)]
iio: pressure: mprls0025pa refactor to split core and i2c parts.

Refactor driver by splitting the code into core and i2c.

Seemingly redundant read/write function parameters are required for
compatibility with the SPI driver.

Co-developed-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20231229092445.30180-9-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: pressure: mprls0025pa whitespace cleanup
Petre Rodan [Fri, 29 Dec 2023 09:24:35 +0000 (11:24 +0200)]
iio: pressure: mprls0025pa whitespace cleanup

Fix indentation and whitespace in code that will not get refactored.

Make URL inside comment copy-paste friendly.

Co-developed-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20231229092445.30180-8-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: pressure: mprls0025pa remove defaults
Petre Rodan [Fri, 29 Dec 2023 09:24:34 +0000 (11:24 +0200)]
iio: pressure: mprls0025pa remove defaults

This driver supports 32*3 combinations of fixed ranges and transfer
functions, plus custom ranges.

So statistically a user has more than 99% chance that the provided
default configuration will generate invalid pressure readings if the
bindings are not initialized and the driver is instantiated via sysfs.

The current patch removes this loophole making sure the driver loads
only if the firmware properties are present.

Co-developed-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20231229092445.30180-7-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: pressure: mprls0025pa improve driver error resilience
Petre Rodan [Fri, 29 Dec 2023 09:24:33 +0000 (11:24 +0200)]
iio: pressure: mprls0025pa improve driver error resilience

Improve driver error resilience by ignoring the measurement if any of
the 3 error flags gets set while interacting with the sensor.
Based on the datasheet, in table 14 on page 14, the status byte
contains:
    bit 5 busy flag - 1 if device is busy
    bit 2 memory integrity/error flag - 1 if integrity test failed
    bit 0 math saturation - 1 if internal math saturation has occurred

Co-developed-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20231229092445.30180-6-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: pressure: mprls0025pa fix off-by-one enum
Petre Rodan [Fri, 29 Dec 2023 09:24:32 +0000 (11:24 +0200)]
iio: pressure: mprls0025pa fix off-by-one enum

Fix off-by-one error in transfer-function property.
The honeywell,transfer-function property takes values between 1-3 so
make sure the proper enum gets used.

Fixes: 713337d9143ed ("iio: pressure: Honeywell mprls0025pa pressure sensor")
Co-developed-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20231229092445.30180-5-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agodt-bindings: iio: pressure: honeywell,mprls0025pa.yaml add spi bus
Petre Rodan [Fri, 29 Dec 2023 09:24:31 +0000 (11:24 +0200)]
dt-bindings: iio: pressure: honeywell,mprls0025pa.yaml add spi bus

Add spi based example.

Add spi-max-frequency property required by chip specifications.

Add additional maintainer.

Co-developed-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20231229092445.30180-4-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agodt-bindings: iio: pressure: honeywell,mprls0025pa.yaml add pressure-triplet
Petre Rodan [Fri, 29 Dec 2023 09:24:30 +0000 (11:24 +0200)]
dt-bindings: iio: pressure: honeywell,mprls0025pa.yaml add pressure-triplet

Change order of properties in order for the end user to hopefully ignore
pmin-pascal and pmax-pascal which are superseded by pressure-triplet.

Add pressure-triplet property which automatically initializes
pmin-pascal and pmax-pascal inside the driver.

Rework honeywell,pmXX-pascal requirements based on feedback from
Jonathan and Conor.

Co-developed-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20231229092445.30180-3-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agodt-bindings: iio: pressure: honeywell,mprls0025pa.yaml improvements
Petre Rodan [Fri, 29 Dec 2023 09:24:29 +0000 (11:24 +0200)]
dt-bindings: iio: pressure: honeywell,mprls0025pa.yaml improvements

Define enum inside the honeywell,transfer-function property block.

Set the correct irq edge in the example block.
Based on the datasheet, in table 13 on page 11:
"End-of-conversion indicator: This pin is set high when a measurement
and calculation have been completed and the data is ready to be
clocked out"

Add description on End-of-conversion interrupt.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Co-developed-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20231229092445.30180-2-petre.rodan@subdimension.ro
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8 months agoiio: adc: ti-ads1015: Use correct pga upper bound
Mohammed Billoo [Sat, 6 Jan 2024 17:48:35 +0000 (12:48 -0500)]
iio: adc: ti-ads1015: Use correct pga upper bound

The devicetree binding and datasheets (for both the ADS1015 and
ADS1115) show that the PGA index should have a maximum value of 5,
and not 6.

Signed-off-by: Mohammed Billoo <mab.kernel@gmail.com>
Link: https://lore.kernel.org/r/20240106174836.1086714-1-mab.kernel@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>