]> git.ipfire.org Git - thirdparty/kernel/linux.git/log
thirdparty/kernel/linux.git
2 months agoiio: adc: ti_am335x_adc: Limit step_avg to valid range for gcc complains
Pei Xiao [Tue, 14 Oct 2025 09:12:50 +0000 (17:12 +0800)] 
iio: adc: ti_am335x_adc: Limit step_avg to valid range for gcc complains

FIELD_PREP() checks that a value fits into the available bitfield, add a
check for step_avg to fix gcc complains.

which gcc complains about:
  drivers/iio/adc/ti_am335x_adc.c: In function 'tiadc_step_config':
  include/linux/compiler_types.h:572:38: error: call to
'__compiletime_assert_491' declared with attribute error: FIELD_PREP: value
too large for the field include/linux/mfd/ti_am335x_tscadc.h:58:29: note:
in expansion of macro 'FIELD_PREP'
    #define STEPCONFIG_AVG(val) FIELD_PREP(GENMASK(4, 2), (val))
                                ^~~~~~~~~~
drivers/iio/adc/ti_am335x_adc.c:127:17: note: in expansion of macro 'STEPCONFIG_AVG'
stepconfig = STEPCONFIG_AVG(ffs(adc_dev->step_avg[i]) - 1)

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202510102117.Jqxrw1vF-lkp@intel.com/
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma400: Add detail to comments in GEN INTR configuration
Akshay Jindal [Sun, 12 Oct 2025 18:06:13 +0000 (23:36 +0530)] 
iio: accel: bma400: Add detail to comments in GEN INTR configuration

Append additional information to existing comments in the generic
interrupt configuration code to provide more context.

Signed-off-by: Akshay Jindal <akshayaj.lkd@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma400: Rename activity_event_en() to generic_event_en()
Akshay Jindal [Sun, 12 Oct 2025 18:06:12 +0000 (23:36 +0530)] 
iio: accel: bma400: Rename activity_event_en() to generic_event_en()

The function activity_event_en() configures the generic interrupts
GEN1 and GEN2, which are used for activity and inactivity detection
as per the datasheet. The existing name is misleading, since the
device also provides activity change and activity recognition
interrupts. Activity change interrupt is not supported yet whereas
Activity recognition interrupt is configured in a different function.

Rename activity_event_en() to generic_event_en() to better reflect its
actual purpose.

No functional changes intended.

Signed-off-by: Akshay Jindal <akshayaj.lkd@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma400: Replace bit shifts with FIELD_PREP() and FIELD_GET()
Akshay Jindal [Sun, 12 Oct 2025 18:06:11 +0000 (23:36 +0530)] 
iio: accel: bma400: Replace bit shifts with FIELD_PREP() and FIELD_GET()

set_* functions involve left shift of param values into respective
register fields before writing to register. Similarly get_* functions
involve right shift to extract values from the respective bit fields.
Replace these explicit shifting statements with standard kernel style
macros FIELD_GET() and FIELD_PREP().

Signed-off-by: Akshay Jindal <akshayaj.lkd@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma400: Use index-based register addressing and lookup
Akshay Jindal [Sun, 12 Oct 2025 18:06:10 +0000 (23:36 +0530)] 
iio: accel: bma400: Use index-based register addressing and lookup

Introduce formula-based macros to compute GEN INTR configuration register
addresses from the interrupt number and register index. This reduces the
need for 22 explicit register macros to three base definitions.

Add a centralized lookup table keyed by IIO event direction and replace
get_gen_config_reg() with a helper integrated with this table.

Apply these changes across the affected callbacks to ensure consistent
access to generic interrupt registers.

No functional changes are intended.

Signed-off-by: Akshay Jindal <akshayaj.lkd@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma400: Use macros for generic event configuration values
Akshay Jindal [Sun, 12 Oct 2025 18:06:09 +0000 (23:36 +0530)] 
iio: accel: bma400: Use macros for generic event configuration values

Add macros and enums for configuration values used in generic event
handling for activity and inactivity detection. Replace hard-coded
values in activity_event_en() with the new definitions to make the
configuration explicit.

No functional changes are intended.

Signed-off-by: Akshay Jindal <akshayaj.lkd@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma400: Reorganize and rename register and field macros
Akshay Jindal [Sun, 12 Oct 2025 18:06:08 +0000 (23:36 +0530)] 
iio: accel: bma400: Reorganize and rename register and field macros

Reorganize register and field macros to improve consistency with the
datasheet and naming style:

- Move field macros next to their corresponding register macros
- Reorder register macros to follow address order from the datasheet
- Rename field macros to include the register name in the macro name
- Add a _REG suffix to register macros where missing
- Add INT_STAT register fields corresponding to used INT_CONFIG fields

No functional changes are intended.

Signed-off-by: Akshay Jindal <akshayaj.lkd@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: health: max30100: Make LED pulse-width configurable via DT
Shrikant Raskar [Sun, 12 Oct 2025 17:30:35 +0000 (23:00 +0530)] 
iio: health: max30100: Make LED pulse-width configurable via DT

The required LED pulse width depends on board-specific optical and
mechanical design, which affects measurement accuracy and power use.
Making it configurable via Device Tree allows each platform to define
an appropriate value instead of relying on a hardcoded default.

If unspecified, the driver defaults to 1600 us for backward compatibility.

Tested on: Raspberry Pi 3B + MAX30100 breakout board.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Shrikant Raskar <raskar.shree97@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agodt-bindings: iio: health: max30100: Add LED pulse-width property
Shrikant Raskar [Sun, 12 Oct 2025 17:30:34 +0000 (23:00 +0530)] 
dt-bindings: iio: health: max30100: Add LED pulse-width property

The LED pulse width on the MAX30100 sensor determines how long the
IR/Red LEDs are driven during each sample, directly affecting the
emitted optical energy and hence the received signal amplitude.

This parameter is highly dependent on the mechanical and optical
integration of the sensor, such as:
- The type and thickness of the optical window or lens covering
  the sensor.
- The distance between the LED and photodiode.
- The reflectivity of the target surface.

For example:
- A smartwatch or wearable ring with a thin glass window can operate
  with shorter pulses (200-400 us) to save power.
- A medical-grade pulse oximeter or sensor mounted behind a thicker
  protective layer may require longer pulses (800-1600 us) for
  reliable signal amplitude.

Because this configuration is determined by hardware design rather than
by runtime conditions, it is appropriate to describe it in the DT.

If not specified, the driver defaults to 1600 us to maintain
existing behavior.

