devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: "Guillaume Stols" <gstols@baylibre.com>,
	"Uwe Kleine-König" <ukleinek@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>
Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-fbdev@vger.kernel.org, linux-iio@vger.kernel.org,
	 devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	aardelean@baylibre.com,  dlechner@baylibre.com,
	jstephan@baylibre.com,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v4 7/8] iio: adc: ad7606: Add iio-backend support
Date: Wed, 09 Oct 2024 16:55:33 +0200	[thread overview]
Message-ID: <66a4daad65dc8dbb319af38e26ee4290b08c7bff.camel@gmail.com> (raw)
In-Reply-To: <20241009-ad7606_add_iio_backend_support-v4-7-6971a8c0f1d5@baylibre.com>

On Wed, 2024-10-09 at 09:19 +0000, Guillaume Stols wrote:
> - Basic support for iio backend.
> - Supports IIO_CHAN_INFO_SAMP_FREQ R/W.
> - Only hardware mode is available, and that IIO_CHAN_INFO_RAW is not
>   supported if iio-backend mode is selected.
> 
> Signed-off-by: Guillaume Stols <gstols@baylibre.com>
> ---

Just minor stuff...

>  drivers/iio/adc/Kconfig      |   2 +
>  drivers/iio/adc/ad7606.c     | 156 ++++++++++++++++++++++++++++++++++---------
>  drivers/iio/adc/ad7606.h     |  15 +++++
>  drivers/iio/adc/ad7606_par.c |  93 +++++++++++++++++++++++++-
>  4 files changed, 234 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index 85b82a708c36..9f7e9fc4b1fe 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -224,9 +224,11 @@ config AD7606_IFACE_PARALLEL
>  	tristate "Analog Devices AD7606 ADC driver with parallel interface
> support"
>  	depends on HAS_IOPORT
>  	select AD7606
> +	select IIO_BACKEND
>  	help
>  	  Say yes here to build parallel interface support for Analog Devices:
>  	  ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC).
> +	  It also support iio_backended devices for AD7606B.
>  
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called ad7606_par.
> diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
> index ec902b268388..1313b5cbb0aa 100644
> --- a/drivers/iio/adc/ad7606.c
> +++ b/drivers/iio/adc/ad7606.c
> @@ -21,6 +21,7 @@
>  #include <linux/units.h>
>  #include <linux/util_macros.h>
>  
> +#include <linux/iio/backend.h>
>  #include <linux/iio/buffer.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> @@ -191,6 +192,7 @@ EXPORT_SYMBOL_NS_GPL(ad7606_4_info, IIO_AD7606);

>  const struct ad7606_chip_info ad7606b_info = {
>  	.channels = ad7606_channels_16bit,
> +	.max_samplerate = 800 * KILO,
>  	.name = "ad7606b",
>  	.num_adc_channels = 8,
>  	.num_channels = 9,
> @@ -496,6 +498,20 @@ static int ad7606_pwm_set_low(struct ad7606_state *st)
>  	return ret;
>  }
>  
> +static int ad7606_pwm_set_swing(struct ad7606_state *st)
> +{
> +	struct pwm_state cnvst_pwm_state;
> +
> +	if (!st->cnvst_pwm)
> +		return -EINVAL;
> +

Can we get into this function without knowing cnvst_pwm must be present? IOW, do we
really need the above check?

...

> @@ -96,9 +170,23 @@ static int ad7606_par_probe(struct platform_device *pdev)
>  	void __iomem *addr;
>  	resource_size_t remap_size;
>  	int irq;
> +	struct iio_backend *back;
>  
> +	/*
> +	 * If a firmware node is available (ACPI or DT), platform_device_id is
> null
> +	 * and we must use get_match_data.
> +	 */
>  	if (dev_fwnode(&pdev->dev)) {
>  		chip_info = device_get_match_data(&pdev->dev);
> +		back = devm_iio_backend_get(&pdev->dev, NULL);

Can't we use device_property_present()? 

- Nuno Sá


  reply	other threads:[~2024-10-09 14:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09  9:19 [PATCH v4 0/8] Add iio backend compatibility for ad7606 Guillaume Stols
2024-10-09  9:19 ` [PATCH v4 1/8] dt-bindings: iio: adc: ad7606: Remove spi-cpha from required Guillaume Stols
2024-10-09  9:19 ` [PATCH v4 2/8] dt-bindings: iio: adc: ad7606: Add iio backend bindings Guillaume Stols
2024-10-09  9:19 ` [PATCH v4 3/8] Documentation: iio: Document ad7606 driver Guillaume Stols
2024-10-09  9:19 ` [PATCH v4 4/8] iio: adc: ad7606: Add PWM support for conversion trigger Guillaume Stols
2024-10-09 14:29   ` Nuno Sá
2024-10-09  9:19 ` [PATCH v4 5/8] iio: adc: ad7606: Add compatibility to fw_nodes Guillaume Stols
2024-10-09 14:39   ` Nuno Sá
2024-10-09 14:53     ` Guillaume Stols
2024-10-09 14:59       ` Nuno Sá
2024-10-09  9:19 ` [PATCH v4 6/8] iio: adc: ad7606: Introduce num_adc_channels Guillaume Stols
2024-10-09 14:40   ` Nuno Sá
2024-10-09  9:19 ` [PATCH v4 7/8] iio: adc: ad7606: Add iio-backend support Guillaume Stols
2024-10-09 14:55   ` Nuno Sá [this message]
2024-10-09  9:19 ` [PATCH v4 8/8] iio: adc: ad7606: Disable PWM usage for non backend version Guillaume Stols
2024-10-09 14:45   ` Nuno Sá
2024-10-12 12:48     ` 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=66a4daad65dc8dbb319af38e26ee4290b08c7bff.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=aardelean@baylibre.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gstols@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=jstephan@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=ukleinek@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).