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 v2 4/4] iio: adc: ad7606: Add debug mode for ad7616
Date: Sat, 8 Jun 2019 12:34:31 +0100 [thread overview]
Message-ID: <20190608123431.14f8dd07@archlinux> (raw)
In-Reply-To: <20190527125650.2405-4-beniamin.bia@analog.com>
On Mon, 27 May 2019 15:56:50 +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>
> Acked-by: Jonathan Cameron <jic23@kernel.org>
Applied.
Thanks,
Jonathan
> ---
> Changes in v2:
> -nothing changed
>
> 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 8e09ad4bb72e..0eccfc873802 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-06-08 11:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-27 12:56 [PATCH v2 1/4] iio: adc: ad7606: Move oversampling and scale options to chip info Beniamin Bia
2019-05-27 12:56 ` [PATCH v2 2/4] iio: adc: ad7606: Add software configuration Beniamin Bia
2019-06-08 11:27 ` Jonathan Cameron
2019-05-27 12:56 ` [PATCH v2 3/4] iio: adc: ad7606: Add support for software mode for ad7616 Beniamin Bia
2019-06-08 11:30 ` Jonathan Cameron
2019-06-17 20:07 ` Jonathan Cameron
2019-05-27 12:56 ` [PATCH v2 4/4] iio: adc: ad7606: Add debug " Beniamin Bia
2019-06-08 11:34 ` Jonathan Cameron [this message]
2019-06-08 11:23 ` [PATCH v2 1/4] iio: adc: ad7606: Move oversampling and scale options to chip info 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=20190608123431.14f8dd07@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).