Tested on: Raspberry Pi 3B + MAX30100 breakout board.

Signed-off-by: Shrikant Raskar <raskar.shree97@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agodt-bindings: iio: accel: adxl345: document second interrupt
Wolfram Sang [Sat, 11 Oct 2025 20:59:09 +0000 (22:59 +0200)] 
dt-bindings: iio: accel: adxl345: document second interrupt

The pinout of all the supported chips in this binding have two interrupt
pins. Document the second one, too, even though the Linux driver
currently does not support the second interrupt. Boards may have it
wired nonetheless. While here, drop the dependency of interrupt-names
which is already described in the core.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ti-ads131e08: return correct error code
Dixit Parmar [Sat, 11 Oct 2025 08:11:49 +0000 (13:41 +0530)] 
iio: adc: ti-ads131e08: return correct error code

The error code returned from devm_iio_trigger_register() inturn
iio_trigger_register() can be other than -ENOMEM. Hence return the
same value as it was returned from the function call.
This change makes devm_iio_trigger_register() handling uniform with
other iio drivers.

Signed-off-by: Dixit Parmar <dixitparmar19@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad4080: add support for AD4081
Antoniu Miclaus [Tue, 7 Oct 2025 11:15:25 +0000 (11:15 +0000)] 
iio: adc: ad4080: add support for AD4081

Add support for AD4081 20-bit SAR ADC. The AD4081 has the same
resolution as AD4080 (20-bit) but differs in LVDS CNV clock count
maximum (2 vs 7).

Changes:
- Add AD4081_CHIP_ID definition (0x0051)
- Create ad4081_channel with 20-bit resolution and 32-bit storage
- Add ad4081_chip_info with lvds_cnv_clk_cnt_max = 2
- Register AD4081 in device ID and OF match tables

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agodt-bindings: iio: adc: adi,ad4080: add support for AD4081
Antoniu Miclaus [Tue, 7 Oct 2025 11:15:24 +0000 (11:15 +0000)] 
dt-bindings: iio: adc: adi,ad4080: add support for AD4081

Add device tree binding support for the AD4081 20-bit SAR ADC.
Add adi,ad4081 to the compatible enum.

A fallback compatible string to adi,ad4080 is not appropriate as the
AD4081 has a different LVDS CNV clock count maximum (2 vs 7), requiring
different driver configuration.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad4080: add support for AD4084
Antoniu Miclaus [Tue, 7 Oct 2025 11:15:23 +0000 (11:15 +0000)] 
iio: adc: ad4080: add support for AD4084

Add support for AD4084 16-bit SAR ADC. The AD4084 differs from
AD4080 in resolution (16-bit vs 20-bit) and LVDS CNV clock count
maximum (2 vs 7).

Changes:
- Add AD4084_CHIP_ID definition (0x0054)
- Create ad4084_channel with 16-bit resolution and storage
- Add ad4084_chip_info with appropriate configuration
- Register AD4084 in device ID and OF match tables

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agodt-bindings: iio: adc: adi,ad4080: add support for AD4084
Antoniu Miclaus [Tue, 7 Oct 2025 11:15:22 +0000 (11:15 +0000)] 
dt-bindings: iio: adc: adi,ad4080: add support for AD4084

Add device tree binding support for the AD4084 16-bit SAR ADC.
Add adi,ad4084 to the compatible enum.

A fallback compatible string to adi,ad4080 is not appropriate as the
AD4084 has different resolution (16-bit vs 20-bit) and LVDS CNV clock
count maximum (2 vs 7), requiring different driver configuration.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad4080: prepare driver for multi-part support
Antoniu Miclaus [Tue, 7 Oct 2025 11:15:21 +0000 (11:15 +0000)] 
iio: adc: ad4080: prepare driver for multi-part support

Refactor the ad4080 driver to support multiple ADC variants with
different resolution bits and LVDS CNV clock count maximums.

Changes:
- Add lvds_cnv_clk_cnt_max field to chip_info structure
- Create AD4080_CHANNEL_DEFINE macro for variable resolution/storage bits
- Make LVDS CNV clock count configurable per chip variant
- Use chip_info->product_id for chip identification comparison

This prepares the infrastructure for adding support for additional
ADC parts with different specifications while maintaining backward
compatibility with existing AD4080 functionality.

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad4080: fix chip identification
Antoniu Miclaus [Tue, 7 Oct 2025 11:15:20 +0000 (11:15 +0000)] 
iio: adc: ad4080: fix chip identification

Fix AD4080 chip identification by using the correct 16-bit product ID
(0x0050) instead of GENMASK(2, 0). Update the chip reading logic to
use regmap_bulk_read to read both PRODUCT_ID_L and PRODUCT_ID_H
registers and combine them into a 16-bit value.

The original implementation was incorrectly reading only 3 bits,
which would not correctly identify the AD4080 chip.

Fixes: 6b31ba1811b6 ("iio: adc: ad4080: add driver support")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoMAINTAINERS: add entry for inv_icm45600 6-axis imu sensor
Remi Buisson [Tue, 7 Oct 2025 07:20:10 +0000 (07:20 +0000)] 
MAINTAINERS: add entry for inv_icm45600 6-axis imu sensor

Add MAINTAINERS entry for InvenSense ICM-45600 IMU device.

Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: imu: inv_icm45600: add I3C driver for inv_icm45600 driver
Remi Buisson [Tue, 7 Oct 2025 07:20:09 +0000 (07:20 +0000)] 
iio: imu: inv_icm45600: add I3C driver for inv_icm45600 driver

Add I3C driver for InvenSense ICM-45600 devices.

Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: imu: inv_icm45600: add SPI driver for inv_icm45600 driver
Remi Buisson [Tue, 7 Oct 2025 07:20:08 +0000 (07:20 +0000)] 
iio: imu: inv_icm45600: add SPI driver for inv_icm45600 driver

Add SPI driver for InvenSense ICM-456000 devices.

Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: imu: inv_icm45600: add I2C driver for inv_icm45600 driver
Remi Buisson [Tue, 7 Oct 2025 07:20:07 +0000 (07:20 +0000)] 
iio: imu: inv_icm45600: add I2C driver for inv_icm45600 driver

Add I2C driver for InvenSense ICM-456000 devices.

Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: imu: inv_icm45600: add IMU IIO accelerometer device
Remi Buisson [Tue, 7 Oct 2025 07:20:06 +0000 (07:20 +0000)] 
iio: imu: inv_icm45600: add IMU IIO accelerometer device

