]> git.ipfire.org Git - thirdparty/kernel/linux.git/log
thirdparty/kernel/linux.git
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 weeks agodt-bindings: iio: adc: qcom,pm8018-adc: add label property for ADC channels
Antony Kurniawan Soemardi [Sun, 10 May 2026 07:01:33 +0000 (07:01 +0000)] 
dt-bindings: iio: adc: qcom,pm8018-adc: add label property for ADC channels

Add a new optional label property for ADC channels to help users
identify each channel when reading values from the sysfs interface.

Signed-off-by: Antony Kurniawan Soemardi <linux@smankusors.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: adc: qcom-pm8xxx-xoadc: add support for reading channel labels
Antony Kurniawan Soemardi [Sun, 10 May 2026 07:01:45 +0000 (07:01 +0000)] 
iio: adc: qcom-pm8xxx-xoadc: add support for reading channel labels

Implement the .read_label callback to allow userspace to identify ADC
channels via the "label" property in the device tree. The name field in
pm8xxx_chan_info is renamed to label to better reflect its purpose. If
no label is provided in the device tree, it defaults to the hardware
datasheet name.

The change has been tested on Sony Xperia SP (PM8921).

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Antony Kurniawan Soemardi <linux@smankusors.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: adc: qcom-pm8xxx-xoadc: remove redundant error logs when reading values
Antony Kurniawan Soemardi [Sun, 10 May 2026 07:01:41 +0000 (07:01 +0000)] 
iio: adc: qcom-pm8xxx-xoadc: remove redundant error logs when reading values

Drop dev_err() logging for -EINVAL and -ETIMEDOUT cases and rely on
return values to report errors, reducing unnecessary log noise.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Antony Kurniawan Soemardi <linux@smankusors.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: accel: adxl355: replace usleep_range() with fsleep()
Stepan Ionichev [Sun, 10 May 2026 11:38:52 +0000 (16:38 +0500)] 
iio: accel: adxl355: replace usleep_range() with fsleep()

The "at least 5ms" wait after software reset has no specific upper
bound. Use fsleep() with 5 * USEC_PER_MSEC to make the unit
explicit at the call site.

No functional change.

Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: adc: ad7192: replace usleep_range() with fsleep()
Stepan Ionichev [Mon, 11 May 2026 02:55:44 +0000 (07:55 +0500)] 
iio: adc: ad7192: replace usleep_range() with fsleep()

The AD7192 datasheet (Rev. A, page 34, RESET section) says:
"When a reset is initiated, the user must allow a period of
500 us before accessing any of the on-chip registers."

Use fsleep(500) instead of usleep_range(500, 1000).

Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: adc: ti-ads1298: Remove unnecessary CONFIG2 write during init
Md Shofiqul Islam [Sat, 9 May 2026 15:19:59 +0000 (18:19 +0300)] 
iio: adc: ti-ads1298: Remove unnecessary CONFIG2 write during init

The driver was enabling the internal test signal (INT_TEST), double
amplitude (TEST_AMP), and fast frequency (TEST_FREQ_FAST) bits in
CONFIG2 during initialization. These bits activate an internal square
wave generator intended for device testing and calibration, not normal
ECG operation.

CONFIG2 defaults to having only the RESERVED bit set after reset, which
is the correct value for normal operation. Remove the write entirely
since it would just be writing the reset default value.

Suggested-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Md Shofiqul Islam <shofiqtest@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: adc: ti-ads1298: Add parentheses around macro parameter
Md Shofiqul Islam [Sat, 9 May 2026 15:19:57 +0000 (18:19 +0300)] 
iio: adc: ti-ads1298: Add parentheses around macro parameter

ADS1298_REG_CHnSET() is missing parentheses around the parameter 'n'.
Add them to follow kernel macro coding style and prevent potential
operator precedence issues if the argument is an expression.

Signed-off-by: Md Shofiqul Islam <shofiqtest@gmail.com>
Reviewed-by: Stepan Ionichev <sozdayvek@gmail.com>
Acked-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: adc: ti-ads1298: Fix incorrect timeout comment
Md Shofiqul Islam [Sun, 10 May 2026 19:34:35 +0000 (22:34 +0300)] 
iio: adc: ti-ads1298: Fix incorrect timeout comment

