From: Jonathan Cameron <jic23@kernel.org>
To: Beniamin Bia <beniamin.bia@analog.com>
Cc: <lars@metafoo.de>, <Michael.Hennerich@analog.com>,
<knaack.h@gmx.de>, <pmeerw@pmeerw.net>,
<gregkh@linuxfoundation.org>, <linux-iio@vger.kernel.org>,
<devel@driverdev.osuosl.org>, <linux-kernel@vger.kernel.org>,
<mark.rutland@arm.com>, <robh+dt@kernel.org>,
<devicetree@vger.kernel.org>, <biabeniamin@outlook.com>
Subject: Re: [PATCH 5/5] iio: adc: ad7606: Add debug mode for ad7616
Date: Sat, 18 May 2019 11:24:37 +0100 [thread overview]
Message-ID: <20190518112437.0ec3d0e8@archlinux> (raw)
In-Reply-To: <20190516143208.19294-5-beniamin.bia@analog.com>
On Thu, 16 May 2019 17:32:08 +0300
Beniamin Bia <beniamin.bia@analog.com> wrote:
> Support for register access was added for spi devices.
>
> Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Looks fine. For my reference please add
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> drivers/iio/adc/ad7606.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
> index f77df3efe43f..b03bdce4fd4e 100644
> --- a/drivers/iio/adc/ad7606.c
> +++ b/drivers/iio/adc/ad7606.c
> @@ -134,6 +134,30 @@ static int ad7606_spi_write_mask(struct ad7606_state *st,
> return ad7606_spi_reg_write(st, addr, readval);
> }
>
> +static int ad7606_reg_access(struct iio_dev *indio_dev,
> + unsigned int reg,
> + unsigned int writeval,
> + unsigned int *readval)
> +{
> + struct ad7606_state *st = iio_priv(indio_dev);
> + int ret;
> +
> + mutex_lock(&st->lock);
> + if (readval) {
> + ret = ad7606_spi_reg_read(st, reg);
> + if (ret < 0)
> + goto err_unlock;
> + *readval = ret;
> + ret = 0;
> + } else {
> + ret = ad7606_spi_reg_write(st, reg, writeval);
> + }
> +err_unlock:
> + mutex_unlock(&st->lock);
> +
> + return ret;
> +}
> +
> static int ad7606_read_samples(struct ad7606_state *st)
> {
> unsigned int num = st->chip_info->num_channels;
> @@ -645,6 +669,7 @@ static const struct iio_info ad7606_info_no_os_or_range = {
> static const struct iio_info ad7606_info_os_and_range = {
> .read_raw = &ad7606_read_raw,
> .write_raw = &ad7606_write_raw,
> + .debugfs_reg_access = &ad7606_reg_access,
> .attrs = &ad7606_attribute_group_os_and_range,
> .validate_trigger = &ad7606_validate_trigger,
> };
next prev parent reply other threads:[~2019-05-18 10:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-16 14:32 [PATCH 1/5] iio: adc: ad7606: Move oversampling and scale options to chip info Beniamin Bia
2019-05-16 14:32 ` [PATCH 2/5] iio: adc: ad7606: Add software configuration Beniamin Bia
2019-05-18 10:07 ` Jonathan Cameron
2019-05-18 10:23 ` Jonathan Cameron
2019-05-16 14:32 ` [PATCH 3/5] iio: adc: ad7606: Make SPI register calculation generic and add spi support Beniamin Bia
2019-05-18 10:20 ` Jonathan Cameron
2019-05-16 14:32 ` [PATCH 4/5] iio: adc: ad7606: Add support for software mode for ad7616 Beniamin Bia
2019-05-18 10:20 ` Jonathan Cameron
2019-05-16 14:32 ` [PATCH 5/5] iio: adc: ad7606: Add debug " Beniamin Bia
2019-05-18 10:24 ` Jonathan Cameron [this message]
2019-05-18 10:04 ` [PATCH 1/5] iio: adc: ad7606: Move oversampling and scale options to chip info Jonathan Cameron
2019-05-18 10:22 ` Jonathan Cameron
-- strict thread matches above, loose matches on Subject: below --
2019-07-03 14:36 [PATCH 1/5] iio: adc: ad7606: Move common channel definition to header Beniamin Bia
2019-07-03 14:36 ` [PATCH 5/5] iio: adc: ad7606: Add debug mode for ad7616 Beniamin Bia
2019-07-14 15:57 ` Jonathan Cameron
2019-07-18 6:27 [PATCH 1/5] iio: adc: ad7606: Move common channel definition to header Beniamin Bia
2019-07-18 6:27 ` [PATCH 5/5] iio: adc: ad7606: Add debug mode for ad7616 Beniamin Bia
2019-07-28 7:58 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190518112437.0ec3d0e8@archlinux \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=beniamin.bia@analog.com \
--cc=biabeniamin@outlook.com \
--cc=devel@driverdev.osuosl.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pmeerw@pmeerw.net \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).