[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231125164404.64072ffb@jic23-huawei>
Date: Sat, 25 Nov 2023 16:44:04 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Marcelo Schmitt <marcelo.schmitt@...log.com>
Cc: <paul.cercueil@...log.com>, <Michael.Hennerich@...log.com>,
<lars@...afoo.de>, <robh+dt@...nel.org>,
<krzysztof.kozlowski+dt@...aro.org>, <conor+dt@...nel.org>,
<marcelo.schmitt1@...il.com>, <linux-iio@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 7/7] iio: adc: ad7091r-base: Add debugfs reg access
On Thu, 23 Nov 2023 13:43:06 -0300
Marcelo Schmitt <marcelo.schmitt@...log.com> wrote:
> Add direct register access support for AD7091R-2/-4/-5/-8 ADCs.
>
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@...log.com>
regmap provides it's own version of this, so I'm not sure I'd bother adding
the IIO one. See regmap-debugfs.c
> ---
> 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 dbc60ea1bafc..4d5051316428 100644
> --- a/drivers/iio/adc/ad7091r-base.c
> +++ b/drivers/iio/adc/ad7091r-base.c
> @@ -177,8 +177,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)
Powered by blists - more mailing lists