]> git.ipfire.org Git - thirdparty/kernel/stable.git/log
thirdparty/kernel/stable.git
3 weeks agomd/raid10: reset read_slot when reusing r10bio for discard
Chen Cheng [Fri, 15 May 2026 09:30:19 +0000 (17:30 +0800)] 
md/raid10: reset read_slot when reusing r10bio for discard

put_all_bios() always drops devs[i].bio, but it only drops
devs[i].repl_bio when r10_bio->read_slot < 0. If discard reuses an
r10bio that was previously used for a read, read_slot can still be
non-negative, and discard cleanup can skip bio_put() on repl_bio.

Reset read_slot to -1 when preparing an r10bio for discard so the
replacement bio is always released correctly.

Fixes: d30588b2731f ("md/raid10: improve raid10 discard request")
Signed-off-by: Chen Cheng <chencheng@fnnas.com>
Reviewed-by: Xiao Ni <xiao@kernel.org>
Link: https://patch.msgid.link/20260515093019.3436882-1-chencheng@fnnas.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
3 weeks agomd: skip redundant raid_disks update when value is unchanged
Abd-Alrhman Masalkhi [Tue, 28 Apr 2026 13:05:24 +0000 (15:05 +0200)] 
md: skip redundant raid_disks update when value is unchanged

Calling update_raid_disks() with the same value as the current one
can trigger unnecessary work. For example, RAID1 will reallocate
resources such as the mempool for r1bio.

Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
Link: https://patch.msgid.link/20260428130524.448063-1-abd.masalkhi@gmail.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
3 weeks agodm-raid: only requeue bios when dm is suspending
Benjamin Marzinski [Tue, 28 Apr 2026 23:20:10 +0000 (19:20 -0400)] 
dm-raid: only requeue bios when dm is suspending

Returning DM_MAPIO_REQUEUE from the target map() function only requeues
the bio during noflush suspends. During regular operations or during
flushing suspends, it fails the bio. Failing the bio during flushing
suspends is the correct behavior here. The bio cannot be handled, and
dm-raid cannot suspend while it is outstanding. But during normal
operations, dm-raid should not push the bio back to dm. Instead, wait
for the reshape to be resumed.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Xiao Ni <xiao@kernel.org>
Link: https://patch.msgid.link/20260428232010.2785514-1-bmarzins@redhat.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
3 weeks agoMAINTAINERS: Update Li Nan's E-mail address
Li Nan [Fri, 8 May 2026 09:55:13 +0000 (17:55 +0800)] 
MAINTAINERS: Update Li Nan's E-mail address

Change to my new email address on didiglobal.com.

Signed-off-by: Li Nan <magiclinan@didiglobal.com>
Link: https://patch.msgid.link/tencent_8F8173BEDF20E98550D5429DF802F34A7108@qq.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
3 weeks agoMAINTAINERS: update Yu Kuai's email address
Yu Kuai [Wed, 20 May 2026 11:21:48 +0000 (19:21 +0800)] 
MAINTAINERS: update Yu Kuai's email address

Update Yu Kuai's maintainer entries to use the new fygo.io address.

Link: https://patch.msgid.link/20260520112627.1264368-1-yukuai@fnnas.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
3 weeks agodocs: iio: adc: ad4691: add driver documentation
Radu Sabau [Fri, 29 May 2026 10:15:05 +0000 (13:15 +0300)] 
docs: iio: adc: ad4691: add driver documentation

Add RST documentation for the AD4691 family ADC driver covering
supported devices, IIO channels, operating modes, oversampling,
reference voltage, LDO supply, reset, GP pins, SPI offload support,
and buffer data format.

Signed-off-by: Radu Sabau <radu.sabau@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: ad4691: add oversampling support
Radu Sabau [Fri, 29 May 2026 10:15:04 +0000 (13:15 +0300)] 
iio: adc: ad4691: add oversampling support

Add oversampling ratio (OSR) support for CNV burst mode. The accumulator
depth register (ACC_DEPTH_IN(0)) is programmed with the selected OSR at
buffer enable time and before each single-shot read.

Supported OSR values: 1, 2, 4, 8, 16, 32.

Introduce AD4691_MANUAL_CHANNEL() for manual mode channels, which do
not expose the oversampling_ratio attribute since OSR is not applicable
in that mode. A separate manual_channels array is added to
struct ad4691_channel_info and selected at probe time.

The OSR is shared across all channels (in_voltage_sampling_frequency
and in_voltage_oversampling_ratio are info_mask_shared_by_all) because
the chip has one internal oscillator and a single accumulator depth
register (ACC_DEPTH_IN(0)) for all channels.

in_voltage_sampling_frequency represents the effective output rate,
defined as osc_freq / osr. Writing it computes needed_osc = freq * osr
and snaps down to the largest oscillator table entry that satisfies both
osc <= needed_osc and osc % osr == 0, guaranteeing an exact integer
read-back. The result is stored in target_osc_freq_Hz and written to
OSC_FREQ_REG at buffer enable and single-shot time, so sampling_frequency
and oversampling_ratio can be set in any order.

in_voltage_sampling_frequency_available is precomputed at probe for
each OSR value, listing only oscillator table entries that divide
evenly by that OSR, expressed as effective rates (osc_freq / osr).
The list becomes sparser as OSR increases, capping at max_rate / osr.
read_avail picks the precomputed list for the current OSR, making the
returned pointer stable and race-free.

Writing oversampling_ratio stores the new shared OSR and snaps
target_osc_freq_Hz to the largest oscillator table entry that is both
<= old_effective_rate * new_osr and evenly divisible by new_osr. This
preserves an integer read-back of in_voltage_sampling_frequency after
the OSR change while keeping the oscillator as close as possible to the
previous effective rate.

OSR defaults to 1 (no accumulation).

Signed-off-by: Radu Sabau <radu.sabau@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: ad4691: add SPI offload support
Radu Sabau [Fri, 29 May 2026 10:15:03 +0000 (13:15 +0300)] 
iio: adc: ad4691: add SPI offload support

Add SPI offload support to enable DMA-based, CPU-independent data
acquisition using the SPI Engine offload framework.

When an SPI offload is available (devm_spi_offload_get() succeeds),
the driver registers a DMA engine IIO buffer and uses dedicated buffer
setup operations. If no offload is available the existing software
triggered buffer path is used unchanged.

Both CNV Burst Mode and Manual Mode support offload, but use different
trigger mechanisms:

CNV Burst Mode: the SPI Engine is triggered by the ADC's DATA_READY
signal on the GP pin specified by the trigger-source consumer reference
in the device tree (one cell = GP pin number 0-3). For this mode the
driver acts as both an SPI offload consumer (DMA RX stream, message
optimization) and a trigger source provider: it registers the
GP/DATA_READY output via devm_spi_offload_trigger_register() so the
offload framework can match the '#trigger-source-cells' phandle and
automatically fire the SPI Engine DMA transfer at end-of-conversion.

Manual Mode: the SPI Engine is triggered by a periodic trigger at
the configured sampling frequency. The pre-built SPI message uses
the pipelined CNV-on-CS protocol: N+1 16-bit transfers are issued
for N active channels (the first result is discarded as garbage from
the pipeline flush) and the remaining N results are captured by DMA.

All offload transfers use 16-bit frames (bits_per_word=16, len=2).
The SPI Engine assembles received bits into native 16-bit words before
DMA, so offload samples land in CPU-native byte order (IIO_CPU).
Dedicated channel arrays (AD4691_OFFLOAD_CHANNEL) reflect this: they
omit IIO_BE and carry no soft timestamp (DMA delivers data directly to
userspace). The software triggered-buffer path retains its IIO_BE
channels because bits_per_word=8 causes SPI to deliver bytes MSB-first
into memory, making the on-disk layout big-endian. Both paths use
storagebits=16 as transfers are 16 bits wide in both cases.