At the lowest supported data rate of 250Hz, one conversion period is
4ms, not 40ms. The 50ms timeout is deliberately conservative to allow
for kernel scheduling latency, which can be significant under load or
on slow machines.

Fix the comment to state the correct conversion time, use "lowest sample
rate" for clarity, and explain that the extra margin exists to absorb
scheduling latency so that no one is tempted to shrink the timeout to
match the conversion period.

Also drop the redundant ret variable assignment by using the return value
of wait_for_completion_timeout() directly in the if() condition.

Signed-off-by: Md Shofiqul Islam <shofiqtest@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: frequency: adrf6780: replace usleep_range() with fsleep()
Stepan Ionichev [Mon, 11 May 2026 05:44:41 +0000 (10:44 +0500)] 
iio: frequency: adrf6780: replace usleep_range() with fsleep()

The ADRF6780 datasheet (Rev. D, page 23, ADC section) says:
"Wait approximately 200 us for the ADC to be ready."

fsleep(200) expands to the same usleep_range(200, 250). Use the
flexible sleep helper, which picks the right primitive for the
given microsecond delay.

Replace the generic "Recommended delay for the ADC to be ready"
comment with the datasheet reference so the "why" of the wait is
visible at the call site.

No functional change.

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>
5 weeks agoiio: adc: ad7793: replace usleep_range() with fsleep()
Stepan Ionichev [Mon, 11 May 2026 05:30:43 +0000 (10:30 +0500)] 
iio: adc: ad7793: replace usleep_range() with fsleep()

The AD7792/AD7793 datasheet (Rev. B, page 25, RESET section)
says: "When a reset is initiated, the user must allow a period
of 500 us before accessing any of the on-chip registers."

Use fsleep(500) instead of usleep_range(500, 2000). The 500 us
minimum stays the same; fsleep() picks the upper slack itself
(about +25% on a default config -- narrower than the original
2000 us).

Add a code comment with the datasheet reference so the "why"
of the wait is visible at the call site.

Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: chemical: scd30: reject (response=NULL, size>0) in scd30_i2c_command()
Stepan Ionichev [Thu, 7 May 2026 15:28:00 +0000 (20:28 +0500)] 
iio: chemical: scd30: reject (response=NULL, size>0) in scd30_i2c_command()

scd30_i2c_command() takes an opaque "response" buffer plus its size.
At the start of the function the code already checks if response is
NULL (via the rsp local), but the response-decoding loop after the
i2c transfer always dereferences rsp without re-checking. With the
current callers in scd30_core.c this is harmless, since write
commands pass response=NULL together with size=0 (so the loop body
is never entered).

The (response=NULL, size>0) combination has no useful meaning: there
is nowhere to put the bytes that come back from the chip. Treat it
as an invalid argument and bail out at the top of the function with
-EINVAL, instead of silently doing the i2c transfer and dereferencing
a NULL pointer in the decode loop.

smatch flagged the inconsistency:

  drivers/iio/chemical/scd30_i2c.c:104 scd30_i2c_command() error: we
    previously assumed rsp could be null (see line 77)

No functional change for the existing callers, which only ever use
(response=NULL, size=0) for writes and (response!=NULL, size>0) for
reads.

Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Acked-by: Maxwell Doose <m32285159@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: chemical: scd30: make command lookup table const
Giorgi Tchankvetadze [Fri, 8 May 2026 13:39:17 +0000 (17:39 +0400)] 
iio: chemical: scd30: make command lookup table const

scd30_i2c_cmd_lookup_tbl contains fixed opcodes and is
only read by scd30_i2c_command(). Make it const to document that it's immutable
and allow it to be placed in read-only memory.

Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
Reviewed-by: Stepan Ionichev <sozdayvek@gmail.com>
Acked-by: Maxwell Doose <m32285159@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: yamaha-yas530: replace usleep_range() with fsleep()
Andy Shevchenko [Fri, 8 May 2026 06:08:35 +0000 (08:08 +0200)] 
iio: magnetometer: yamaha-yas530: replace usleep_range() with fsleep()

