[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3fdf3d1815b5181dc01490e2500b4eb4fe3fe579.1700595310.git.marcelo.schmitt1@gmail.com>
Date: Tue, 21 Nov 2023 18:36:52 -0300
From: <marcelo.schmitt@...log.com>
To: <beniamin.bia@...log.com>, <paul.cercueil@...log.com>,
<Michael.Hennerich@...log.com>, <lars@...afoo.de>,
<jic23@...nel.org>, <marcelo.schmitt1@...il.com>
CC: Marcelo Schmitt <marcelo.schmitt@...log.com>,
<linux-iio@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH 7/7] iio: adc: ad7091r-base: Add debugfs reg access
From: Marcelo Schmitt <marcelo.schmitt@...log.com>
Add direct register access support for AD7091R-2/-4/-5/-8 ADCs.
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@...log.com>
---
drivers/iio/adc/ad7091r-base.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/iio/adc/ad7091r-base.c b/drivers/iio/adc/ad7091r-base.c
index f9b4f91d1c4f..798f7b3cc7e1 100644
--- a/drivers/iio/adc/ad7091r-base.c
+++ b/drivers/iio/adc/ad7091r-base.c
@@ -157,8 +157,20 @@ static int ad7091r_read_raw(struct iio_dev *iio_dev,
return ret;
}
+static int ad7091r_reg_access(struct iio_dev *indio_dev, unsigned int reg,
+ unsigned int writeval, unsigned int *readval)
+{
+ struct ad7091r_state *st = iio_priv(indio_dev);
+
+ if (readval)
+ return regmap_read(st->map, reg, readval);
+
+ return regmap_write(st->map, reg, writeval);
+}
+
static const struct iio_info ad7091r_info = {
.read_raw = ad7091r_read_raw,
+ .debugfs_reg_access = &ad7091r_reg_access,
};
static irqreturn_t ad7091r_event_handler(int irq, void *private)
--
2.42.0
Powered by blists - more mailing lists