IIO_BUFFER_DMAENGINE is selected because the offload path uses
devm_iio_dmaengine_buffer_setup_with_handle() to allocate and
attach the DMA RX buffer to the IIO device.

Signed-off-by: Radu Sabau <radu.sabau@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: ad4691: add triggered buffer support
Radu Sabau [Fri, 29 May 2026 10:15:02 +0000 (13:15 +0300)] 
iio: adc: ad4691: add triggered buffer support

Add buffered capture support using the IIO triggered buffer framework.

CNV Burst Mode: the GP pin identified by interrupt-names in the device
tree is configured as DATA_READY output. The IRQ handler stops
conversions and fires the IIO trigger; the trigger handler executes a
pre-built SPI message that reads all active channels from the AVG_IN
accumulator registers and then resets accumulator state and restarts
conversions for the next cycle.

Manual Mode: CNV is tied to SPI CS so each transfer simultaneously
reads the previous result and starts the next conversion (pipelined
N+1 scheme). At preenable time a pre-built, optimised SPI message of
N+1 transfers is constructed (N channel reads plus one NOOP to drain
the pipeline). The trigger handler executes the message in a single
spi_sync() call and collects the results. An external trigger (e.g.
iio-trig-hrtimer) is required to drive the trigger at the desired
sample rate.

Both modes share the same trigger handler and push a complete scan —
one big-endian 16-bit (__be16) slot per active channel, densely packed
in scan_index order, followed by a timestamp.

The CNV Burst Mode sampling frequency (PWM period) is exposed as a
buffer-level attribute via IIO_DEVICE_ATTR.

Signed-off-by: Radu Sabau <radu.sabau@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: ad4691: add initial driver for AD4691 family
Radu Sabau [Fri, 29 May 2026 10:15:01 +0000 (13:15 +0300)] 
iio: adc: ad4691: add initial driver for AD4691 family

Add support for the Analog Devices AD4691 family of high-speed,
low-power multichannel SAR ADCs: AD4691 (16-ch, 500 kSPS),
AD4692 (16-ch, 1 MSPS), AD4693 (8-ch, 500 kSPS) and
AD4694 (8-ch, 1 MSPS).

The driver implements a custom regmap layer over raw SPI to handle the
device's mixed 1/2/3/4-byte register widths and uses the standard IIO
read_raw/write_raw interface for single-channel reads.

The chip idles in Autonomous Mode so that single-shot read_raw can use
the internal oscillator without disturbing the hardware configuration.

Three voltage supply domains are managed: avdd (required), vio, and a
reference supply on either the REF pin (ref-supply, external buffer)
or the REFIN pin (refin-supply, uses the on-chip reference buffer;
REFBUF_EN is set accordingly). Hardware reset is performed by asserting
then deasserting the reset-gpios GPIO line (tRESETL minimum pulse width
is 10 ns, satisfied by function-call overhead); the driver then waits
300 µs for the chip to complete its internal reset sequence. A software
reset via SPI_CONFIG_A is used as fallback when no reset GPIO is
provided.

Accumulator channel masking for single-shot reads uses ACC_MASK_REG via
an ADDR_DESCENDING SPI write, which covers both mask bytes in a single
16-bit transfer.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Radu Sabau <radu.sabau@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agodt-bindings: iio: adc: add AD4691 family
Radu Sabau [Fri, 29 May 2026 10:15:00 +0000 (13:15 +0300)] 
dt-bindings: iio: adc: add AD4691 family

Add DT bindings for the Analog Devices AD4691 family of multichannel
SAR ADCs (AD4691, AD4692, AD4693, AD4694).

The four variants are not compatible with each other: AD4691/AD4692 have
16 analog input channels while AD4693/AD4694 have 8, and AD4691/AD4693
top out at 500 kSPS while AD4692/AD4694 reach 1 MSPS. These differences
in channel count and maximum sample rate require distinct compatible
strings so the driver can select the correct channel configuration and
rate limits.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Radu Sabau <radu.sabau@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: ad4080: add support for AD4884
Antoniu Miclaus [Fri, 29 May 2026 14:13:53 +0000 (17:13 +0300)] 
iio: adc: ad4080: add support for AD4884

Add support for the AD4884, a dual-channel, 16-bit, 40 MSPS SAR ADC.

The AD4884 is the dual-channel variant of the AD4084, sharing the same
register map and SPI interface as the rest of the AD4080 family. Like
the AD4880, it uses two independent ADC channels, each with its own SPI
configuration interface.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agodt-bindings: iio: adc: ad4080: add AD4884 support
Antoniu Miclaus [Fri, 29 May 2026 14:13:52 +0000 (17:13 +0300)] 
dt-bindings: iio: adc: ad4080: add AD4884 support

Add AD4884 compatible string to the AD4080 devicetree binding.

The AD4884 is a dual-channel, 16-bit, 40 MSPS SAR ADC, sharing the same
register map and interface as the AD4080 family. Like the AD4880, it
requires two SPI chip selects and two io-backends for its independent
ADC channels. The AD4884 differs from the AD4880 in resolution (16-bit
vs 20-bit), which requires distinct channel configuration in the driver,
precluding a fallback compatible.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agolight: tsl2591: simplify tsl2591_persist functions via lookup table
Matheus Silveira [Thu, 28 May 2026 18:55:12 +0000 (15:55 -0300)] 
light: tsl2591: simplify tsl2591_persist functions via lookup table

Replace switch statements with an indexed lookup table for
persist cycle conversions.

Both functions contain redundant switch statements. This
reduces code duplication and makes future updates to
TSL2591_PRST_ALS_INT_CYCLE_* definitions easier to maintain
by keeping the mapping in a single place.

Signed-off-by: Matheus Silveira <matheus.feitosa@usp.br>
Co-developed-by: Lucas Rabaquim <lucas.rabaquim@usp.br>
Signed-off-by: Lucas Rabaquim <lucas.rabaquim@usp.br>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: Use named initializers for platform_device_id arrays
Uwe Kleine-König (The Capable Hub) [Thu, 28 May 2026 10:16:49 +0000 (12:16 +0200)] 
iio: Use named initializers for platform_device_id arrays

Named initializers are better readable and more robust to changes of the
struct definition. This robustness is relevant for a planned change to
struct platform_device_id replacing .driver_data by an anonymous union.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: temperature: ltc2983: Add support for ADT7604
Liviu Stan [Mon, 25 May 2026 16:39:36 +0000 (19:39 +0300)] 
iio: temperature: ltc2983: Add support for ADT7604

The ADT7604 shares the same die as the LTC2984. It repurposes the
custom RTD sensor type (18) as a copper trace resistance sensor
and the custom thermistor type (27) as a leak detector, and
removes thermocouple, diode and direct ADC sensor types.

Two new software sensor type values are introduced
(LTC2983_SENSOR_COPPER_TRACE = 32, LTC2983_SENSOR_LEAK_DETECTOR = 33)
that map to the hardware register values 18 and 27 respectively.
Dedicated structs (ltc2983_copper_trace, ltc2983_leak_detector) and
parser functions are added rather than extending the existing RTD and
thermistor paths, as the hardware configuration bits are fully
hardcoded and several RTD/thermistor properties would need to be
explicitly forbidden or ignored.

Custom RTD (type 18) becomes the copper trace sensor. Sensor
configuration bits are hardcoded to 0b1001 per the datasheet.
Two variants are supported via the adi,copper-trace-sub-ohm DT
property: sub-ohm traces (< 1 ohm) have bits 17:0 cleared with no
excitation current or custom table; standard traces (> 1 ohm) have
a required resistance-to-temperature table.

Custom thermistor (type 27) becomes the leak detector. Sensor
configuration bits are hardcoded to 0b001. The custom table uses
a resolution of 16 instead of 64, and is specified via the
required adi,custom-leak-detector DT property.

