diff options
| author | Lothar Rubusch <l.rubusch@gmail.com> | 2025-02-20 13:42:21 +0300 |
|---|---|---|
| committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2025-03-04 16:17:51 +0300 |
| commit | a69b0bd304382b5e7050418614b1f5ddb36e77fe (patch) | |
| tree | 0c66a1baf5e93d9c11e342ff855db18991e8fc10 | |
| parent | 60a7903301f8b53a3012f31375841cbb3957fa00 (diff) | |
| download | linux-a69b0bd304382b5e7050418614b1f5ddb36e77fe.tar.xz | |
iio: accel: adxl345: add debug register access
Add the possibility to verify the content of the configuration
registers of the sensor in preparation for upcomming feature
implementations.
Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
Link: https://patch.msgid.link/20250220104234.40958-3-l.rubusch@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| -rw-r--r-- | drivers/iio/accel/adxl345_core.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c index e2f65d8278d5..fedf0d41d36b 100644 --- a/drivers/iio/accel/adxl345_core.c +++ b/drivers/iio/accel/adxl345_core.c @@ -202,6 +202,16 @@ static int adxl345_write_raw(struct iio_dev *indio_dev, return -EINVAL; } +static int adxl345_reg_access(struct iio_dev *indio_dev, unsigned int reg, + unsigned int writeval, unsigned int *readval) +{ + struct adxl345_state *st = iio_priv(indio_dev); + + if (readval) + return regmap_read(st->regmap, reg, readval); + return regmap_write(st->regmap, reg, writeval); +} + static int adxl345_set_watermark(struct iio_dev *indio_dev, unsigned int value) { struct adxl345_state *st = iio_priv(indio_dev); @@ -467,6 +477,7 @@ static const struct iio_info adxl345_info = { .read_raw = adxl345_read_raw, .write_raw = adxl345_write_raw, .write_raw_get_fmt = adxl345_write_raw_get_fmt, + .debugfs_reg_access = &adxl345_reg_access, .hwfifo_set_watermark = adxl345_set_watermark, }; |