Add IIO device for accelerometer sensor
with data polling interface and FIFO parsing.
Attributes: raw, scale, sampling_frequency, calibbias.
Temperature is available as a processed channel.

Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: imu: inv_icm45600: add IMU IIO gyroscope device
Remi Buisson [Tue, 7 Oct 2025 07:20:05 +0000 (07:20 +0000)] 
iio: imu: inv_icm45600: add IMU IIO gyroscope device

Add IIO device for gyroscope sensor
with data polling interface and FIFO parsing.
Attributes: raw, scale, sampling_frequency, calibbias.
Temperature is available as a processed channel.

Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: imu: inv_icm45600: add buffer support in iio devices
Remi Buisson [Tue, 7 Oct 2025 07:20:04 +0000 (07:20 +0000)] 
iio: imu: inv_icm45600: add buffer support in iio devices

Add FIFO control functions.
Support hwfifo watermark by multiplexing gyro and accel settings.
Support hwfifo flush.

Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: imu: inv_icm45600: add new inv_icm45600 driver
Remi Buisson [Tue, 7 Oct 2025 07:20:03 +0000 (07:20 +0000)] 
iio: imu: inv_icm45600: add new inv_icm45600 driver

Core component of a new driver for InvenSense ICM-45600 devices.
It includes registers definition, main probe/setup, and device
utility functions.

ICM-456xx devices are latest generation of 6-axis IMU,
gyroscope+accelerometer and temperature sensor. This device
includes a 8K FIFO, supports I2C/I3C/SPI, and provides
intelligent motion features like pedometer, tilt detection,
and tap detection.

Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agodt-bindings: iio: imu: Add inv_icm45600
Remi Buisson [Tue, 7 Oct 2025 07:20:02 +0000 (07:20 +0000)] 
dt-bindings: iio: imu: Add inv_icm45600

Document the ICM-45600 devices devicetree bindings.
Specific variants of the device are defined because of their
differences in terms of FSR or advanced features like eDMP.

Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agodt-bindings: iio: Add Infineon DPS310 sensor documentation
Eddie James [Tue, 7 Oct 2025 19:16:12 +0000 (14:16 -0500)] 
dt-bindings: iio: Add Infineon DPS310 sensor documentation

The DPS310 is a barometric pressure and temperature sensor with
an I2C interface. Remove it from trivial-devices.yaml and add its
own documentation to allow for consumers of this device such as
the iio/hwmon bridge.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: add maintainer
Petre Rodan [Sun, 5 Oct 2025 13:12:28 +0000 (16:12 +0300)] 
iio: accel: bma220: add maintainer

Add maintainer for this driver.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: add debugfs reg access
Petre Rodan [Sun, 5 Oct 2025 13:12:27 +0000 (16:12 +0300)] 
iio: accel: bma220: add debugfs reg access

Allow read/write access to sensor registers for use in unit-tests.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: add LPF cut-off frequency mapping
Petre Rodan [Sun, 5 Oct 2025 13:12:26 +0000 (16:12 +0300)] 
iio: accel: bma220: add LPF cut-off frequency mapping

Add mapping for the low pass filter cut-off frequency.
Make valid values visible for both the cut-off frequency and the scale.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: add interrupt trigger
Petre Rodan [Sun, 5 Oct 2025 13:12:25 +0000 (16:12 +0300)] 
iio: accel: bma220: add interrupt trigger

Add interrupt trigger.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: add i2c watchdog feature
Petre Rodan [Sun, 5 Oct 2025 13:12:24 +0000 (16:12 +0300)] 
iio: accel: bma220: add i2c watchdog feature

Sometimes the sensor gets stuck and enters a condition in which it pulls
SDA low, thus making the entire i2c bus unusable.
This problem is mitigated by activating a 1ms watchdog implemented in
the sensor.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: add i2c module
Petre Rodan [Sun, 5 Oct 2025 13:12:23 +0000 (16:12 +0300)] 
iio: accel: bma220: add i2c module

Add the bma220_i2c module.

Note that this kernel module transparently shifts all register addresses
1 bit to the left, so all functions will operate based on the SPI memory
map.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: use find_match_table fct
Petre Rodan [Sun, 5 Oct 2025 13:12:22 +0000 (16:12 +0300)] 
iio: accel: bma220: use find_match_table fct

Clean up the code a bit by using a find_match_table function.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: populate buffer ts in trigger handler
Petre Rodan [Sun, 5 Oct 2025 13:12:21 +0000 (16:12 +0300)] 
iio: accel: bma220: populate buffer ts in trigger handler

Populate buffer timestamps in trigger handler since not all
triggers can run the top half handler that provides
pf->timestamp.

Fixes failing unit test that triggers based on the INT signal.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: migrate to regmap API
Petre Rodan [Sun, 5 Oct 2025 13:12:20 +0000 (16:12 +0300)] 
iio: accel: bma220: migrate to regmap API

Switch to regmap API.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: reset registers during init stage
Petre Rodan [Sun, 5 Oct 2025 13:12:19 +0000 (16:12 +0300)] 
iio: accel: bma220: reset registers during init stage

Bring all configuration registers to default values during
device probe().
Remove trivial code duplication regarding bma220_power() in
_init()

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: turn power supplies on
Petre Rodan [Sun, 5 Oct 2025 13:12:18 +0000 (16:12 +0300)] 
iio: accel: bma220: turn power supplies on

Add devm_regulator_bulk_get_enable() to device probe().

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: add open firmware table
Petre Rodan [Sun, 5 Oct 2025 13:12:17 +0000 (16:12 +0300)] 
iio: accel: bma220: add open firmware table

Add open firmware entry to the spi driver.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: split original driver
Petre Rodan [Sun, 5 Oct 2025 13:12:16 +0000 (16:12 +0300)] 
iio: accel: bma220: split original driver

In preparation for the i2c module, move the original code into multiple
source files without any other functional change.

Create the additional bma220_core module which currently is not
providing an abstracted bus type (this will change with the regmap
patch).
Fix a few includes in the context of this patch.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: cleanup includes
Petre Rodan [Sun, 5 Oct 2025 13:12:15 +0000 (16:12 +0300)] 
iio: accel: bma220: cleanup includes

Tweak includes based on requirements.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> #added linux/errno.h
2 months agoiio: accel: bma220: move bma220_power function
Petre Rodan [Sun, 5 Oct 2025 13:12:14 +0000 (16:12 +0300)] 
iio: accel: bma220: move bma220_power function

Move bma220_power() before bma220_init() as a precursor to a
patch that removes code duplication.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: shorten spi->dev calls
Petre Rodan [Sun, 5 Oct 2025 13:12:13 +0000 (16:12 +0300)] 
iio: accel: bma220: shorten spi->dev calls