Replace usleep_range() with fsleep() to allow the kernel
to select the most appropriate delay mechanism based on duration.
Using USEC_PER_MSEC makes the unit conversion explicit.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: yamaha-yas530: Use devm_mutex_init() for mutex initialization
Andy Shevchenko [Fri, 8 May 2026 06:08:34 +0000 (08:08 +0200)] 
iio: magnetometer: yamaha-yas530: Use devm_mutex_init() for mutex initialization

Use devm_mutex_init() since it brings some benefits when
CONFIG_DEBUG_MUTEXES is enabled.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: yamaha-yas530: Get rid of i2c_client_get_device_id()
Andy Shevchenko [Fri, 8 May 2026 06:08:33 +0000 (08:08 +0200)] 
iio: magnetometer: yamaha-yas530: Get rid of i2c_client_get_device_id()

Instead of relying on the name from ID table, which might be ambiguous
in some cases, use explicit product label in the driver data. With that
being done, get rid of i2c_client_get_device_id() call.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoMAINTAINERS: Add myself as SCD30 maintainer
Maxwell Doose [Thu, 7 May 2026 17:24:04 +0000 (12:24 -0500)] 
MAINTAINERS: Add myself as SCD30 maintainer

The current maintainer's email is no longer valid and the driver is
being orphaned. Replace his entry with mine, as I am volunteering to
take over.

Link: https://lore.kernel.org/linux-iio/20260507170950.37a46820@jic23-huawei/T/#t
Signed-off-by: Maxwell Doose <m32285159@gmail.com>
Reviewed-by: Stepan Ionichev <sozdayvek@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: adc: ingenic-adc: use guard()() and scoped_guard() to handle synchronisation
Felipe Ribeiro de Souza [Wed, 6 May 2026 02:24:30 +0000 (23:24 -0300)] 
iio: adc: ingenic-adc: use guard()() and scoped_guard() to handle synchronisation

Replace mutex_lock() and mutex_unlock() calls with guard()() in
functions ingenic_adc_set_adcmd(), ingenic_adc_set_config(),
ingenic_adc_enable(), ingenic_adc_capture(), and with scoped_guard()
in function ingenic_adc_read_chan_info_raw().

This removes the need to call the unlock function, as the lock is
automatically released when the function return or the scope exits
for any other case.

Signed-off-by: Felipe Ribeiro de Souza <felipers@ime.usp.br>
Co-developed-by: Lucas Ivars Cadima Ciziks <lucas@ciziks.com>
Signed-off-by: Lucas Ivars Cadima Ciziks <lucas@ciziks.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: adc: ingenic-adc: refactor ingenic_adc_read_chan_info_raw()
Felipe Ribeiro de Souza [Wed, 6 May 2026 02:24:29 +0000 (23:24 -0300)] 
iio: adc: ingenic-adc: refactor ingenic_adc_read_chan_info_raw()

Extract the sample logic from ingenic_adc_read_chan_info_raw() into
a new helper function __ingenic_adc_read_chan() to improve code
readability and modularity.

The helper handles the mutex-protected section for sampling channels,
while the main function manages mutex and clock enabling/disabling.

Signed-off-by: Felipe Ribeiro de Souza <felipers@ime.usp.br>
Co-developed-by: Lucas Ivars Cadima Ciziks <lucas@ciziks.com>
Signed-off-by: Lucas Ivars Cadima Ciziks <lucas@ciziks.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: adc: ingenic-adc: rename ingenic_adc_enable_unlocked() function
Felipe Ribeiro de Souza [Wed, 6 May 2026 02:24:28 +0000 (23:24 -0300)] 
iio: adc: ingenic-adc: rename ingenic_adc_enable_unlocked() function

Rename ingenic_adc_enable_unlocked() to __ingenic_adc_enable() to
better reflect that this helper must be called with the lock held.

Signed-off-by: Felipe Ribeiro de Souza <felipers@ime.usp.br>
Co-developed-by: Lucas Ivars Cadima Ciziks <lucas@ciziks.com>
Signed-off-by: Lucas Ivars Cadima Ciziks <lucas@ciziks.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: ak8975: unify return code variable name
Andy Shevchenko [Tue, 5 May 2026 11:46:09 +0000 (13:46 +0200)] 
iio: magnetometer: ak8975: unify return code variable name

In one case 'rc' is used in the other 'err', the most use 'ret'.
Make the latter use the former, id est 'ret'.

