mbox series

[v2,0/8] iio: add new backend framework

Message ID 20231208-dev-iio-backend-v2-0-5450951895e1@analog.com (mailing list archive)
Headers show
Series iio: add new backend framework | expand

Message

Nuno Sa via B4 Relay Dec. 8, 2023, 3:14 p.m. UTC
This series depends on [1] and it only build on top of it. The point is
to already speed up the reviewing of the framework. That obviously means
that all those pacthes were dropped in v2.

v1:
 https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f5175273b81dbfe40b7f0daffcdc67d6cb8ff

Changes in v2:
 - Patch 1-2 and 5
   * new patches.
 - Patch 6:
   * Fixed some docs failures;
   * Fixed a legacy 'conv' name in one of the function parameters;
   * Added .request_buffer() and .free_buffer() ops;
   * Refactored the helper macros;
   * Added Olivier as Reviewer.
 - Patch 7:
   * Use new devm_iio_backend_request_buffer().
 - Patch 8:
   * Implement new .request_buffer() and .free_buffer() ops;

Also would like to mention that in v2 I'm experimenting in having the
DMA on the backend device (as discussed with David in v1). Does not look
to bad but as I said before, I'm not seeing a big issue if we end up
having the buffer allocation in the frontend.

For the bindings folks:

I'm introducing a new io-backends property in the ad9467 bindings but I'm
not sure this is the way to do it. Ideally that new property become a
generic schema and I'm guessing I should send a PULL to?

https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/iio/iio-consumer.yaml

(Jonathan, if you think that's not the right place, shout now :))

I'm also deprecating 'adi,adc-dev' as it is not relevant anymore. In the
driver code, we are actually breaking ABI but I'm taking a more
conservative approach in the bindings. Ideally I would also remove it in
the bindings :).
 

As requested here we have a small diagram that illustrated on e typical
usage of the new framework:

                                           -------------------------------------------------------
 ------------------                        | -----------         ------------      -------  FPGA |
 |     ADC        |------------------------| | AXI ADC |---------| DMA CORE |------| RAM |       |
 | (Frontend/IIO) | Serial Data (eg: LVDS) | |(backend)|---------|          |------|     |       |
 |                |------------------------| -----------         ------------      -------       |
 ------------------                        -------------------------------------------------------
 
The above is highly focused on ADI usecases. But one can see the idea...
The frontend is the real converter and is the one registering and
handling all the IIO interfaces. Such a device can then connect to a
backend device for further services/configurations. In the above
example, the backend device is an high speed core capable of handling
the high sample rate of these ADCs so that it can push that data further
in the pipeline (typically a DMA core) so the user can process the
samples with minimal losses.

Jonathan, I was also tempted in including the diagram in the source
file. Would that be a good idea?

[1]: https://lore.kernel.org/linux-iio/20231207-iio-backend-prep-v2-0-a4a33bc4d70e@analog.com

---
Nuno Sa (7):
      dt-bindings: adc: ad9467: document io-backend property
      dt-bindings: adc: axi-adc: deprecate 'adi,adc-dev'
      driver: core: allow modifying device_links flags
      iio: buffer-dmaengine: export buffer alloc and free functions
      iio: add the IIO backend framework
      iio: adc: ad9467: convert to backend framework
      iio: adc: adi-axi-adc: move to backend framework

Olivier Moysan (1):
      of: property: add device link support for io-backends

 .../devicetree/bindings/iio/adc/adi,ad9467.yaml    |   5 +
 .../devicetree/bindings/iio/adc/adi,axi-adc.yaml   |   4 +-
 MAINTAINERS                                        |   8 +
 drivers/base/core.c                                |  14 +-
 drivers/iio/Kconfig                                |   5 +
 drivers/iio/Makefile                               |   1 +
 drivers/iio/adc/Kconfig                            |   3 +-
 drivers/iio/adc/ad9467.c                           | 242 +++++++------
 drivers/iio/adc/adi-axi-adc.c                      | 379 +++++---------------
 drivers/iio/buffer/industrialio-buffer-dmaengine.c |   6 +-
 drivers/iio/industrialio-backend.c                 | 386 +++++++++++++++++++++
 drivers/of/property.c                              |   2 +
 include/linux/iio/adc/adi-axi-adc.h                |  68 ----
 include/linux/iio/backend.h                        |  68 ++++
 include/linux/iio/buffer-dmaengine.h               |   4 +-
 15 files changed, 727 insertions(+), 468 deletions(-)