Provide functions easier access to device struct.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: cleanup license string
Petre Rodan [Sun, 5 Oct 2025 13:12:12 +0000 (16:12 +0300)] 
iio: accel: bma220: cleanup license string

Fix checkpatch warning about use of "GPL v2" license:

Prefer "GPL" over "GPL v2" - see commit bf7fbeeae6db
("module: Cure the MODULE_LICENSE "GPL" vs. "GPL v2" bogosity")

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: relax constraints during probe()
Petre Rodan [Sun, 5 Oct 2025 13:12:11 +0000 (16:12 +0300)] 
iio: accel: bma220: relax constraints during probe()

Do not return error if the chip id being read is not the expected one.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: accel: bma220: remove incorrect kernel-doc marking
Petre Rodan [Sun, 5 Oct 2025 13:12:10 +0000 (16:12 +0300)] 
iio: accel: bma220: remove incorrect kernel-doc marking

Remove incorrect use of kernel-doc marking.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agostaging: iio: ad9834: remove empty ad9834.h file
Taimoor Zaeem [Mon, 6 Oct 2025 09:40:24 +0000 (14:40 +0500)] 
staging: iio: ad9834: remove empty ad9834.h file

Remove drivers/staging/iio/frequency/ad9834.h header file
because it contains nothing except the include guards.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: add RZ/T2H / RZ/N2H ADC driver
Cosmin Tanislav [Sun, 5 Oct 2025 11:13:18 +0000 (14:13 +0300)] 
iio: adc: add RZ/T2H / RZ/N2H ADC driver

Add support for the A/D 12-Bit successive approximation converters found
in the Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs.

RZ/T2H has two ADCs with 4 channels and one with 6.
RZ/N2H has two ADCs with 4 channels and one with 15.

Conversions can be performed in single or continuous mode. Result of the
conversion is stored in a 16-bit data register corresponding to each
channel.

