[PATCH 0/6] iio: debugfs register access through regmap in the core

From: Rupesh Majhi

Date: Tue Nov 24 2026 - 01:50:52 EST


More than 25 IIO drivers have a debugfs_reg_access callback that is
only a regmap_read() or regmap_write() on the regmap of the parent
device. Patch 1 adds a core helper for that, patches 2 to 5 use it in
four drivers and patch 6 adds register access to dps310 with it. The
other drivers can follow in batches if the helper is wanted.

The helper finds the regmap with dev_get_regmap() on the parent, so it
only fits drivers with one regmap there. Existing callbacks that take a
lock or claim direct mode around the access are left alone.

Patch 6 is tested on a DPS310 on a BeagleBone Black. I don't have the
other parts. For those, adxl313, adxl372, bma220 and ina226 (ina219
uses the same callback) were instantiated on i2c-stub under QEMU:
reads, writes and refused registers through direct_reg_access give the
same results before and after.

Based on iio testing.

Rupesh Majhi (6):
iio: core: add iio_debugfs_reg_access_regmap()
iio: accel: adxl313: use iio_debugfs_reg_access_regmap()
iio: accel: adxl372: use iio_debugfs_reg_access_regmap()
iio: accel: bma220: use iio_debugfs_reg_access_regmap()
iio: adc: ina2xx-adc: use iio_debugfs_reg_access_regmap()
iio: pressure: dps310: add debugfs register access

drivers/iio/accel/adxl313_core.c | 12 +-----------
drivers/iio/accel/adxl372.c | 15 +--------------
drivers/iio/accel/bma220_core.c | 12 +-----------
drivers/iio/adc/ina2xx-adc.c | 15 ++-------------
drivers/iio/industrialio-core.c | 28 ++++++++++++++++++++++++++++
drivers/iio/pressure/dps310.c | 1 +
include/linux/iio/iio.h | 2 ++
7 files changed, 36 insertions(+), 49 deletions(-)


base-commit: f2cbef9101b9fc979a324bb1242b8b802a2484b6
--
2.43.0