All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Beniamin Bia <beniamin.bia@analog.com>
Cc: <linux-iio@vger.kernel.org>, <biabeniamin@outlook.com>
Subject: Re: [PATCH 5/5] iio: adc: ad7606: Add debug mode for ad7616
Date: Sun, 28 Jul 2019 08:58:59 +0100	[thread overview]
Message-ID: <20190728085859.2c5c2932@archlinux> (raw)
In-Reply-To: <20190718062734.17306-5-beniamin.bia@analog.com>

On Thu, 18 Jul 2019 09:27:34 +0300
Beniamin Bia <beniamin.bia@analog.com> wrote:

> Support for register access was added for devices which have software
> mode.
> 
> Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
> Acked-by: Jonathan Cameron <jic23@kernel.org>

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
> Changes in v2:
> -nothing changed
> 
>  drivers/iio/adc/ad7606.c | 33 ++++++++++++++++++++++++++++++++-
>  1 file changed, 32 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
> index be2330c8b277..ed2d08437e5d 100644
> --- a/drivers/iio/adc/ad7606.c
> +++ b/drivers/iio/adc/ad7606.c
> @@ -60,6 +60,29 @@ static int ad7606_reset(struct ad7606_state *st)
>  	return -ENODEV;
>  }
>  
> +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 = st->bops->reg_read(st, reg);
> +		if (ret < 0)
> +			goto err_unlock;
> +		*readval = ret;
> +		ret = 0;
> +	} else {
> +		ret = st->bops->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;
> @@ -501,6 +524,14 @@ static const struct iio_info ad7606_info_os_and_range = {
>  	.validate_trigger = &ad7606_validate_trigger,
>  };
>  
> +static const struct iio_info ad7606_info_os_range_and_debug = {
> +	.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,
> +};
> +
>  static const struct iio_info ad7606_info_os = {
>  	.read_raw = &ad7606_read_raw,
>  	.write_raw = &ad7606_write_raw,
> @@ -617,7 +648,7 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
>  
>  		/* After reset, in software mode, ±10 V is set by default */
>  		memset32(st->range, 2, ARRAY_SIZE(st->range));
> -		indio_dev->info = &ad7606_info_os_and_range;
> +		indio_dev->info = &ad7606_info_os_range_and_debug;
>  
>  		ret = st->bops->sw_mode_config(indio_dev);
>  		if (ret < 0)


  reply	other threads:[~2019-07-28  7:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 2/5] iio: adc: ad7606: Move spi dependent features to spi file Beniamin Bia
2019-07-28  7:57   ` Jonathan Cameron
2019-07-18  6:27 ` [PATCH 3/5] iio: adc: ad7606: Allow reconfigration after reset Beniamin Bia
2019-07-28  7:57   ` Jonathan Cameron
2019-07-18  6:27 ` [PATCH 4/5] iio: adc: ad7606: Add support for software mode for ad7616 Beniamin Bia
2019-07-28  7:58   ` Jonathan Cameron
2019-07-18  6:27 ` [PATCH 5/5] iio: adc: ad7606: Add debug " Beniamin Bia
2019-07-28  7:58   ` Jonathan Cameron [this message]
2019-07-28  7:57 ` [PATCH 1/5] iio: adc: ad7606: Move common channel definition to header Jonathan Cameron
  -- strict thread matches above, loose matches on Subject: below --
2019-07-03 14:36 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-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 5/5] iio: adc: ad7606: Add debug mode for ad7616 Beniamin Bia
2019-05-16 14:32   ` Beniamin Bia
2019-05-18 10:24   ` Jonathan Cameron
2019-05-18 10:24     ` 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=20190728085859.2c5c2932@archlinux \
    --to=jic23@kernel.org \
    --cc=beniamin.bia@analog.com \
    --cc=biabeniamin@outlook.com \
    --cc=linux-iio@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.