Re: [PATCH v4 7/8] iio: adc: ad7606: Add iio-backend support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
> ---

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á






[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux