linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Nishant Malpani <nish.malpani25@gmail.com>
Cc: robh+dt@kernel.org, dragos.bogdan@analog.com,
	darius.berghe@analog.com, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 3/3] iio: gyro: adxrs290: Add debugfs register access support
Date: Sat, 29 Aug 2020 17:51:04 +0100	[thread overview]
Message-ID: <20200829175104.62142a31@archlinux> (raw)
In-Reply-To: <20200825124711.11455-4-nish.malpani25@gmail.com>

On Tue, 25 Aug 2020 18:17:11 +0530
Nishant Malpani <nish.malpani25@gmail.com> wrote:

> Extend support to read/write byte data from/to the device using
> debugfs iio interface.
> 
> Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Hi Nishant,

I'm always a bit unsure on whether I want drivers to provide this
interface, as it isn't something that should be of much use once
initial driver debugging is done.

However, the patch is good so if you want to add it fair enough.
I'll pick it up once patches 1 and 2 are ready.

Thanks,

Jonathan

> ---
>  drivers/iio/gyro/adxrs290.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/iio/gyro/adxrs290.c b/drivers/iio/gyro/adxrs290.c
> index 25046590761e..b0050cdd2b90 100644
> --- a/drivers/iio/gyro/adxrs290.c
> +++ b/drivers/iio/gyro/adxrs290.c
> @@ -435,6 +435,24 @@ static int adxrs290_read_avail(struct iio_dev *indio_dev,
>  	}
>  }
>  
> +static int adxrs290_reg_access(struct iio_dev *indio_dev, unsigned int reg,
> +			       unsigned int writeval, unsigned int *readval)
> +{
> +	struct adxrs290_state *st = iio_priv(indio_dev);
> +	int ret;
> +
> +	if (!readval)
> +		return adxrs290_spi_write_reg(st->spi, reg, writeval);
> +
> +	ret = spi_w8r8(st->spi, ADXRS290_READ_REG(reg));
> +	if (ret < 0)
> +		return ret;
> +
> +	*readval = ret;
> +
> +	return 0;
> +}
> +
>  static int adxrs290_data_rdy_trigger_set_state(struct iio_trigger *trig, bool state)
>  {
>  	struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
> @@ -547,6 +565,7 @@ static const struct iio_info adxrs290_info = {
>  	.read_raw = &adxrs290_read_raw,
>  	.write_raw = &adxrs290_write_raw,
>  	.read_avail = &adxrs290_read_avail,
> +	.debugfs_reg_access = &adxrs290_reg_access,
>  };
>  
>  static int adxrs290_probe_trigger(struct iio_dev *indio_dev)


      reply	other threads:[~2020-08-29 16:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 12:47 [PATCH 0/3] iio: gyro: adxrs290: Add triggered buffer & debugfs support Nishant Malpani
2020-08-25 12:47 ` [PATCH 1/3] iio: gyro: adxrs290: Add triggered buffer support Nishant Malpani
2020-08-26 16:10   ` Andy Shevchenko
2020-09-02 10:31     ` Nishant Malpani
2020-08-29 16:46   ` Jonathan Cameron
2020-09-03 12:37     ` Nishant Malpani
2020-09-06 14:51       ` Jonathan Cameron
2020-08-25 12:47 ` [PATCH 2/3] dt-bindings: iio: gyro: adxrs290: Add required interrupts property Nishant Malpani
2020-08-29 16:48   ` Jonathan Cameron
2020-09-03 12:46     ` Nishant Malpani
2020-08-25 12:47 ` [PATCH 3/3] iio: gyro: adxrs290: Add debugfs register access support Nishant Malpani
2020-08-29 16:51   ` Jonathan Cameron [this message]

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=20200829175104.62142a31@archlinux \
    --to=jic23@kernel.org \
    --cc=darius.berghe@analog.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dragos.bogdan@analog.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nish.malpani25@gmail.com \
    --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).