---
base-commit: 330c0f834ccbdbe6a89da475cb1c56893f3a8363
change-id: 20231120-dev-iio-backend-d14b473a1d9f
--

Thanks!
- Nuno Sá

Comments

Conor Dooley Dec. 8, 2023, 3:30 p.m. UTC | #1
On Fri, Dec 08, 2023 at 04:14:07PM +0100, Nuno Sa via B4 Relay wrote:
> This series depends on [1] and it only build on top of it. The point is
> to already speed up the reviewing of the framework. That obviously means
> that all those pacthes were dropped in v2.
> 
> v1:
>  https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f5175273b81dbfe40b7f0daffcdc67d6cb8ff
> 
> Changes in v2:
>  - Patch 1-2 and 5
>    * new patches.
>  - Patch 6:
>    * Fixed some docs failures;
>    * Fixed a legacy 'conv' name in one of the function parameters;
>    * Added .request_buffer() and .free_buffer() ops;
>    * Refactored the helper macros;
>    * Added Olivier as Reviewer.
>  - Patch 7:
>    * Use new devm_iio_backend_request_buffer().
>  - Patch 8:
>    * Implement new .request_buffer() and .free_buffer() ops;
> 
> Also would like to mention that in v2 I'm experimenting in having the
> DMA on the backend device (as discussed with David in v1). Does not look
> to bad but as I said before, I'm not seeing a big issue if we end up
> having the buffer allocation in the frontend.
> 
> For the bindings folks:
> 
> I'm introducing a new io-backends property in the ad9467 bindings but I'm
> not sure this is the way to do it. Ideally that new property become a
> generic schema and I'm guessing I should send a PULL to?
> 
> https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/iio/iio-consumer.yaml

That seems like the right thing to do to me, depending on how widespread
the use of these backends might be. What is seemingly missing though,
from this cover and from the bindings patch in the series in particular,
is an explanation of what the "iio-backends" hardware actually is.

There is some text below, but it does not seem complete to me. Is the
idea that this "backend" is shared between multiple frontend consumers?
The one example is described as being "highly focused on ADI usecases"

Thanks,
Conor.