Both sensor types expose an IIO_RESISTANCE channel reading from
the resistance result register bank (0x0060-0x00AF). Added a
"base" parameter to the LTC2983_RESULT_ADDR macro and a "base_reg"
parameter to the ltc2983_chan_read function so we can read from
both result register banks. The resistance register encodes the
measured resistance with 10 fractional bits, so dividing by 1024
gives ohms. Since the sense resistor is specified in ohms, the
output is in ohms for both sensor types and a single 1/1024
scale applies to both. For > 1 ohm copper traces and for leak
detectors, a secondary channel also appears: IIO_TEMP
(millidegrees Celsius) for copper trace and IIO_COVERAGE (percent)
for leak detector.

The ltc2983_chip_info struct is extended with a u64 supported_sensors
bitmask using BIT_ULL() to safely represent the new sensor type bits
32 and 33 on 32-bit builds. A LTC2983_SENSOR_NUM sentinel is added
to the enum so that the bounds check uses >= LTC2983_SENSOR_NUM
rather than hardcoding the last sensor type.

Tested on EVAL-ADT7604-AZ connected to Raspberry Pi 5 via SPI.

Signed-off-by: Liviu Stan <liviu.stan@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agodt-bindings: iio: temperature: Add ADT7604 support to adi,ltc2983
Liviu Stan [Mon, 25 May 2026 16:39:35 +0000 (19:39 +0300)] 
dt-bindings: iio: temperature: Add ADT7604 support to adi,ltc2983

The ADT7604 shares the same die as the LTC2984. It repurposes the
custom RTD sensor type (18) as a copper trace resistance sensor
and the custom thermistor type (27) as a leak detector, and
removes thermocouple, diode and direct ADC sensor types.

Add adi,adt7604 to the compatible list and introduce two new
sensor node types specific to this device:

- copper-trace@: maps to the custom RTD sensor type (18). Two
variants: sub-ohm (< 1 ohm, adi,copper-trace-sub-ohm boolean,
no custom table and excitation current) and standard (> 1 ohm,
required adi,custom-copper-trace table, optional excitation current
defaulting to the datasheet recommended value). Primary output
is resistance in ohms. For > 1 ohm copper traces with a custom table,
the chip also outputs temperature in millidegrees Celsius.

- leak-detector@: maps to the custom thermistor sensor type (27).
Takes a required adi,custom-leak-detector lookup table encoding
resistance (uOhm) against coverage data (%). Two outputs:
resistance in ohms and coverage in percent.

Separate node types are used rather than extending the existing
rtd@ and thermistor@ nodes because adi,custom-rtd is required
for sensor type 18, and several properties (adi,number-of-wires,
adi,rtd-curve, adi,rsense-share, adi,single-ended,
adi,current-rotate) have no meaning for the new sensor types, since
the configuration is hardcoded, and would need to be explicitly
forbidden or ignored in the driver.

allOf conditions are added to restrict thermocouple, diode, direct
ADC and active temperature nodes to non-ADT7604 devices, and to
restrict copper-trace and leak-detector nodes to the ADT7604
(some parts only).

Signed-off-by: Liviu Stan <liviu.stan@analog.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: core: Add IIO_COVERAGE channel type
Liviu Stan [Mon, 25 May 2026 16:39:34 +0000 (19:39 +0300)] 
iio: core: Add IIO_COVERAGE channel type

Add a new channel type for sensors that report fractional coverage as
a percentage. The sysfs attribute is in_coverageY_raw; after applying
in_coverageY_scale the value is in percent. The first user is the
ADT7604 leak detector, where the value represents the portion of the
sensing element that is wetted.

Signed-off-by: Liviu Stan <liviu.stan@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: temperature: ltc2983: Use fwnode_property_present() for optional properties
Liviu Stan [Mon, 25 May 2026 16:39:33 +0000 (19:39 +0300)] 
iio: temperature: ltc2983: Use fwnode_property_present() for optional properties

Checking fwnode_property_read_u32() return value with if (!ret)
silently swallows meaningful error codes when a property is present
but malformed. Use fwnode_property_present() first so that absence
uses the default while a present but unreadable property returns
a proper error.

Signed-off-by: Liviu Stan <liviu.stan@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: temperature: ltc2983: Fix inconsistent channel wording in messages
Liviu Stan [Mon, 25 May 2026 16:39:32 +0000 (19:39 +0300)] 
iio: temperature: ltc2983: Fix inconsistent channel wording in messages

Replace occurrences of the abbreviated 'chann' and 'chan' with
'channel' in error and debug messages throughout the driver.
Also changed the diode invalid channel error message from
"thermistor" to "diode".

Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Liviu Stan <liviu.stan@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: temperature: ltc2983: Use local device pointer consistently
Liviu Stan [Mon, 25 May 2026 16:39:31 +0000 (19:39 +0300)] 
iio: temperature: ltc2983: Use local device pointer consistently

Some functions define a local 'dev' pointer but still use bare
'&st->spi->dev' in some code paths, and some don't have it at all.
Replace bare references with the local pointer for consistency and
collapse some wrapped lines that now fit within 80 characters.

Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Liviu Stan <liviu.stan@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: temperature: ltc2983: Fix macro parenthesization and rename
Liviu Stan [Mon, 25 May 2026 16:39:30 +0000 (19:39 +0300)] 
iio: temperature: ltc2983: Fix macro parenthesization and rename

Wrap the 'chan' parameter in LTC2983_CHAN_START_ADDR() and
LTC2983_CHAN_RES_ADDR() with parentheses to prevent potential
macro argument expansion issues. Also rename LTC2983_CHAN_START_ADDR
to LTC2983_CHAN_ASSIGN_ADDR and LTC2983_CHAN_RES_ADDR to
LTC2983_RESULT_ADDR, to better reflect the datasheet names and avoid
them being confused as related.

Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Liviu Stan <liviu.stan@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: temperature: ltc2983: Fix reinit_completion() called after conversion start
Liviu Stan [Mon, 25 May 2026 16:39:29 +0000 (19:39 +0300)] 
iio: temperature: ltc2983: Fix reinit_completion() called after conversion start

reinit_completion() was called after regmap_write() initiated the hardware
conversion, creating a race window where the interrupt could fire and call
complete() before reinit_completion() reset the completion.

Move reinit_completion() before the regmap_write() to close the race.
ltc2983_eeprom_cmd() already does it in the correct order.

Fixes: f110f3188e56 ("iio: temperature: Add support for LTC2983")
Signed-off-by: Liviu Stan <liviu.stan@analog.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: temperature: ltc2983: Fix n_wires default bypassing rotation check
Liviu Stan [Mon, 25 May 2026 16:39:28 +0000 (19:39 +0300)] 
iio: temperature: ltc2983: Fix n_wires default bypassing rotation check

When adi,number-of-wires is absent, n_wires is left at 0. The binding
documents a default of 2 wires, matching the hardware default. However
the current-rotate validation checks n_wires == 2 || n_wires == 3, so
with n_wires = 0 the guard is bypassed and adi,current-rotate is accepted
for a 2-wire RTD.

Initialize n_wires = 2 to match the binding default and ensure the
rotation check fires correctly when the property is absent.

Fixes: f110f3188e56 ("iio: temperature: Add support for LTC2983")
Signed-off-by: Liviu Stan <liviu.stan@analog.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: light: add support for APDS9999 sensor
Jose A. Perez de Azpillaga [Tue, 26 May 2026 07:55:46 +0000 (09:55 +0200)] 
iio: light: add support for APDS9999 sensor

Add IIO driver for Broadcom APDS9999 ambient light sensor.

The APDS9999 is a digital proximity and RGB sensor with ALS
capability. The driver implements the ALS/Lux functionality
using the green channel, which uses optical coating technology
to approximate the human eye spectral response.

Raw IIO_INTENSITY channels are exposed for red, green, blue,
and IR so userspace can compute its own weighted lux.
Proximity (PS) support is not yet implemented.

Signed-off-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agodt-bindings: iio: light: add Broadcom APDS9999
Jose A. Perez de Azpillaga [Tue, 26 May 2026 07:55:15 +0000 (09:55 +0200)] 
dt-bindings: iio: light: add Broadcom APDS9999