While at it, drop unneeded ' < 0' checks.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: ak8975: reduce usage of magic lengths of the buffer
Andy Shevchenko [Tue, 5 May 2026 11:46:08 +0000 (13:46 +0200)] 
iio: magnetometer: ak8975: reduce usage of magic lengths of the buffer

Reduce usage of magic lengths of the supplied buffer by replacing them
with the corresponding sizeof():s.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: ak8975: remove duplicate error message
Andy Shevchenko [Tue, 5 May 2026 11:46:07 +0000 (13:46 +0200)] 
iio: magnetometer: ak8975: remove duplicate error message

The devm_request_irq() already prints an error message.
Remove the duplicate.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: ak8975: drop duplicate NULL check
Andy Shevchenko [Tue, 5 May 2026 11:46:06 +0000 (13:46 +0200)] 
iio: magnetometer: ak8975: drop duplicate NULL check

The gpiod_set_consumer_name() is NULL-aware, no need to perform the same
check in the caller.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: ak8975: avoid using temporary variable
Andy Shevchenko [Tue, 5 May 2026 11:46:05 +0000 (13:46 +0200)] 
iio: magnetometer: ak8975: avoid using temporary variable

Avoid using temporary variable in ak8975_read_axis(). With that being done,
the clamp_t() call becomes idiomatic in the driver and can be factored out
to a helper later on (and if needed).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: ak8975: pass conversion timeouts as arguments
Joshua Crofts [Tue, 5 May 2026 11:46:02 +0000 (13:46 +0200)] 
iio: magnetometer: ak8975: pass conversion timeouts as arguments

Refactor wait_conversion_complete*_() helper function to accept poll
and timeout values directly as parameters. This improves the
readability of the code and does not rely on hardcoded macros.

Besides that, fix the home grown and obviously wrong in some cases the
jiffy-based timeout.

Co-developed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: ak8975: fix wrong errno on return
Joshua Crofts [Tue, 5 May 2026 11:46:01 +0000 (13:46 +0200)] 
iio: magnetometer: ak8975: fix wrong errno on return

The driver currently returns -EINVAL on polling timeout instead of
-ETIMEDOUT.

Replace return code for -ETIMEDOUT and remove unnecessary error
message as -ETIMEDOUT is a standard POSIX error. Also replace
instances of -EINVAL in comments.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: ak8975: change 'u8*' to 'u8 *' in cast
Joshua Crofts [Tue, 5 May 2026 11:46:00 +0000 (13:46 +0200)] 
iio: magnetometer: ak8975: change 'u8*' to 'u8 *' in cast

Change 'u8*' cast to 'u8 *' as the former triggers a checkpatch error.
Also fix the indentation of parameters in
i2c_smbus_read_i2c_block_data_or_emulated() function.

No functional change.

Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Maxwell Doose <m32285159@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: ak8975: replace usleep_range() with fsleep()
Joshua Crofts [Tue, 5 May 2026 11:45:59 +0000 (13:45 +0200)] 
iio: magnetometer: ak8975: replace usleep_range() with fsleep()

Replace usleep_range() calls with fsleep(), passing the minimum value
required by the sensor for hardware delays.

fsleep() automatically selects the optimal sleep mechanism, simplifying
driver code and time management.

Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5 weeks agoiio: magnetometer: ak8975: update headers per IWYU principle
Joshua Crofts [Tue, 5 May 2026 11:45:58 +0000 (13:45 +0200)] 
iio: magnetometer: ak8975: update headers per IWYU principle

Remove kernel.h proxy header and unused headers (slab.h, iio/sysfs.h,
iio/trigger.h). Add missing headers to ensure atomicity (array_size.h,
dev_printk.h, asm/byteorder.h, irqreturn.h, minmax.h, property.h,
types.h, wait.h).

Audited using the include-what-you-use tool.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.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>
5 weeks agoiio: magnetometer: ak8975: sort headers alphabetically
Joshua Crofts [Tue, 5 May 2026 11:45:57 +0000 (13:45 +0200)] 
iio: magnetometer: ak8975: sort headers alphabetically

Sort include headers alphabetically to improve coding style and
readability.

No functional change.

Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Maxwell Doose <m32285159@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>