> 
> (Jonathan, if you think that's not the right place, shout now :))
> 
> I'm also deprecating 'adi,adc-dev' as it is not relevant anymore. In the
> driver code, we are actually breaking ABI but I'm taking a more
> conservative approach in the bindings. Ideally I would also remove it in
> the bindings :).
>  
> 
> As requested here we have a small diagram that illustrated on e typical
> usage of the new framework:
> 
>                                            -------------------------------------------------------
>  ------------------                        | -----------         ------------      -------  FPGA |
>  |     ADC        |------------------------| | AXI ADC |---------| DMA CORE |------| RAM |       |
>  | (Frontend/IIO) | Serial Data (eg: LVDS) | |(backend)|---------|          |------|     |       |
>  |                |------------------------| -----------         ------------      -------       |
>  ------------------                        -------------------------------------------------------
>  
> The above is highly focused on ADI usecases. But one can see the idea...
> The frontend is the real converter and is the one registering and
> handling all the IIO interfaces. Such a device can then connect to a
> backend device for further services/configurations. In the above
> example, the backend device is an high speed core capable of handling
> the high sample rate of these ADCs so that it can push that data further
> in the pipeline (typically a DMA core) so the user can process the
> samples with minimal losses.
> 
> Jonathan, I was also tempted in including the diagram in the source
> file. Would that be a good idea?
> 
> [1]: https://lore.kernel.org/linux-iio/20231207-iio-backend-prep-v2-0-a4a33bc4d70e@analog.com
> 
> ---
> Nuno Sa (7):
>       dt-bindings: adc: ad9467: document io-backend property
>       dt-bindings: adc: axi-adc: deprecate 'adi,adc-dev'
>       driver: core: allow modifying device_links flags
>       iio: buffer-dmaengine: export buffer alloc and free functions
>       iio: add the IIO backend framework
>       iio: adc: ad9467: convert to backend framework
>       iio: adc: adi-axi-adc: move to backend framework
> 
> Olivier Moysan (1):
>       of: property: add device link support for io-backends
> 
>  .../devicetree/bindings/iio/adc/adi,ad9467.yaml    |   5 +
>  .../devicetree/bindings/iio/adc/adi,axi-adc.yaml   |   4 +-
>  MAINTAINERS                                        |   8 +
>  drivers/base/core.c                                |  14 +-
>  drivers/iio/Kconfig                                |   5 +
>  drivers/iio/Makefile                               |   1 +
>  drivers/iio/adc/Kconfig                            |   3 +-
>  drivers/iio/adc/ad9467.c                           | 242 +++++++------
>  drivers/iio/adc/adi-axi-adc.c                      | 379 +++++---------------
>  drivers/iio/buffer/industrialio-buffer-dmaengine.c |   6 +-
>  drivers/iio/industrialio-backend.c                 | 386 +++++++++++++++++++++
>  drivers/of/property.c                              |   2 +
>  include/linux/iio/adc/adi-axi-adc.h                |  68 ----
>  include/linux/iio/backend.h                        |  68 ++++
>  include/linux/iio/buffer-dmaengine.h               |   4 +-
>  15 files changed, 727 insertions(+), 468 deletions(-)
> ---
> base-commit: 330c0f834ccbdbe6a89da475cb1c56893f3a8363
> change-id: 20231120-dev-iio-backend-d14b473a1d9f
> --
> 
> Thanks!
> - Nuno Sá
>
Nuno Sá Dec. 9, 2023, 2:32 p.m. UTC | #2
On Fri, 2023-12-08 at 15:30 +0000, Conor Dooley wrote:
> On Fri, Dec 08, 2023 at 04:14:07PM +0100, Nuno Sa via B4 Relay wrote:
> > This series depends on [1] and it only build on top of it. The point is
> > to already speed up the reviewing of the framework. That obviously means
> > that all those pacthes were dropped in v2.
> > 
> > v1:
> >  
> > https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f517
> > 5273b81dbfe40b7f0daffcdc67d6cb8ff
> > 
> > Changes in v2:
> >  - Patch 1-2 and 5
> >    * new patches.
> >  - Patch 6:
> >    * Fixed some docs failures;
> >    * Fixed a legacy 'conv' name in one of the function parameters;
> >    * Added .request_buffer() and .free_buffer() ops;
> >    * Refactored the helper macros;
> >    * Added Olivier as Reviewer.
> >  - Patch 7:
> >    * Use new devm_iio_backend_request_buffer().
> >  - Patch 8:
> >    * Implement new .request_buffer() and .free_buffer() ops;
> > 
> > Also would like to mention that in v2 I'm experimenting in having the
> > DMA on the backend device (as discussed with David in v1). Does not look
> > to bad but as I said before, I'm not seeing a big issue if we end up
> > having the buffer allocation in the frontend.
> > 
> > For the bindings folks:
> > 
> > I'm introducing a new io-backends property in the ad9467 bindings but I'm
> > not sure this is the way to do it. Ideally that new property become a
> > generic schema and I'm guessing I should send a PULL to?
> > 
> > https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/iio/iio-consumer.yaml
> 
> That seems like the right thing to do to me, depending on how widespread
> the use of these backends might be. What is seemingly missing though,
> from this cover and from the bindings patch in the series in particular,
> is an explanation of what the "iio-backends" hardware actually is.
> 