Add Device Tree binding for the Broadcom APDS9999 ambient light
and proximity sensor. A separate binding file is used rather
than merging with avago,apds9300.yaml because the APDS9999
has an additional vcsel-supply for the VCSEL.

The APDS9999 features individual R, G, B, and IR channels with
a green channel that uses optical coating to approximate the
human eye spectral response for ALS/lux measurements. Calibrated
RGB color sensing is not yet implemented in the driver.

Signed-off-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: spear_adc: align headers with IWYU principle
Rodrigo Gobbi [Wed, 27 May 2026 01:36:40 +0000 (22:36 -0300)] 
iio: adc: spear_adc: align headers with IWYU principle

Remove unused includes and add what is being used:

#include <linux/array_size.h> // for ARRAY_SIZE
#include <linux/bits.h>  // for GENMASKxx
#include <linux/dev_printk.h> // for dev_err_probe, dev_info
#include <linux/math.h>  // for DIV_ROUND_UP
#include <linux/mutex.h> // for struct mutex
#include <linux/types.h> // for uXX definitions
#include <linux/iio/types.h> // for IIO_CHAN_INFO_*

Signed-off-by: Rodrigo Gobbi <rodrigo.gobbi.7@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: spear_adc: sort includes alphabetically
Rodrigo Gobbi [Wed, 27 May 2026 01:36:39 +0000 (22:36 -0300)] 
iio: adc: spear_adc: sort includes alphabetically

Sort includes alphabetically, no functional change

Signed-off-by: Rodrigo Gobbi <rodrigo.gobbi.7@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: pressure: cros_ec_baro: simplify timestamp channel definition
David Lechner [Mon, 25 May 2026 01:46:52 +0000 (20:46 -0500)] 
iio: pressure: cros_ec_baro: simplify timestamp channel definition

Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of
manually filling in the struct iio_chan_spec fields. This makes the code
less verbose and mistake-prone.

Also drop obvious comment while we're at it.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: light: cros_ec_light_prox: simplify timestamp channel definition
David Lechner [Mon, 25 May 2026 01:38:40 +0000 (20:38 -0500)] 
iio: light: cros_ec_light_prox: simplify timestamp channel definition

Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of
manually filling in the struct iio_chan_spec fields. This makes the code
less verbose and mistake-prone.

Also drop obvious comment while we're at it.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: common: cros_ec_sensors: simplify timestamp channel definition
David Lechner [Mon, 25 May 2026 01:38:39 +0000 (20:38 -0500)] 
iio: common: cros_ec_sensors: simplify timestamp channel definition

Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of
manually filling in the struct iio_chan_spec fields. This makes the code
less verbose and mistake-prone.

Also drop obvious comment while we're at it.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: stm32-adc: simplify timestamp channel definition
David Lechner [Mon, 25 May 2026 01:38:38 +0000 (20:38 -0500)] 
iio: adc: stm32-adc: simplify timestamp channel definition

Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of
manually filling in the struct iio_chan_spec fields. This makes the code
less verbose and mistake-prone.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: cc10001_adc: simplify timestamp channel definition
David Lechner [Mon, 25 May 2026 01:38:37 +0000 (20:38 -0500)] 
iio: adc: cc10001_adc: simplify timestamp channel definition

Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of
manually filling in the struct iio_chan_spec fields. This makes the code
less verbose and mistake-prone.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: at91_adc: simplify timestamp channel definition
David Lechner [Mon, 25 May 2026 01:38:36 +0000 (20:38 -0500)] 
iio: adc: at91_adc: simplify timestamp channel definition

Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of
manually filling in the struct iio_chan_spec fields. This makes the code
less verbose and mistake-prone.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: dln2-adc: simplify timestamp channel definition
David Lechner [Mon, 25 May 2026 01:38:35 +0000 (20:38 -0500)] 
iio: adc: dln2-adc: simplify timestamp channel definition

Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of
manually filling in the struct iio_chan_spec fields. This makes the code
less verbose and mistake-prone.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: common: scmi_sensors: simplify timestamp channel definition
David Lechner [Mon, 25 May 2026 01:38:34 +0000 (20:38 -0500)] 
iio: common: scmi_sensors: simplify timestamp channel definition

Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of
manually filling in the struct iio_chan_spec fields. This makes the code
less verbose and mistake-prone.

In fact, there was an error here as the sign should be 's' instead of
'u' which is now changed to 's' by using IIO_CHAN_SOFT_TIMESTAMP().

If we find that this breaks userspace, we will have to revert this
change, but seems unlikely since the timestamp channel is well-known to
be a signed 64-bit integer globally.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: Convert IIO_CHAN_SOFT_TIMESTAMP() to be compound literal
Andy Shevchenko [Mon, 25 May 2026 01:38:33 +0000 (20:38 -0500)] 
iio: Convert IIO_CHAN_SOFT_TIMESTAMP() to be compound literal

Currently IIO_CHAN_SOFT_TIMESTAMP() can only be used to fill the static
data.  In some cases it would be convenient to use it as right value in
the assignment operation. But it can't be done as is, because compiler
has no clue about the data layout. Converting it to be a compound literal
allows the above mentioned usage.

While at it, tidy up the indentation.

We also have to change existing uses of compound literal at the same
time to avoid compiler errors.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: chemical: sps30: Replace manual locking with RAII locking
Maxwell Doose [Sat, 23 May 2026 18:15:36 +0000 (13:15 -0500)] 
iio: chemical: sps30: Replace manual locking with RAII locking

Replace manual mutex_lock() and mutex_unlock() calls with the much newer
guard(mutex)() macro to enable RAII patterns, modernize the driver, and
to increase readability.

Move mutex locking into sps30_do_meas() and tune it up to use guard()(),
as every caller takes the lock anyways.

Signed-off-by: Maxwell Doose <m32285159@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: tcs3472: move standalone return to default case
Aldo Conte [Fri, 22 May 2026 12:34:18 +0000 (14:34 +0200)] 
iio: tcs3472: move standalone return to default case

Move the trailing 'return -EINVAL' statements at the end of
tcs3472_read_raw() and tcs3472_write_raw() into explicit default:
cases inside the respective switch statements.

This removes the need for a separate return statement
after the switch.

No functional change.

Suggested-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: tcs3472: use local struct device * for remaining cases
Aldo Conte [Fri, 22 May 2026 12:34:17 +0000 (14:34 +0200)] 
iio: tcs3472: use local struct device * for remaining cases

Use the local 'struct device *dev' variable introduced for the devm
calls also for the dev_info() calls in tcs3472_probe(), to keep the
probe function consistent.

No functional change.

Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: tcs3472: use devm for resource management
Aldo Conte [Fri, 22 May 2026 12:34:16 +0000 (14:34 +0200)] 
iio: tcs3472: use devm for resource management

Convert the driver to use device-managed resource allocation:
- Add tcs3472_powerdown_action() and register it with
  devm_add_action_or_reset() to ensure the device is powered down on
  cleanup.
- Replace iio_triggered_buffer_setup() with
  devm_iio_triggered_buffer_setup().
- Replace request_threaded_irq() with devm_request_threaded_irq().
- Replace iio_device_register() with devm_iio_device_register().
- Replace mutex_init() with devm_mutex_init().
- Remove tcs3472_remove() as all cleanup is now handled by devm.

Use a local 'dev = &client->dev' in tcs3472_probe() to keep the devm
calls compact.

Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: tcs3472: use ! instead of explicit NULL check
Aldo Conte [Fri, 22 May 2026 12:34:15 +0000 (14:34 +0200)] 
iio: tcs3472: use ! instead of explicit NULL check

Replace 'if (indio_dev == NULL)' with 'if (!indio_dev)' in
tcs3472_probe() to follow the preferred kernel style.

No functional change.

Suggested-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: tcs3472: convert remaining locking to guard(mutex)
Aldo Conte [Fri, 22 May 2026 12:34:14 +0000 (14:34 +0200)] 
iio: tcs3472: convert remaining locking to guard(mutex)

