Re: [PATCH 12/12] iio: adc: adi-axi-adc: move to backend framework

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

 



On Tue, Nov 21, 2023 at 4:17 AM Nuno Sa via B4 Relay
<devnull+nuno.sa.analog.com@xxxxxxxxxx> wrote:
>
> From: Nuno Sa <nuno.sa@xxxxxxxxxx>
>
> Move to the IIO backend framework. Devices supported by adi-axi-adc now
> register themselves as backend devices.
>
> Signed-off-by: Nuno Sa <nuno.sa@xxxxxxxxxx>
> ---
>  drivers/iio/adc/Kconfig       |   1 +
>  drivers/iio/adc/adi-axi-adc.c | 364 ++++++++----------------------------------
>  2 files changed, 65 insertions(+), 300 deletions(-)
>
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index af56df63beff..cc42a3399c63 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -292,6 +292,7 @@ config ADI_AXI_ADC
>         select IIO_BUFFER
>         select IIO_BUFFER_HW_CONSUMER
>         select IIO_BUFFER_DMAENGINE
> +       select IIO_BACKEND
>         depends on HAS_IOMEM
>         depends on OF
>         help
> diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c
> index c247ff1541d2..b2ab2c119efa 100644
> --- a/drivers/iio/adc/adi-axi-adc.c
> +++ b/drivers/iio/adc/adi-axi-adc.c

<snip>

> @@ -390,37 +166,23 @@ static int adi_axi_adc_probe(struct platform_device *pdev)
>         if (ret)
>                 return ret;
>
> -       if (cl->info->version > ver) {
> +       if (*expected_ver > ver) {
>                 dev_err(&pdev->dev,
>                         "IP core version is too old. Expected %d.%.2d.%c, Reported %d.%.2d.%c\n",
> -                       ADI_AXI_PCORE_VER_MAJOR(cl->info->version),
> -                       ADI_AXI_PCORE_VER_MINOR(cl->info->version),
> -                       ADI_AXI_PCORE_VER_PATCH(cl->info->version),
> +                       ADI_AXI_PCORE_VER_MAJOR(*expected_ver),
> +                       ADI_AXI_PCORE_VER_MINOR(*expected_ver),
> +                       ADI_AXI_PCORE_VER_PATCH(*expected_ver),
>                         ADI_AXI_PCORE_VER_MAJOR(ver),
>                         ADI_AXI_PCORE_VER_MINOR(ver),
>                         ADI_AXI_PCORE_VER_PATCH(ver));
>                 return -ENODEV;
>         }
>
> -       indio_dev->info = &adi_axi_adc_info;
> -       indio_dev->name = "adi-axi-adc";
> -       indio_dev->modes = INDIO_DIRECT_MODE;
> -       indio_dev->num_channels = conv->chip_info->num_channels;
> -       indio_dev->channels = conv->chip_info->channels;
> -
> -       ret = adi_axi_adc_config_dma_buffer(&pdev->dev, indio_dev);
> +       ret = devm_iio_backend_register(&pdev->dev, &adi_axi_adc_generic, st);
>         if (ret)
>                 return ret;
>
> -       ret = adi_axi_adc_setup_channels(&pdev->dev, st);
> -       if (ret)
> -               return ret;
> -
> -       ret = devm_iio_device_register(&pdev->dev, indio_dev);
> -       if (ret)
> -               return ret;
> -
> -       dev_info(&pdev->dev, "AXI ADC IP core (%d.%.2d.%c) probed\n",
> +       dev_info(&pdev->dev, "AXI ADC IP core (%d.%.2d.%d) probed\n",

Was this format change intentional? There are other places above where
%c is still used.

>                  ADI_AXI_PCORE_VER_MAJOR(ver),
>                  ADI_AXI_PCORE_VER_MINOR(ver),
>                  ADI_AXI_PCORE_VER_PATCH(ver));
> @@ -428,6 +190,8 @@ static int adi_axi_adc_probe(struct platform_device *pdev)
>         return 0;
>  }
>
> +static unsigned int adi_axi_adc_10_0_a_info = ADI_AXI_PCORE_VER(10, 0, 'a');
> +
>  /* Match table for of_platform binding */
>  static const struct of_device_id adi_axi_adc_of_match[] = {
>         { .compatible = "adi,axi-adc-10.0.a", .data = &adi_axi_adc_10_0_a_info },
>
> --
> 2.42.1
>
>





[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