Yeah, sorry about the bindings patch but I was already with the feeling that a PR in
devicetree-org to be the right place. I'll be adding more drivers needing that
property and STM also wants make use this.

I'll improve on the explanation and send a PR for a generic schema.

> There is some text below, but it does not seem complete to me. Is the
> idea that this "backend" is shared between multiple frontend consumers?
> The one example is described as being "highly focused on ADI usecases"
> 

For now it cannot really be shared. The code is not prepared for it (we would need to
keep enable/disable counters etc...). For now, I'm just adding the simpler cases of
1:1 and 1:n (1 frontend for multiple backends). Internally we do have 1:n designs
that I definitely want (in time) to bring upstream.

That said, having a usecase for it in the future, it is something that can be added,
yes...

Thanks for the feedback!
- Nuno Sá
>
Conor Dooley Dec. 10, 2023, 2:04 p.m. UTC | #3
On Sat, Dec 09, 2023 at 03:32:33PM +0100, Nuno Sá wrote:
> On Fri, 2023-12-08 at 15:30 +0000, Conor Dooley wrote:
> > On Fri, Dec 08, 2023 at 04:14:07PM +0100, Nuno Sa via B4 Relay wrote:
> > > This series depends on [1] and it only build on top of it. The point is
> > > to already speed up the reviewing of the framework. That obviously means
> > > that all those pacthes were dropped in v2.
> > > 
> > > v1:
> > >  
> > > https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f517
> > > 5273b81dbfe40b7f0daffcdc67d6cb8ff
> > > 
> > > Changes in v2:
> > >  - Patch 1-2 and 5
> > >    * new patches.
> > >  - Patch 6:
> > >    * Fixed some docs failures;
> > >    * Fixed a legacy 'conv' name in one of the function parameters;
> > >    * Added .request_buffer() and .free_buffer() ops;
> > >    * Refactored the helper macros;
> > >    * Added Olivier as Reviewer.
> > >  - Patch 7:
> > >    * Use new devm_iio_backend_request_buffer().
> > >  - Patch 8:
> > >    * Implement new .request_buffer() and .free_buffer() ops;
> > > 
> > > Also would like to mention that in v2 I'm experimenting in having the
> > > DMA on the backend device (as discussed with David in v1). Does not look
> > > to bad but as I said before, I'm not seeing a big issue if we end up
> > > having the buffer allocation in the frontend.
> > > 
> > > For the bindings folks:
> > > 
> > > I'm introducing a new io-backends property in the ad9467 bindings but I'm
> > > not sure this is the way to do it. Ideally that new property become a
> > > generic schema and I'm guessing I should send a PULL to?
> > > 
> > > https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/iio/iio-consumer.yaml
> > 
> > That seems like the right thing to do to me, depending on how widespread
> > the use of these backends might be. What is seemingly missing though,
> > from this cover and from the bindings patch in the series in particular,
> > is an explanation of what the "iio-backends" hardware actually is.
> > 
> 
> Yeah, sorry about the bindings patch but I was already with the feeling that a PR in
> devicetree-org to be the right place. I'll be adding more drivers needing that
> property and STM also wants make use this.
> 
> I'll improve on the explanation and send a PR for a generic schema.
> 
> > There is some text below, but it does not seem complete to me. Is the
> > idea that this "backend" is shared between multiple frontend consumers?
> > The one example is described as being "highly focused on ADI usecases"
> > 
> 
> For now it cannot really be shared. The code is not prepared for it (we would need to
> keep enable/disable counters etc...). For now, I'm just adding the simpler cases of
> 1:1 and 1:n (1 frontend for multiple backends). Internally we do have 1:n designs
> that I definitely want (in time) to bring upstream.

TBH, I am not really interested in whether or not the drivers support it
at the moment, it just be great if the explanation of how these backends
work (the hardware, not the linux implementation) included that detail.
> 
> That said, having a usecase for it in the future, it is something that can be added,
> yes...
> 
> Thanks for the feedback!
> - Nuno Sá
> > 
>