Convert several functions to use guard(mutex)()

This avoids manual unlock calls on each return path, drops the goto
in tcs3472_write_event(), and removes 'ret' variables only needed to
return after the unlock.

While the conversion is in progress, take the opportunity to make a
few small cleanups that guard() enables:

  - In tcs3472_read_event_config(), replace '!!(...)' with
    '(...) ? 1 : 0' for readability.

  - In tcs3472_write_event_config(), tcs3472_powerdown() and
    tcs3472_resume() use an early return on the I2C
    write failure path.

No functional change.

Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: tcs3472: sort headers alphabetically
Aldo Conte [Fri, 22 May 2026 12:34:13 +0000 (14:34 +0200)] 
iio: tcs3472: sort headers alphabetically

Sort the #include directives in alphabetical order in preparation for
adding new headers in upcoming patches.

No functional change.

Suggested-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: tcs3472: power down chip on probe failure
Aldo Conte [Fri, 22 May 2026 12:34:12 +0000 (14:34 +0200)] 
iio: tcs3472: power down chip on probe failure

If tcs3472_probe() fails after enabling the chip (by writing PON | AEN
to the ENABLE register), the error paths return without powering down
the device.

Add an 'error_powerdown' label at the end of the cleanup chain that
calls tcs3472_powerdown() to power down the chip. The existing label
cascade is rerouted to fall through to the new label.

Move tcs3472_powerdown() above tcs3472_probe() so the probe can call
it without a forward declaration.

Found by code inspection while reviewing the probe error paths in
preparation for the devm_ conversion.

Fixes: eb869ade30a6 ("iio: Add tcs3472 color light sensor driver")
Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: pressure: HID: hid-sensor-press: Refactor channel initialization
Natália Salvino André [Tue, 19 May 2026 23:40:48 +0000 (20:40 -0300)] 
iio: pressure: HID: hid-sensor-press: Refactor channel initialization

Replace the local press_adjust_channel_bit_mask() function with a
compound literal for scan_type initialization to improve code
readability.

Signed-off-by: Natália Salvino André <natalia.andre@ime.usp.br>
Co-developed-by: Pietro Di Consolo Gregorio <pietro.gregorio@usp.br>
Signed-off-by: Pietro Di Consolo Gregorio <pietro.gregorio@usp.br>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: magnetometer: HID: hid-sensor-magn-3d: Refactor channel initialization
Natália Salvino André [Tue, 19 May 2026 23:40:47 +0000 (20:40 -0300)] 
iio: magnetometer: HID: hid-sensor-magn-3d: Refactor channel initialization

Replace the local magn_3d_adjust_channel_bit_mask() function with a
compound literal for scan_type initialization to improve code
readability.

Signed-off-by: Natália Salvino André <natalia.andre@ime.usp.br>
Co-developed-by: Pietro Di Consolo Gregorio <pietro.gregorio@usp.br>
Signed-off-by: Pietro Di Consolo Gregorio <pietro.gregorio@usp.br>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: light: HID: hid-sensor-prox: Refactor channel initialization
Natália Salvino André [Tue, 19 May 2026 23:40:46 +0000 (20:40 -0300)] 
iio: light: HID: hid-sensor-prox: Refactor channel initialization

Replace the local prox_adjust_channel_bit_mask() function with a
compound literal for scan_type initialization to improve code
readability.

Signed-off-by: Natália Salvino André <natalia.andre@ime.usp.br>
Co-developed-by: Pietro Di Consolo Gregorio <pietro.gregorio@usp.br>
Signed-off-by: Pietro Di Consolo Gregorio <pietro.gregorio@usp.br>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: light: HID: hid-sensor-als: Refactor channel initialization
Natália Salvino André [Tue, 19 May 2026 23:40:45 +0000 (20:40 -0300)] 
iio: light: HID: hid-sensor-als: Refactor channel initialization

Replace the local als_adjust_channel_bit_mask() function with a
compound literal for scan_type initialization to improve code
readability.

Signed-off-by: Natália Salvino André <natalia.andre@ime.usp.br>
Co-developed-by: Pietro Di Consolo Gregorio <pietro.gregorio@usp.br>
Signed-off-by: Pietro Di Consolo Gregorio <pietro.gregorio@usp.br>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: gyro: HID: hid-sensor-gyro-3d: Refactor channel initialization
Natália Salvino André [Tue, 19 May 2026 23:40:44 +0000 (20:40 -0300)] 
iio: gyro: HID: hid-sensor-gyro-3d: Refactor channel initialization

Replace the local gyro_3d_adjust_channel_bit_mask() function with a
compound literal for scan_type initialization to improve code
readability. Additionaly, clean up the channel initialization
loop by iterating directly over the channel scan indices.

Signed-off-by: Natália Salvino André <natalia.andre@ime.usp.br>
Co-developed-by: Pietro Di Consolo Gregorio <pietro.gregorio@usp.br>
Signed-off-by: Pietro Di Consolo Gregorio <pietro.gregorio@usp.br>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: accel: HID: hid-sensor-accel-3d: Refactor channel initialization
Natália Salvino André [Tue, 19 May 2026 23:40:43 +0000 (20:40 -0300)] 
iio: accel: HID: hid-sensor-accel-3d: Refactor channel initialization

Clean up the channel initialization loop and replace the local
accel_3d_adjust_channel_bit_mask() function with a compound literal
to improve code readability.

Signed-off-by: Natália Salvino André <natalia.andre@ime.usp.br>
Co-developed-by: Pietro Di Consolo Gregorio <pietro.gregorio@usp.br>
Signed-off-by: Pietro Di Consolo Gregorio <pietro.gregorio@usp.br>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: imu: bno055: terminate dev_err() strings with a newline
Stepan Ionichev [Wed, 20 May 2026 19:08:50 +0000 (00:08 +0500)] 
iio: imu: bno055: terminate dev_err() strings with a newline

Two dev_err() calls in bno055_ser_write_reg() and bno055_ser_read_reg()
are missing the trailing newline, so the kernel log buffer continues
the next message on the same line.

Add the missing \n.

Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Reviewed-by: Maxwell Doose <m32285159@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: imu: kmx61: Use guard(mutex)() over manual locking
Maxwell Doose [Thu, 21 May 2026 22:30:43 +0000 (17:30 -0500)] 
iio: imu: kmx61: Use guard(mutex)() over manual locking

Include linux/cleanup.h to take advantage of new macros.

Replace manual mutex_lock() and mutex_unlock() calls across the file
with guard(mutex)() and scoped_guard() where appropriate to simplify
error paths and eliminate manual locking calls.

Add new helper function kmx61_read_for_each_active_channel() to mitigate
certain style issues and to prevent notifying that the IRQ is finished
whilst holding the lock.

Update certain returns, and add default case to return -EINVAL in
kmx61_read_raw().

Remove now-redundant gotos and ret variables, as the new RAII macros
make them unneeded.

Signed-off-by: Maxwell Doose <m32285159@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: humidity: ens210: remove compiler warning workaround
David Lechner [Fri, 22 May 2026 01:25:29 +0000 (20:25 -0500)] 
iio: humidity: ens210: remove compiler warning workaround

Rewrite IIO_CHAN_INFO_RAW case to avoid needing to add unreachable code
to work around a compiler warning.

When scoped_guard() was first introduced, compilers could not see when
it returned unconditionally from inside the hidden for loop. This has
since been fixed in the macro definition. So removing the `return
-EINVAL` should be enough. Still, we can improve readability, decrease
indentation and avoid the hidden for loop by rewriting the case without
scoped_guard().

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: Initialize i2c_device_id arrays using member names
Uwe Kleine-König (The Capable Hub) [Tue, 19 May 2026 08:13:09 +0000 (10:13 +0200)] 
iio: Initialize i2c_device_id arrays using member names

While being less compact, using named initializers allows to more easily
see which members of the structs are assigned which value without having
to lookup the declaration of the struct. And it's also more robust
against changes to the struct definition.

The mentioned robustness is relevant for a planned change to struct
i2c_device_id that replaces .driver_data by an anonymous union.

This patch doesn't modify the compiled arrays, only their representation
in source form benefits. The former was confirmed with x86 and arm64
builds.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Reviewed-by: Siratul Islam <email@sirat.me>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agostaging: iio: Use named initializers for struct i2c_device_id
Uwe Kleine-König (The Capable Hub) [Tue, 19 May 2026 14:06:20 +0000 (16:06 +0200)] 
staging: iio: Use named initializers for struct i2c_device_id

While being less compact, using named initializers allows to more easily
see which members of the structs are assigned which value without having
to lookup the declaration of the struct. And it's also more robust
against changes to the struct definition.

This patch doesn't modify the compiled arrays, only their representation
in source form benefits. The former was confirmed with x86 and arm64
builds.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Reviewed-by: Stepan Ionichev <sozdayvek@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: proximity: sx9360: Drop unused driver data
Uwe Kleine-König (The Capable Hub) [Tue, 19 May 2026 08:13:08 +0000 (10:13 +0200)] 
iio: proximity: sx9360: Drop unused driver data

The value assigned in the three device_id entries (ACPI, of and i2c) are
unused, directly in the driver and also the sx_common support lib. Drop
them and while touching these arrays, convert to named initializers.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: proximity: sx9324: Drop unused driver data
Uwe Kleine-König (The Capable Hub) [Tue, 19 May 2026 08:13:07 +0000 (10:13 +0200)] 
iio: proximity: sx9324: Drop unused driver data

The value assigned in the three device_id entries (ACPI, of and i2c) are
unused, directly in the driver and also the sx_common support lib. Drop
them and while touching these arrays, convert to named initializers.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: dac: max5821: Drop unused i2c driver data
Uwe Kleine-König (The Capable Hub) [Tue, 19 May 2026 08:13:06 +0000 (10:13 +0200)] 
iio: dac: max5821: Drop unused i2c driver data

The .driver_data member of the single i2c_device_id array entry is
unused in the driver. Drop it and also the then unused definition.

While at it, convert the i2c_device_id array to a better readable named
initializer.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: ad7091r5: Simplify driver_data handling
Uwe Kleine-König (The Capable Hub) [Tue, 19 May 2026 08:13:05 +0000 (10:13 +0200)] 
iio: adc: ad7091r5: Simplify driver_data handling

The driver only supports a single device type. So the return value of
i2c_get_match_data() is already known and can just be hardcoded without
type casting. While at it also remove the unused .data of the
single of_device_id entry.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: accel: bmc150: Explicitly set .driver_data
Uwe Kleine-König (The Capable Hub) [Tue, 19 May 2026 08:13:04 +0000 (10:13 +0200)] 
iio: accel: bmc150: Explicitly set .driver_data

There is one id entry that has an explicit assignment to .driver_data.
To make the intention clearer, assign BOSCH_UNKNOWN (which is also 0)
for all previously ids that had .driver_data = 0 implicitly before.

While touching all entries in this array, convert to named initializers.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: common: ssp: remove SSP_CHAN_TIMESTAMP() macro
David Lechner [Sun, 17 May 2026 17:29:35 +0000 (12:29 -0500)] 
iio: common: ssp: remove SSP_CHAN_TIMESTAMP() macro

Remove the SSP_CHAN_TIMESTAMP() macro and replace users with the
IIO_CHAN_SOFT_TIMESTAMP() macro. The SSP_CHAN_TIMESTAMP() macro is
identical to the IIO_CHAN_SOFT_TIMESTAMP() macro, so we don't need
a separate macro for it.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agodocs: iio: triggered-buffers: use new helpers in example
David Lechner [Sun, 17 May 2026 17:00:59 +0000 (12:00 -0500)] 
docs: iio: triggered-buffers: use new helpers in example

Update the "typical" triggered buffer example to use various new helpers
that have been added in the last year or so. This reflects current
expectations of how similar code should be written.

Also zero-initialize the buffer so we don't leak stack data. And fix a
missing semicolon while we're at it.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Stepan Ionichev <sozdayvek@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoMAINTAINERS: add match for IIO API docs
David Lechner [Sun, 17 May 2026 17:00:58 +0000 (12:00 -0500)] 
MAINTAINERS: add match for IIO API docs

Add a match for Documentation/driver-api/iio/ to the IIO subsystem in
MAINTAINERS. Any changes to the IIO API documentation should be reviewed
IIO folks.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Stepan Ionichev <sozdayvek@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: trigger: drop generic interrupt trigger.
Jonathan Cameron [Sat, 16 May 2026 11:32:19 +0000 (12:32 +0100)] 
iio: trigger: drop generic interrupt trigger.

There is no way to bind to this driver from firmware and no explicit
platform device creation calls exist in mainline.