The conversions can be started by a software trigger, a synchronous
trigger (from MTU or from ELC) or an asynchronous external trigger (from
ADTRGn# pin).

Only single mode with software trigger is supported for now.

Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agodt-bindings: iio: adc: document RZ/T2H and RZ/N2H ADC
Cosmin Tanislav [Sun, 5 Oct 2025 11:13:17 +0000 (14:13 +0300)] 
dt-bindings: iio: adc: document RZ/T2H and RZ/N2H ADC

Document the A/D 12-Bit successive approximation converters found in the
Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs.

RZ/T2H has two ADCs with 4 channels and one with 6.
RZ/N2H has two ADCs with 4 channels and one with 15.

Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: dac: ltc2688: use the auto lock API
Nuno Sá [Mon, 29 Sep 2025 13:35:32 +0000 (14:35 +0100)] 
iio: dac: ltc2688: use the auto lock API

Make use of the cleanup API so that we can simplify some code paths.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: resolver: ad2s1210: replace sprintf() with sysfs_emit()
Nuno Sá [Tue, 30 Sep 2025 15:33:18 +0000 (16:33 +0100)] 
iio: resolver: ad2s1210: replace sprintf() with sysfs_emit()

Update the ad2s1210_read_label() and ad2s1210_read_event_label() functions
to use sysfs_emit() for generating labels.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: position: hid-sensor-custom-intel-hinge: replace sprintf() with sysfs_emit()
Nuno Sá [Tue, 30 Sep 2025 15:33:17 +0000 (16:33 +0100)] 
iio: position: hid-sensor-custom-intel-hinge: replace sprintf() with sysfs_emit()

Update the hinge_read_label() function to use sysfs_emit() for generating
labels.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: qcom-spmi-rradc: replace snprintf() with sysfs_emit()
Nuno Sá [Tue, 30 Sep 2025 15:33:16 +0000 (16:33 +0100)] 
iio: adc: qcom-spmi-rradc: replace snprintf() with sysfs_emit()

Update the rradc_read_label() function to use sysfs_emit() for generating
labels.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: pac1921: replace sprintf() with sysfs_emit()
Nuno Sá [Tue, 30 Sep 2025 15:33:15 +0000 (16:33 +0100)] 
iio: adc: pac1921: replace sprintf() with sysfs_emit()

Update the pac1921_read_label() function to use sysfs_emit() for
generating labels.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: mt6360-adc: replace snprintf() with sysfs_emit()
Nuno Sá [Tue, 30 Sep 2025 15:33:14 +0000 (16:33 +0100)] 
iio: adc: mt6360-adc: replace snprintf() with sysfs_emit()

Update the mt6360_adc_read_label() function to use sysfs_emit() for
generating labels.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: meson_saradc: replace sprintf() with sysfs_emit()
Nuno Sá [Tue, 30 Sep 2025 15:33:13 +0000 (16:33 +0100)] 
iio: adc: meson_saradc: replace sprintf() with sysfs_emit()

Update the read_label() function to use sysfs_emit() for generating
labels.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: mcp3564: replace sprintf() with sysfs_emit()
Nuno Sá [Tue, 30 Sep 2025 15:33:12 +0000 (16:33 +0100)] 
iio: adc: mcp3564: replace sprintf() with sysfs_emit()

Update the mcp3564_read_label() function to use sysfs_emit() for
generating labels.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Marius Cristea <marius.cristea@microchip.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad7768-1: replace sprintf() with sysfs_emit()
Nuno Sá [Tue, 30 Sep 2025 15:33:11 +0000 (16:33 +0100)] 
iio: adc: ad7768-1: replace sprintf() with sysfs_emit()

Update the ad7768_read_label() function to use sysfs_emit(() for
generating labels.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad4030: replace sprintf() with sysfs_emit()
Nuno Sá [Tue, 30 Sep 2025 15:33:10 +0000 (16:33 +0100)] 
iio: adc: ad4030: replace sprintf() with sysfs_emit()

Update the ad4030_read_label() function to use sysfs_emit() for generating
labels.

Signed-off-by: Nuno Sá <nuno.sal@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: light: ltr390: Fix typo in variable name
Sameeksha Sankpal [Fri, 3 Oct 2025 17:44:25 +0000 (23:14 +0530)] 
iio: light: ltr390: Fix typo in variable name

Corrected a spelling mistake in the ltr390 driver:
'recieve_buffer' was renamed to 'receive_buffer'.

This improves code readibility without changing functionality.

Signed-off-by: Sameeksha Sankpal <sameekshasankpal@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: mpl3115: add support for sampling frequency
Antoni Pokusinski [Thu, 2 Oct 2025 20:02:06 +0000 (22:02 +0200)] 
iio: mpl3115: add support for sampling frequency

When the device is in ACTIVE mode the temperature and pressure measurements
are collected with a frequency determined by the ST[3:0] bits of CTRL_REG2
register.

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: mpl3115: add support for DRDY interrupt
Antoni Pokusinski [Thu, 2 Oct 2025 20:02:05 +0000 (22:02 +0200)] 
iio: mpl3115: add support for DRDY interrupt

MPL3115 sensor features a "data ready" interrupt which indicates the
presence of new measurements.

Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: mpl3115: rename CTRL_REG1 field macros
Antoni Pokusinski [Thu, 2 Oct 2025 20:02:04 +0000 (22:02 +0200)] 
iio: mpl3115: rename CTRL_REG1 field macros

Rename the bitfield macros of CTRL_REG1, so that their names clearly
indicate their relation to CTRL_REG1.

This is a preparation for introducing the support for the DRDY interrupt
which requires the usage of other control registers.

Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: mpl3115: add separate function for triggered buffer data collection
Antoni Pokusinski [Thu, 2 Oct 2025 20:02:03 +0000 (22:02 +0200)] 
iio: mpl3115: add separate function for triggered buffer data collection

Factor out the code responsible for collecting data for the triggered
buffer from the trigger handler into a separate function.

Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agodt-bindings: iio: pressure: add binding for mpl3115
Antoni Pokusinski [Thu, 2 Oct 2025 20:02:02 +0000 (22:02 +0200)] 
dt-bindings: iio: pressure: add binding for mpl3115

MPL3115 is an I2C pressure and temperature sensor. It features 2
interrupt lines which can be configured to indicate events such as data
ready or pressure/temperature threshold reached.

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad7124: change setup reg allocation strategy
David Lechner [Tue, 23 Sep 2025 21:48:04 +0000 (16:48 -0500)] 
iio: adc: ad7124: change setup reg allocation strategy

Change the allocation strategy of the 8 SETUP registers from a least-
recently-used (LRU) to a first-come-first-served basis.

The AD7124 chips can have up to 16 channels enabled at a time in the
sequencer for buffered reads, but only have 8 SETUP configurations
(namely the OFFSET, GAIN, CONFIG and FILTER registers) that must be
shared among the 16 channels.  This means some of the channels must use
the exact same configuration parameters so that they can share a single
SETUP group of registers.  The previous LRU strategy did not keep track
of how many different configurations were requested at the same time,
so if there were more than 8 different configurations requested, some
channels would end up using the incorrect configuration because the slot
assigned to them would also be assigned to a different configuration
that wrote over it later.

Adding such tracking to solve this would make an already complex
algorithm even more complex.  Instead we can replace it with a simpler
first-come-first-serve strategy.  This makes it easy to track how many
different configurations are being requested at the same time.  This
comes at the expense of slightly longer setup times for buffered reads
since all setup registers must be written each time when a buffered read
is enabled.  But this is generally not considered a hot path where
performance is critical, so should be acceptable.

This new strategy also makes hardware debugging easier since SETUPs are
now assigned in a deterministic manner and in a logical order.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad7124: add ext attributes to temperature channel
David Lechner [Tue, 23 Sep 2025 20:33:18 +0000 (15:33 -0500)] 
iio: adc: ad7124: add ext attributes to temperature channel

Use the same .ext_info for the temperature channel as for the voltage
channels. In the ADC, these all go though a mux to select the source
and otherwise operate the same.

These attributes probably won't be used much, but since it is trivial
to add this, we might as well include them.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: dac: ltc2688: make use of devm_mutex_init()
Nuno Sá [Tue, 23 Sep 2025 08:41:47 +0000 (09:41 +0100)] 
iio: dac: ltc2688: make use of devm_mutex_init()

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

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoDocumentation: iio: ade9000, adis*, adx*: Convert IIO subsystem cross-references
Bagas Sanjaya [Mon, 22 Sep 2025 06:37:54 +0000 (13:37 +0700)] 
Documentation: iio: ade9000, adis*, adx*: Convert IIO subsystem cross-references

Cross-references to iio_tools.rst (IIO Interfacing Tools) and
iio_devbuf.rst (Industrial IIO device buffers) are shown in inline
code instead. Convert them to proper cross-references.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: ABI: document accelerometer event attributes
Gustavo Silva [Tue, 16 Sep 2025 23:38:24 +0000 (20:38 -0300)] 
iio: ABI: document accelerometer event attributes

Add ABI documentation for accelerometer event-related sysfs attributes
exposed by the bmi270 driver. These include threshold, period, and
enable controls for adaptive magnitude (any-motion) and rate of change
(no-motion) event detection.

Signed-off-by: Gustavo Silva <gustavograzs@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: imu: bmi270: add support for motion events
Gustavo Silva [Tue, 16 Sep 2025 23:38:23 +0000 (20:38 -0300)] 
iio: imu: bmi270: add support for motion events

Any-motion event can be enabled on a per-axis basis and triggers a
combined event when motion is detected on any axis.

No-motion event is triggered if the rate of change on all axes falls
below a specified threshold for a configurable duration. A fake channel
is used to report this event.

Threshold and duration can be configured from userspace.

Signed-off-by: Gustavo Silva <gustavograzs@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agodt-bindings: iio: accel: bosch,bma220 set irq type in example block
Petre Rodan [Sat, 13 Sep 2025 15:39:24 +0000 (18:39 +0300)] 
dt-bindings: iio: accel: bosch,bma220 set irq type in example block

Set the interrupt type to rising edge within the example block in order
to match the new driver.

The entry that got replaced was not in use by the original driver.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agodt-bindings: iio: accel: bosch,bma220 setup SPI clock mode
Petre Rodan [Sat, 13 Sep 2025 15:39:23 +0000 (18:39 +0300)] 
dt-bindings: iio: accel: bosch,bma220 setup SPI clock mode

Assert CPOL for a high-idle clock signal and CPHA for sampling on the
trailing (rising) edge.

Quoting from the datasheet:

 "During the transitions on CSB, SCK must be high. SDI and SDO are driven
 at the falling edge of SCK and should be captured at the rising edge of
 SCK."

The sensor does not function with the default SPI clock mode.

Fixes: 7dbd479425d2 ("dt-bindings:iio:accel:bosch,bma220 device tree binding documentation")
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agodt-bindings: iio: accel: bosch,bma220 cleanup typo
Petre Rodan [Sat, 13 Sep 2025 15:39:22 +0000 (18:39 +0300)] 
dt-bindings: iio: accel: bosch,bma220 cleanup typo

Cleanup typo present in the title.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: buffer: document that buffer callback must be context safe
David Lechner [Tue, 16 Sep 2025 21:02:57 +0000 (16:02 -0500)] 
iio: buffer: document that buffer callback must be context safe

Document that the callback registered with iio_channel_get_all_cb()
must be safe to call from any context since it is called from by
iio_push_to_buffer() which can be called in any context.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: buffer: document store_to() callback may be called in any context
David Lechner [Tue, 16 Sep 2025 21:02:56 +0000 (16:02 -0500)] 
iio: buffer: document store_to() callback may be called in any context

Document that the struct iio_buffer_access_funcs.store_to() callback
must be safe to call from any context since it is called from
iio_push_to_buffer() which may be called from any context.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: buffer: document iio_push_to_buffers() calling context
David Lechner [Tue, 16 Sep 2025 21:02:55 +0000 (16:02 -0500)] 
iio: buffer: document iio_push_to_buffers() calling context

Document that iio_push_to_buffers() can be called from any context.

Also document the Return: value while here.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: buffer: deprecated iio_push_to_buffers_with_timestamp()
David Lechner [Tue, 16 Sep 2025 21:02:54 +0000 (16:02 -0500)] 
iio: buffer: deprecated iio_push_to_buffers_with_timestamp()

Replace the documentation of iio_push_to_buffers_with_timestamp() with
a deprecation notice pointing to the preferred alternative.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: buffer: document iio_push_to_buffers_with_ts()
David Lechner [Tue, 16 Sep 2025 21:02:53 +0000 (16:02 -0500)] 
iio: buffer: document iio_push_to_buffers_with_ts()

Document the iio_push_to_buffers_with_ts() function.

This is copied and slightly cleaned up from
iio_push_to_buffers_with_timestamp().

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: buffer: iio_push_to_buffers_with_ts_unaligned() might_sleep()
David Lechner [Tue, 16 Sep 2025 21:02:52 +0000 (16:02 -0500)] 
iio: buffer: iio_push_to_buffers_with_ts_unaligned() might_sleep()

Call might_sleep() in iio_push_to_buffers_with_ts_unaligned() since it
can allocate memory, which may sleep.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: buffer: document iio_push_to_buffers_with_ts_unaligned() may sleep
David Lechner [Tue, 16 Sep 2025 21:02:51 +0000 (16:02 -0500)] 
iio: buffer: document iio_push_to_buffers_with_ts_unaligned() may sleep

Add Context: documentation comment that
iio_push_to_buffers_with_ts_unaligned() may sleep because it calls
devm_krealloc().

Also document Return: value while here.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad7124: remove __ad7124_set_channel()
David Lechner [Tue, 16 Sep 2025 21:39:39 +0000 (16:39 -0500)] 
iio: adc: ad7124: remove __ad7124_set_channel()

Remove __ad7124_set_channel() wrapper function. This just added an
unnecessary layer of indirection with an extra call to container_of().

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad7124: use devm_mutex_init()
David Lechner [Wed, 17 Sep 2025 15:22:30 +0000 (10:22 -0500)] 
iio: adc: ad7124: use devm_mutex_init()

Use devm_mutex_init() to initialize the mutex to handle automatically
freeing in debug builds.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad7124: use AD7124_MAX_CHANNELS
David Lechner [Wed, 17 Sep 2025 14:17:23 +0000 (09:17 -0500)] 
iio: adc: ad7124: use AD7124_MAX_CHANNELS

Use AD7124_MAX_CHANNELS macro instead of hardcoding 16 in
ad7124_disable_all(). We already have the macro, so we should use it.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad7124: remove unused `nr` field
David Lechner [Wed, 17 Sep 2025 20:39:23 +0000 (15:39 -0500)] 
iio: adc: ad7124: remove unused `nr` field

Remove the unused `nr` field from the `ad7124_channel` struct. There
are no more users of this field (it is only assigned to but never read)
so can be removed.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad7124: inline ad7124_enable_channel()
David Lechner [Wed, 17 Sep 2025 20:39:22 +0000 (15:39 -0500)] 
iio: adc: ad7124: inline ad7124_enable_channel()

Inline ad7124_enable_channel() at the only call site. This simplifies
the code by avoiding a bit of extra indirection.

ch->nr is replaced by address as that is the same value and avoids more
indirection.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoiio: adc: ad7124: add debugfs to disable single cycle mode
David Lechner [Wed, 17 Sep 2025 23:03:17 +0000 (18:03 -0500)] 
iio: adc: ad7124: add debugfs to disable single cycle mode

Add a boolean debugfs attribute to allow disabling the SINGLE_CYCLE
bit in the FILTER registers.

This causes data to be read on every conversion instead of doing the
usual 3 or 4 conversions per sample (depending on the filter). This is
only needed for very specific use cases, such as validating the
performance of the ADC. So we just expose this feature through debugfs
for the rare cases where it is needed by people who really know what
they are doing.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 months agoLinux 6.18-rc1 v6.18-rc1
Linus Torvalds [Sun, 12 Oct 2025 20:42:36 +0000 (13:42 -0700)] 
Linux 6.18-rc1

2 months agoMerge tag 'i2c-for-6.18-rc1-hotfix' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 12 Oct 2025 20:27:56 +0000 (13:27 -0700)] 
Merge tag 'i2c-for-6.18-rc1-hotfix' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fix from Wolfram Sang:
 "One revert because of a regression in the I2C core which has sadly not
  showed up during its time in -next"

* tag 'i2c-for-6.18-rc1-hotfix' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  Revert "i2c: boardinfo: Annotate code used in init phase only"

2 months agoMerge tag 'irq_urgent_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 12 Oct 2025 15:45:52 +0000 (08:45 -0700)] 
Merge tag 'irq_urgent_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq fixes from Borislav Petkov:

 - Skip interrupt ID 0 in sifive-plic during suspend/resume because
   ID 0 is reserved and accessing reserved register space could result
   in undefined behavior

 - Fix a function's retval check in aspeed-scu-ic

* tag 'irq_urgent_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip/sifive-plic: Avoid interrupt ID 0 handling during suspend/resume
  irqchip/aspeed-scu-ic: Fix an IS_ERR() vs NULL check

2 months agoMerge tag 'trace-v6.18-3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
Linus Torvalds [Sat, 11 Oct 2025 23:06:04 +0000 (16:06 -0700)] 
Merge tag 'trace-v6.18-3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing fixes from Steven Rostedt:
 "The previous fix to trace_marker required updating trace_marker_raw as
  well. The difference between trace_marker_raw from trace_marker is
  that the raw version is for applications to write binary structures
  directly into the ring buffer instead of writing ASCII strings. This
  is for applications that will read the raw data from the ring buffer
  and get the data structures directly. It's a bit quicker than using
  the ASCII version.

  Unfortunately, it appears that our test suite has several tests that
  test writes to the trace_marker file, but lacks any tests to the
  trace_marker_raw file (this needs to be remedied). Two issues came
  about the update to the trace_marker_raw file that syzbot found:

   - Fix tracing_mark_raw_write() to use per CPU buffer

     The fix to use the per CPU buffer to copy from user space was
     needed for both the trace_maker and trace_maker_raw file.

     The fix for reading from user space into per CPU buffers properly
     fixed the trace_marker write function, but the trace_marker_raw
     file wasn't fixed properly. The user space data was correctly
     written into the per CPU buffer, but the code that wrote into the
     ring buffer still used the user space pointer and not the per CPU
     buffer that had the user space data already written.

   - Stop the fortify string warning from writing into trace_marker_raw

     After converting the copy_from_user_nofault() into a memcpy(),
     another issue appeared. As writes to the trace_marker_raw expects
     binary data, the first entry is a 4 byte identifier. The entry
     structure is defined as:

     struct {
    struct trace_entry ent;
    int id;
    char buf[];
     };

     The size of this structure is reserved on the ring buffer with:

       size = sizeof(*entry) + cnt;

     Then it is copied from the buffer into the ring buffer with:

       memcpy(&entry->id, buf, cnt);

     This use to be a copy_from_user_nofault(), but now converting it to
     a memcpy() triggers the fortify-string code, and causes a warning.

     The allocated space is actually more than what is copied, as the
     cnt used also includes the entry->id portion. Allocating
     sizeof(*entry) plus cnt is actually allocating 4 bytes more than
     what is needed.

     Change the size function to:

       size = struct_size(entry, buf, cnt - sizeof(entry->id));

     And update the memcpy() to unsafe_memcpy()"

* tag 'trace-v6.18-3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tracing: Stop fortify-string from warning in tracing_mark_raw_write()
  tracing: Fix tracing_mark_raw_write() to use buf and not ubuf

2 months agoMerge tag 'kbuild-fixes-6.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 11 Oct 2025 22:47:12 +0000 (15:47 -0700)] 
Merge tag 'kbuild-fixes-6.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux

Pull Kbuild fixes from Nathan Chancellor:

 - Fix UAPI types check in headers_check.pl

 - Only enable -Werror for hostprogs with CONFIG_WERROR / W=e

 - Ignore fsync() error when output of gen_init_cpio is a pipe

 - Several little build fixes for recent modules.builtin.modinfo series

* tag 'kbuild-fixes-6.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux:
  kbuild: Use '--strip-unneeded-symbol' for removing module device table symbols
  s390/vmlinux.lds.S: Move .vmlinux.info to end of allocatable sections
  kbuild: Add '.rel.*' strip pattern for vmlinux
  kbuild: Restore pattern to avoid stripping .rela.dyn from vmlinux
  gen_init_cpio: Ignore fsync() returning EINVAL on pipes
  scripts/Makefile.extrawarn: Respect CONFIG_WERROR / W=e for hostprogs
  kbuild: uapi: Strip comments before size type check

2 months agoRevert "i2c: boardinfo: Annotate code used in init phase only"
Wolfram Sang [Sat, 11 Oct 2025 10:31:53 +0000 (12:31 +0200)] 
Revert "i2c: boardinfo: Annotate code used in init phase only"

This reverts commit 1a2b423be6a89dd07d5fc27ea042be68697a6a49 because we
got a regression report and need time to find out the details.

Reported-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Closes: https://lore.kernel.org/r/29ec0082-4dd4-4120-acd2-44b35b4b9487@oss.qualcomm.com
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2 months agoMerge tag 'rtc-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Linus Torvalds [Sat, 11 Oct 2025 18:56:47 +0000 (11:56 -0700)] 
Merge tag 'rtc-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux

Pull RTC updates from Alexandre Belloni:
 "This cycle, we have a new RTC driver, for the SpacemiT P1. The optee
  driver gets alarm support. We also get a fix for a race condition that
  was fairly rare unless while stress testing the alarms.

  Subsystem:
   - Fix race when setting alarm
   - Ensure alarm irq is enabled when UIE is enabled
   - remove unneeded 'fast_io' parameter in regmap_config

  New driver:
   - SpacemiT P1 RTC

  Drivers:
   - efi: Remove wakeup functionality
   - optee: add alarms support
   - s3c: Drop support for S3C2410
   - zynqmp: Restore alarm functionality after kexec transition"

* tag 'rtc-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (29 commits)
  rtc: interface: Ensure alarm irq is enabled when UIE is enabled
  rtc: tps6586x: Fix initial enable_irq/disable_irq balance
  rtc: cpcap: Fix initial enable_irq/disable_irq balance
  rtc: isl12022: Fix initial enable_irq/disable_irq balance
  rtc: interface: Fix long-standing race when setting alarm
  rtc: pcf2127: fix watchdog interrupt mask on pcf2131
  rtc: zynqmp: Restore alarm functionality after kexec transition
  rtc: amlogic-a4: Optimize global variables
  rtc: sd2405al: Add I2C address.
  rtc: Kconfig: move symbols to proper section
  rtc: optee: make optee_rtc_pm_ops static
  rtc: optee: Fix error code in optee_rtc_read_alarm()
  rtc: optee: fix error code in probe()
  dt-bindings: rtc: Convert apm,xgene-rtc to DT schema
  rtc: spacemit: support the SpacemiT P1 RTC
  rtc: optee: add alarm related rtc ops to optee rtc driver
  rtc: optee: remove unnecessary memory operations
  rtc: optee: fix memory leak on driver removal
  rtc: x1205: Fix Xicor X1205 vendor prefix
  dt-bindings: rtc: Fix Xicor X1205 vendor prefix
  ...

2 months agoMerge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sat, 11 Oct 2025 18:49:00 +0000 (11:49 -0700)] 
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Fixes only in drivers (ufs, mvsas, qla2xxx, target) that came in just
  before or during the merge window.

  The most important one is the qla2xxx which reverts a conversion to
  fix flexible array member warnings, that went up in this merge window
  but which turned out on further testing to be causing data corruption"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: ufs: core: Include UTP error in INT_FATAL_ERRORS
  scsi: ufs: sysfs: Make HID attributes visible
  scsi: mvsas: Fix use-after-free bugs in mvs_work_queue
  scsi: ufs: core: Fix PM QoS mutex initialization
  scsi: ufs: core: Fix runtime suspend error deadlock
  Revert "scsi: qla2xxx: Fix memcpy() field-spanning write issue"
  scsi: target: target_core_configfs: Add length check to avoid buffer overflow

