public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Angelo Dureghello <adureghello@baylibre.com>
Cc: Michael Hennerich <michael.hennerich@analog.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Alexandru Ardelean <aardelean@baylibre.com>,
	David Lechner <dlechner@baylibre.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	linux-fbdev@vger.kernel.org, linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Guillaume Stols <gstols@baylibre.com>
Subject: Re: [PATCH v3 10/10] iio: adc: ad7606: add support for writing registers when using backend
Date: Sat, 1 Feb 2025 13:14:45 +0000	[thread overview]
Message-ID: <20250201131445.12ceb7e9@jic23-huawei> (raw)
In-Reply-To: <20250129-wip-bl-ad7606_add_backend_sw_mode-v3-10-c3aec77c0ab7@baylibre.com>

On Wed, 29 Jan 2025 12:03:11 +0100
Angelo Dureghello <adureghello@baylibre.com> wrote:

> From: Guillaume Stols <gstols@baylibre.com>
> 
> Add the logic for effectively enabling the software mode for the
> iio-backend, i.e. enabling the software mode channel configuration and
> implementing the register writing functions.
> 
> Signed-off-by: Guillaume Stols <gstols@baylibre.com>
> Co-developed-by: Angelo Dureghello <adureghello@baylibre.com>
> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>

A few trivial things inline.

> diff --git a/drivers/iio/adc/ad7606_par.c b/drivers/iio/adc/ad7606_par.c
> index 64733b607aa8..19d93ae49e1d 100644
> --- a/drivers/iio/adc/ad7606_par.c
> +++ b/drivers/iio/adc/ad7606_par.c
> @@ -19,6 +19,7 @@

>  
> -static int ad7606_bi_update_scan_mode(struct iio_dev *indio_dev, const unsigned long *scan_mask)
> +static const struct iio_chan_spec ad7606b_bi_sw_channels[] = {
> +	AD7606_BI_SW_CHANNEL(0),
> +	AD7606_BI_SW_CHANNEL(1),
> +	AD7606_BI_SW_CHANNEL(2),
> +	AD7606_BI_SW_CHANNEL(3),
> +	AD7606_BI_SW_CHANNEL(4),
> +	AD7606_BI_SW_CHANNEL(5),
> +	AD7606_BI_SW_CHANNEL(6),
> +	AD7606_BI_SW_CHANNEL(7),
> +};
> +
> +static int ad7606_par_bus_update_scan_mode(struct iio_dev *indio_dev,
> +					   const unsigned long *scan_mask)
>  {
>  	struct ad7606_state *st = iio_priv(indio_dev);
>  	unsigned int c, ret;
> @@ -48,7 +61,8 @@ static int ad7606_bi_update_scan_mode(struct iio_dev *indio_dev, const unsigned
>  	return 0;
>  }
>  
> -static int ad7606_bi_setup_iio_backend(struct device *dev, struct iio_dev *indio_dev)
> +static int ad7606_par_bus_setup_iio_backend(struct device *dev,
> +					    struct iio_dev *indio_dev)
>  {
>  	struct ad7606_state *st = iio_priv(indio_dev);
>  	unsigned int ret, c;
> @@ -86,9 +100,56 @@ static int ad7606_bi_setup_iio_backend(struct device *dev, struct iio_dev *indio
>  	return 0;
>  }
>  
> +static int ad7606_par_bus_reg_read(struct iio_dev *indio_dev, unsigned int addr)
> +{
> +	struct ad7606_state *st = iio_priv(indio_dev);
> +	int val, ret;
> +	struct ad7606_platform_data *pdata =  st->dev->platform_data;
Bonus space before st that shouldn't be there.

I'd also reorder this to have int val, ret last.

> +
> +	ret = iio_device_claim_direct_mode(indio_dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = pdata->bus_reg_read(st->back, addr, &val);
> +
> +	iio_device_release_direct_mode(indio_dev);
> +	if (ret < 0)
> +		return ret;
> +
> +	return val;
> +}
> +
> +static int ad7606_par_bus_reg_write(struct iio_dev *indio_dev,
> +				    unsigned int addr, unsigned int val)
> +{
> +	struct ad7606_state *st = iio_priv(indio_dev);
> +	struct ad7606_platform_data *pdata =  st->dev->platform_data;

Same bonus space.

> +	int ret;
> +
> +	ret = iio_device_claim_direct_mode(indio_dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = pdata->bus_reg_write(st->back, addr, val);
> +
> +	iio_device_release_direct_mode(indio_dev);
> +
> +	return ret;
> +}


      reply	other threads:[~2025-02-01 13:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-29 11:03 [PATCH v3 00/10] add support for Software mode on AD7606's iio backend driver Angelo Dureghello
2025-01-29 11:03 ` [PATCH v3 01/10] dt-bindings: iio: dac: adi-axi-adc: fix ad7606 pwm-names Angelo Dureghello
2025-01-29 16:43   ` Rob Herring (Arm)
2025-02-01 12:54     ` Jonathan Cameron
2025-01-29 11:03 ` [PATCH v3 02/10] dt-bindings: iio: dac: adi-axi-adc: add ad7606 variant Angelo Dureghello
2025-01-29 16:46   ` Rob Herring (Arm)
2025-01-29 11:03 ` [PATCH v3 03/10] iio: adc: ad7606: fix wrong scale available Angelo Dureghello
2025-02-01 12:57   ` Jonathan Cameron
2025-01-29 11:03 ` [PATCH v3 04/10] iio: adc: ad7606: move the software mode configuration Angelo Dureghello
2025-01-29 11:03 ` [PATCH v3 05/10] iio: adc: ad7606: move software functions into common file Angelo Dureghello
2025-01-29 11:03 ` [PATCH v3 06/10] iio: adc: adi-axi-adc: add platform children support Angelo Dureghello
2025-01-31 21:17   ` David Lechner
2025-01-29 11:03 ` [PATCH v3 07/10] iio: adc: adi-axi-adc: add support for AD7606 register writing Angelo Dureghello
2025-01-31 21:27   ` David Lechner
2025-02-01 13:07   ` Jonathan Cameron
2025-01-29 11:03 ` [PATCH v3 08/10] iio: adc: ad7606: change r/w_register signature Angelo Dureghello
2025-01-31 21:31   ` David Lechner
2025-02-01 12:53     ` Jonathan Cameron
2025-01-29 11:03 ` [PATCH v3 09/10] iio: adc: ad7606: change channel macros parameters Angelo Dureghello
2025-01-29 11:03 ` [PATCH v3 10/10] iio: adc: ad7606: add support for writing registers when using backend Angelo Dureghello
2025-02-01 13:14   ` 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=20250201131445.12ceb7e9@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=aardelean@baylibre.com \
    --cc=adureghello@baylibre.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gstols@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    --cc=robh@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