As such it is dead code. So drop it rather than potentially wasting time
modernizing it (see #1)

Link: https://lore.kernel.org/all/20260511063229.1433-1-sozdayvek@gmail.com/
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: accel: mma8452: Use dev_err_probe()
Sanjay Chitroda [Tue, 5 May 2026 17:46:35 +0000 (23:16 +0530)] 
iio: accel: mma8452: Use dev_err_probe()

dev_err_probe() makes error code handling simpler and handle
deferred probe nicely (avoid spamming logs).

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: accel: mma8452: sort headers alphabetically
Sanjay Chitroda [Tue, 5 May 2026 17:46:34 +0000 (23:16 +0530)] 
iio: accel: mma8452: sort headers alphabetically

Sort include headers alphabetically to improve readability.

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: accel: mma8452: cleanup codestyle warning
Sanjay Chitroda [Tue, 5 May 2026 17:46:33 +0000 (23:16 +0530)] 
iio: accel: mma8452: cleanup codestyle warning

Reported by checkpatch:
FILE: drivers/iio/accel/mma8452.c

CHECK: Alignment should match open parenthesis

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: accel: mma8452: switch to non-devm request_threaded_irq()
Sanjay Chitroda [Tue, 5 May 2026 17:46:32 +0000 (23:16 +0530)] 
iio: accel: mma8452: switch to non-devm request_threaded_irq()

Avoid using devm_request_threaded_irq() as the driver requires explicit
error-handling path(s). Using devm_* API together with goto-based
unwinding breaks the expected LIFO resource release model.

Add explicit IRQ cleanup in the driver teardown paths to follow kernel
resource management conventions.

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: accel: mma8452: handle I2C read error(s) in mma8452_read()
Sanjay Chitroda [Tue, 5 May 2026 17:46:31 +0000 (23:16 +0530)] 
iio: accel: mma8452: handle I2C read error(s) in mma8452_read()

Currently, If i2c_smbus_read_i2c_block_data() fails but
mma8452_set_runtime_pm_state() succeeds, mma8452_read() returns 0.

As a result, the caller mma8452_read_raw() assumes the read was
successful and proceeds to use a buffer containing uninitialized
stack memory.

Add proper checking of the I2C read return value and propagate errors
to the caller.

Fixes: 96c0cb2bbfe0 ("iio: mma8452: add support for runtime power management")
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: dac: ad5504: introduce local dev pointer
Taha Ed-Dafili [Sat, 9 May 2026 14:20:42 +0000 (15:20 +0100)] 
iio: dac: ad5504: introduce local dev pointer

Replace &spi->dev with a local dev pointer to shorten lines, fix
alignment, and improve overall readability in the probe function.

Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: dac: ad5504: sort headers alphabetically
Taha Ed-Dafili [Sat, 9 May 2026 14:20:40 +0000 (15:20 +0100)] 
iio: dac: ad5504: sort headers alphabetically

Rearrange the include headers in alphabetical order to follow the
standard kernel coding style. This is a preparatory cleanup with
no functional changes.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: chemical: bme680: use BME680_NUM_CHANNELS for scan buffer
Nikhil Gautam [Mon, 20 Apr 2026 08:24:36 +0000 (13:54 +0530)] 
iio: chemical: bme680: use BME680_NUM_CHANNELS for scan buffer

Use BME680_NUM_CHANNELS instead of the hardcoded channel count
in the scan buffer.

This avoids use of a magic number and improves code readability
and maintainability.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Nikhil Gautam <nikhilgtr@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: sun20i-gpadc: support non-contiguous channel lookups
Michal Piekos [Sat, 16 May 2026 05:48:37 +0000 (07:48 +0200)] 
iio: adc: sun20i-gpadc: support non-contiguous channel lookups

Using consumer driver like iio-hwmon which resolve channels through
io-channels phandles will fail for sparse channels because IIO core by
default treats phandle argument as index into channel array.
        eg. <&gpadc 1> will fail if there is only channel@1 specified

Add .fwnode_xlate() which maps DT phandle to the registered channel
whose chan->channel matches the hardware channel number. It allows
sparse channel maps to be consumed by drivers like iio-hwmon.

Tested on Radxa Cubie A5E.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: sun20i-gpadc: add A523 gpadc support
Michal Piekos [Sat, 16 May 2026 05:34:15 +0000 (07:34 +0200)] 
iio: adc: sun20i-gpadc: add A523 gpadc support

A523 differs from existing sun20i-gpadc-iio by having two clocks; bus
clock and module clock.

Change driver to enable all clocks.

Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agodt-bindings: iio: adc: Add GPADC for Allwinner A523
Michal Piekos [Sat, 16 May 2026 05:34:14 +0000 (07:34 +0200)] 
dt-bindings: iio: adc: Add GPADC for Allwinner A523

Add support for the GPADC for the Allwinner A523. It differs from the
D1/T113s/R329/T507 by having two clocks.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: light: veml6030: remove unnecessary read of IT index
Javier Carrasco [Thu, 14 May 2026 01:01:12 +0000 (14:01 +1300)] 
iio: light: veml6030: remove unnecessary read of IT index

This is dead code as the IT index is not used by gts to set the new scale.
In its current form, the value is read but not used afterward. Remove
the dead code.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: xilinx-ams: refactor alarm mapping to table-driven approach
Guilherme Ivo Bozi [Wed, 13 May 2026 00:31:52 +0000 (21:31 -0300)] 
iio: adc: xilinx-ams: refactor alarm mapping to table-driven approach

Replace multiple open-coded switch statements that map between
scan_index, alarm bits, and register offsets with a centralized
table-driven approach.

Introduce a struct-based alarm_map to describe the relationship
between scan indices and alarm offsets, and add a helper to
translate scan_index to event IDs. This removes duplicated logic
across ams_get_alarm_offset(), ams_event_to_channel(), and
ams_get_alarm_mask().

The new approach improves maintainability, reduces code size,
and makes it easier to extend or modify alarm mappings in the
future, while preserving existing behavior.

Signed-off-by: Guilherme Ivo Bozi <guilherme.bozi@usp.br>
Reviewed-by: Salih Erim <salih.erim@amd.com>
Tested-by: Salih Erim <salih.erim@amd.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: xilinx-ams: use guard(mutex) for automatic locking
Guilherme Ivo Bozi [Wed, 13 May 2026 00:31:51 +0000 (21:31 -0300)] 
iio: adc: xilinx-ams: use guard(mutex) for automatic locking

Replace open-coded mutex_lock()/mutex_unlock() pairs with
guard(mutex) to simplify locking and ensure proper unlock on
all control flow paths.

This removes explicit unlock handling, reduces boilerplate,
and avoids potential mistakes in error paths while keeping
the behavior unchanged.

Signed-off-by: Guilherme Ivo Bozi <guilherme.bozi@usp.br>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Salih Erim <salih.erim@amd.com>
Tested-by: Salih Erim <salih.erim@amd.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: xilinx-ams: fix out-of-bounds channel lookup in event handling
Guilherme Ivo Bozi [Wed, 13 May 2026 00:31:50 +0000 (21:31 -0300)] 
iio: adc: xilinx-ams: fix out-of-bounds channel lookup in event handling

ams_event_to_channel() may return a pointer past the end of
dev->channels when no matching scan_index is found. This can lead
to invalid memory access in ams_handle_event().

Add a bounds check in ams_event_to_channel() and return NULL when
no channel is found. Also guard the caller to safely handle this
case.

Fixes: d5c70627a794 ("iio: adc: Add Xilinx AMS driver")
Signed-off-by: Guilherme Ivo Bozi <guilherme.bozi@usp.br>
Reviewed-by: Salih Erim <salih.erim@amd.com>
Tested-by: Salih Erim <salih.erim@amd.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: light: opt3001: use macros from bits.h header
Joshua Crofts [Tue, 12 May 2026 10:57:23 +0000 (12:57 +0200)] 
iio: light: opt3001: use macros from bits.h header

Use GENMASK() and BIT() macros from bits.h header where it makes
sense. While at it, remove unused macro.

No functional change.

Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: light: opt3001: make headers conform to iwyu
Joshua Crofts [Tue, 12 May 2026 10:57:22 +0000 (12:57 +0200)] 
iio: light: opt3001: make headers conform to iwyu

Remove kernel.h proxy header, device.h, irq.h, slab.h as they are
unnecessary and add missing headers (array_size.h, dev_printk.h,
errno.h, jiffies.h, wait.h) to enforce IWYU principle and reduce
transitive dependencies. Also, replace bitops.h with bits.h as only
the BIT() macro is used.

Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: magnetometer: add driver for MEMSIC MMC5983MA
Vladislav Kulikov [Mon, 11 May 2026 19:11:35 +0000 (19:11 +0000)] 
iio: magnetometer: add driver for MEMSIC MMC5983MA

Add support for the MEMSIC MMC5983MA 3-axis magnetometer. The driver
provides raw magnetic field readings via IIO sysfs with SET/RESET
offset cancellation for each measurement.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Vladislav Kulikov <vlad.kulikov.c@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agodt-bindings: iio: magnetometer: add MEMSIC MMC5983MA
Vladislav Kulikov [Mon, 11 May 2026 19:11:34 +0000 (19:11 +0000)] 
dt-bindings: iio: magnetometer: add MEMSIC MMC5983MA

Add a Devicetree binding for the MEMSIC MMC5983MA 3-axis
magnetometer.

MMC5983MA is not register-compatible with the existing MEMSIC
magnetometer drivers. It has a different register map, 18-bit output
data format, and I2C/SPI transport support.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Vladislav Kulikov <vlad.kulikov.c@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoDocumentation: iio: make ADXL Y-axis calibbias description consistent
Stepan Ionichev [Wed, 13 May 2026 10:07:52 +0000 (15:07 +0500)] 
Documentation: iio: make ADXL Y-axis calibbias description consistent

The Y-axis calibbias rows in adxl345.rst, adxl313.rst and adxl380.rst
use a different wording than the matching X-axis and Z-axis rows in
the same tables: the X/Z rows say "Calibration offset for the
X/Z-axis accelerometer channel." while the Y row says "Y-axis (or
y-axis) acceleration offset correction".

Make the Y-axis row match the other two so each driver's sysfs
table has consistent capitalisation and wording.

Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoDocumentation: iio: fix typo in triggered-buffers example
Stepan Ionichev [Thu, 14 May 2026 08:51:57 +0000 (13:51 +0500)] 
Documentation: iio: fix typo in triggered-buffers example

In the "IIO triggered buffer setup" example, iio_triggered_buffer_setup()
is called with "sensor_iio_polfunc" (single 'l') while the function is
defined and later referenced as "sensor_iio_pollfunc" (double 'l'). Fix
the misspelling so the example is consistent.

Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: ad7192: fix GPOCON register access annotation
Stepan Ionichev [Wed, 13 May 2026 10:13:32 +0000 (15:13 +0500)] 
iio: adc: ad7192: fix GPOCON register access annotation

The comment next to AD7192_REG_GPOCON marks the register as RO,
but the AD7192 datasheet (Rev. A, page 24, GPOCON REGISTER) says:
"The GPOCON register is an 8-bit register from which data can be
read or to which data can be written."

The driver itself uses ad_sd_write_reg() against this register in
ad7192_show_scale() / write paths to control the bridge power-down
switch and digital outputs, which matches the RW datasheet
description. Update the comment to RW so it does not mislead
future readers.

Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: light: vcnl4000: use lock guard()
Raffael Raiel Trindade [Thu, 14 May 2026 20:11:49 +0000 (17:11 -0300)] 
iio: light: vcnl4000: use lock guard()

Use guard() and scoped_guard() for handling mutex lock instead of manually
locking and unlocking. Remove gotos in error handling logic. This prevents
forgotten locks on early exits.

Signed-off-by: Raffael Raiel Trindade <raffaelraiel@usp.br>
Co-developed-by: Kim Carvalho <kim.ca@usp.br>
Signed-off-by: Kim Carvalho <kim.ca@usp.br>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agodt-bindings: iio: chemical: sensirion,scd30: Update maintainers field
Maxwell Doose [Fri, 15 May 2026 01:16:39 +0000 (20:16 -0500)] 
dt-bindings: iio: chemical: sensirion,scd30: Update maintainers field

Tomasz Duszynski is no longer the maintainer of the SCD30 driver.
Replace his entry with mine.

Link: https://lore.kernel.org/linux-iio/20260507172404.80435-1-m32285159@gmail.com/
Signed-off-by: Maxwell Doose <m32285159@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: magnetometer: ak8975: fix potential kernel stack memory leak
Joshua Crofts [Fri, 15 May 2026 10:28:23 +0000 (12:28 +0200)] 
iio: magnetometer: ak8975: fix potential kernel stack memory leak

Currently in the AK8975 driver there are four instances where potential
uninitialized kernel stack memory leaks can occur. If
i2c_smbus_read_i2c_block_data_or_emulated() returns a value less than
the size of the buffer, uninitialized bytes are retained in the buffer
and later the buffer is passed on to IIO buffers, potentially leaking
memory to userspace.

Fix this by adding checks whether the return value of the function is
equal to the size of the buffer and subsequently if the value is
lesser than zero to distinguish from a returned error code.

Fixes: bc11ca4a0b84 ("iio:magnetometer:ak8975: triggered buffer support")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260513-ak8975-fix-v1-1-104ea605dd54%40gmail.com
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: magnetometer: ak8975: ensure device is awake for buffered capture
Joshua Crofts [Wed, 13 May 2026 14:35:52 +0000 (16:35 +0200)] 
iio: magnetometer: ak8975: ensure device is awake for buffered capture

Currently, the ak8975_start_read_axis() can be called while the device
is autosuspended, causing two issues:

1. I2C transfers in the aforementioned function will fail or timeout
because ak8975_runtime_suspend() disables the device regulators.
2. Since ak8975_fill_buffer() does not hold runtime references,
ak8975_runtime_suspend() can run concurrently, and since PM callbacks
do not use a locking mechanism, it may cause a race accessing the
control register via the I2C bus.

Fix this issue by adding struct iio_buffer_setup_ops that contains
preenable and postdisable functions to ensure correct that device is
powered on when running a buffered capture.

Fixes: bc11ca4a0b84 ("iio:magnetometer:ak8975: triggered buffer support")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260511-magnetometer-fixes-post-pickup-v7-0-9d910faa28b6%40gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agostaging: iio: addac: adt7316: document SPI interface switching sequence
Hungyu Lin [Mon, 11 May 2026 14:06:41 +0000 (14:06 +0000)] 
staging: iio: addac: adt7316: document SPI interface switching sequence

The device powers up in I2C mode. Switching to SPI mode
requires sending a sequence of SPI writes as described in
the datasheet.

During this sequence, the device may still be in I2C mode,
so SPI transactions may not be recognized and can fail.
Such errors are therefore ignored.

Add a comment to clarify this behavior.

Datasheet: https://www.analog.com/en/products/adt7316.html
Reviewed-by: Maxwell Doose <m32285159@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: magnetometer: ak8975: consistently use 'data' parameter
Andy Shevchenko [Mon, 11 May 2026 11:26:13 +0000 (13:26 +0200)] 
iio: magnetometer: ak8975: consistently use 'data' parameter

Some of the functions use 'client', some use 'data', and some use both.
Refactor the driver to consistently use 'data' in all cases.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: magnetometer: ak8975: check if gpiod read was successful
Joshua Crofts [Mon, 11 May 2026 11:26:11 +0000 (13:26 +0200)] 
iio: magnetometer: ak8975: check if gpiod read was successful

Add a check that ensures that valid data has been read from GPIOD. If
not, log an error and return the negative read value.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Maxwell Doose <m32285159@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: magnetometer: ak8975: modernize polling loops with iopoll() macros
Joshua Crofts [Mon, 11 May 2026 11:26:10 +0000 (13:26 +0200)] 
iio: magnetometer: ak8975: modernize polling loops with iopoll() macros

The driver currently uses while loops and msleep() for polling during
conversion waits.

Replace the custom polling loops with readx_poll_timeout() and
read_poll_timeout() macros from <linux/iopoll.h>. This reduces
boilerplate, standardizes timeout handling and improves overall code
readability, keeping the original timing and error behaviour. Add
<linux/time.h> for USEC_PER_MSEC macro instead of using magic numbers.

Assisted-by: Gemini:3.1-Pro
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoMAINTAINERS: Update maintainer for IIO drivers
Sanjay Chitroda [Mon, 11 May 2026 17:16:43 +0000 (22:46 +0530)] 
MAINTAINERS: Update maintainer for IIO drivers

The listed Analog Devices domain email for Cosmin Tanislav is no
longer valid, and he is no longer maintaining these IIO drivers.

Add Marcelo Schmitt as the maintainer from Analog Devices to continue
support and maintenance of the affected drivers.

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoMAINTAINERS: Update Analog Devices IIO drivers entry
Sanjay Chitroda [Mon, 11 May 2026 17:16:42 +0000 (22:46 +0530)] 
MAINTAINERS: Update Analog Devices IIO drivers entry

Lars-Peter Clausen is currently busy and is therefore removed from the
ANALOG DEVICES INC IIO DRIVERS entry, with input from Jonathan.

Add Analog Devices mailing list as contact and Nuno Sá as maintainer
for the ANALOG DEVICES INC IIO DRIVERS entry for coverage support.

Suggested-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Acked-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: Drop unused driver_data in four i2c drivers
Uwe Kleine-König (The Capable Hub) [Tue, 12 May 2026 12:50:34 +0000 (14:50 +0200)] 
iio: Drop unused driver_data in four i2c drivers

For the four drivers the .driver_data member of i2c_device_id is
write-only. Drop the explicit assignment.

While touching these arrays use a named initializer to assign the .name
member, which is easier to parse for a human.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agoiio: adc: hx711: move scale computation to per-device storage
Piyush Patle [Mon, 11 May 2026 17:43:30 +0000 (23:13 +0530)] 
iio: adc: hx711: move scale computation to per-device storage

The gain-to-scale table is global today, so probe-time scale updates for
one device overwrite the values used by any earlier device instance.

Fix this by making the gain table const and storing the computed scale
values per device in hx711_data.

No functional change for single-sensor configurations.

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
3 weeks agodt-bindings: iio: adc: hx711: clean up existing binding text
Piyush Patle [Mon, 11 May 2026 17:43:26 +0000 (23:13 +0530)] 
dt-bindings: iio: adc: hx711: clean up existing binding text

Rewrite the binding description and property text so it describes the
existing HX711 hardware behavior directly instead of documenting old
driver implementation details.

Also clarify that clock-frequency controls the SCK bit-bang timing.

No functional change.

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>