2 months agoMerge tag 'x86_core_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 11 Oct 2025 18:19:16 +0000 (11:19 -0700)] 
Merge tag 'x86_core_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull more x86 updates from Borislav Petkov:

 - Remove a bunch of asm implementing condition flags testing in KVM's
   emulator in favor of int3_emulate_jcc() which is written in C

 - Replace KVM fastops with C-based stubs which avoids problems with the
   fastop infra related to latter not adhering to the C ABI due to their
   special calling convention and, more importantly, bypassing compiler
   control-flow integrity checking because they're written in asm

 - Remove wrongly used static branches and other ugliness accumulated
   over time in hyperv's hypercall implementation with a proper static
   function call to the correct hypervisor call variant

 - Add some fixes and modifications to allow running FRED-enabled
   kernels in KVM even on non-FRED hardware

 - Add kCFI improvements like validating indirect calls and prepare for
   enabling kCFI with GCC. Add cmdline params documentation and other
   code cleanups

 - Use the single-byte 0xd6 insn as the official #UD single-byte
   undefined opcode instruction as agreed upon by both x86 vendors

 - Other smaller cleanups and touchups all over the place

* tag 'x86_core_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
  x86,retpoline: Optimize patch_retpoline()
  x86,ibt: Use UDB instead of 0xEA
  x86/cfi: Remove __noinitretpoline and __noretpoline
  x86/cfi: Add "debug" option to "cfi=" bootparam
  x86/cfi: Standardize on common "CFI:" prefix for CFI reports
  x86/cfi: Document the "cfi=" bootparam options
  x86/traps: Clarify KCFI instruction layout
  compiler_types.h: Move __nocfi out of compiler-specific header
  objtool: Validate kCFI calls
  x86/fred: KVM: VMX: Always use FRED for IRQs when CONFIG_X86_FRED=y
  x86/fred: Play nice with invoking asm_fred_entry_from_kvm() on non-FRED hardware
  x86/fred: Install system vector handlers even if FRED isn't fully enabled
  x86/hyperv: Use direct call to hypercall-page
  x86/hyperv: Clean up hv_do_hypercall()
  KVM: x86: Remove fastops
  KVM: x86: Convert em_salc() to C
  KVM: x86: Introduce EM_ASM_3WCL
  KVM: x86: Introduce EM_ASM_1SRC2
  KVM: x86: Introduce EM_ASM_2CL
  KVM: x86: Introduce EM_ASM_2W
  ...

2 months agoMerge tag 'x86_cleanups_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 11 Oct 2025 17:51:14 +0000 (10:51 -0700)] 
Merge tag 'x86_cleanups_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 cleanups from Borislav Petkov:

 - Simplify inline asm flag output operands now that the minimum
   compiler version supports the =@ccCOND syntax

 - Remove a bunch of AS_* Kconfig symbols which detect assembler support
   for various instruction mnemonics now that the minimum assembler
   version supports them all

 - The usual cleanups all over the place

* tag 'x86_cleanups_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/asm: Remove code depending on __GCC_ASM_FLAG_OUTPUTS__
  x86/sgx: Use ENCLS mnemonic in <kernel/cpu/sgx/encls.h>
  x86/mtrr: Remove license boilerplate text with bad FSF address
  x86/asm: Use RDPKRU and WRPKRU mnemonics in <asm/special_insns.h>
  x86/idle: Use MONITORX and MWAITX mnemonics in <asm/mwait.h>
  x86/entry/fred: Push __KERNEL_CS directly
  x86/kconfig: Remove CONFIG_AS_AVX512
  crypto: x86 - Remove CONFIG_AS_VPCLMULQDQ
  crypto: X86 - Remove CONFIG_AS_VAES
  crypto: x86 - Remove CONFIG_AS_GFNI
  x86/kconfig: Drop unused and needless config X86_64_SMP

2 months agoMerge tag 'slab-for-6.18-rc1-hotfix' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 11 Oct 2025 17:40:24 +0000 (10:40 -0700)] 
Merge tag 'slab-for-6.18-rc1-hotfix' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab

Pull slab fix from Vlastimil Babka:
 "A NULL pointer deref hotfix"

* tag 'slab-for-6.18-rc1-hotfix' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab:
  slab: fix barn NULL pointer dereference on memoryless nodes

2 months agoMerge tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Linus Torvalds [Sat, 11 Oct 2025 17:31:38 +0000 (10:31 -0700)] 
Merge tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf

Pull bpf fixes from Alexei Starovoitov:

 - Finish constification of 1st parameter of bpf_d_path() (Rong Tao)

 - Harden userspace-supplied xdp_desc validation (Alexander Lobakin)

 - Fix metadata_dst leak in __bpf_redirect_neigh_v{4,6}() (Daniel
   Borkmann)

 - Fix undefined behavior in {get,put}_unaligned_be32() (Eric Biggers)

 - Use correct context to unpin bpf hash map with special types (KaFai
   Wan)

* tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
  selftests/bpf: Add test for unpinning htab with internal timer struct
  bpf: Avoid RCU context warning when unpinning htab with internal structs
  xsk: Harden userspace-supplied xdp_desc validation
  bpf: Fix metadata_dst leak __bpf_redirect_neigh_v{4,6}
  libbpf: Fix undefined behavior in {get,put}_unaligned_be32()
  bpf: Finish constification of 1st parameter of bpf_d_path()

2 months agoMerge tag 'mm-nonmm-stable-2025-10-10-15-03' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Sat, 11 Oct 2025 17:27:52 +0000 (10:27 -0700)] 
Merge tag 'mm-nonmm-stable-2025-10-10-15-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull more updates from Andrew Morton:
 "Just one series here - Mike Rappoport has taught KEXEC handover to
  preserve vmalloc allocations across handover"

* tag 'mm-nonmm-stable-2025-10-10-15-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
  lib/test_kho: use kho_preserve_vmalloc instead of storing addresses in fdt
  kho: add support for preserving vmalloc allocations
  kho: replace kho_preserve_phys() with kho_preserve_pages()
  kho: check if kho is finalized in __kho_preserve_order()
  MAINTAINERS, .mailmap: update Umang's email address