iio: add new backend framework
Subsystems (7)
Nuno Sa
maintainerv3 cover iio: add new backend framework
v2:
https://lore.kernel.org/r/[email protected]
Changes in v3:
- Patch 1:
* Use proposed generic schema [1]. Also make it a required property;
* Improved the commit message.
- Patch 2:
* Improved commit message.
- Patch 4:
* Namespace all IIO DMAENGINE buffer exports;
* Removed unrelated new line removal change.
- Patch 5:
* Namespace all IIO backend exports.
- Patch 6:
* Set backend.h in alphabetical order;
* Import IIO backend namespace.
- Patch 7:
* Don't depend on OF in kbuild anymore;
* Import IIO backend namespace.
For the bindings patches, I tried not to enter into much details about the IIO framework as I think specifics of the implementation don't care from the bindings perspective. Hopefully the commit messages are good enough.
I'm also aware that patch 1 is not backward compatible but we are anyways doing it on the driver side (and on the driver the property is indeed required). Anyways, just let me know if making the property required is not acceptable (I'm fairly confident no one was using the upstream version of the driver and so validating devicetrees for it).
Keeping the block diagram in v3's cover so we don't have to follow links to check the one of the typicals setups.
------------------------------------------------------- ------------------ | ----------- ------------ ------- FPGA | | ADC |------------------------| | AXI ADC |---------| DMA CORE |------| RAM | | | (Frontend/IIO) | Serial Data (eg: LVDS) | |(backend)|---------| |------| | | | |------------------------| ----------- ------------ ------- | ------------------ -------------------------------------------------------
Jonathan, I was also tempted in including the diagram in the source file. Would that be a good idea?
[1]: https://github.com/devicetree-org/dt-schema/pull/120
---
Nuno Sa (7):
dt-bindings: adc: ad9467: add new 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 | 4 +- drivers/iio/adc/ad9467.c | 243 +++++++------ drivers/iio/adc/adi-axi-adc.c | 381 +++++--------------- drivers/iio/buffer/industrialio-buffer-dmaengine.c | 8 +- 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 | 3 + 15 files changed, 730 insertions(+), 470 deletions(-)
---
base-commit: 3cde3cdb0b23151dbaac476b17eb1868335993aa
change-id: 20231120-dev-iio-backend-d14b473a1d9f --
Thanks!
- Nuno Sá
Nuno Sa
maintainerPATCH v3 1/8 dt-bindings: adc: ad9467: add new io-backend property
The ad9467 will make use of the new IIO backend framework which is a provider - consumer interface where IIO backends provide services to consumers. As such, and being this device a consumer, add the new generic io-backend property to the bindings.
--- Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml +5 -0
@@ -44,6 +44,9 @@ properties: Pin that controls the powerdown mode of the device. maxItems: 1 + io-backends: + maxItems: 1 + reset-gpios: description: Reset pin for the device.
@@ -54,6 +57,7 @@ required: - reg - clocks - clock-names + - io-backends additionalProperties: false
@@ -68,6 +72,7 @@ examples: reg = <0>; clocks = <&adc_clk>; clock-names = "adc-clk"; + io-backends = <&iio_backend>; }; }; ...
Signature · 1 line
2.43.0
Rob Herring
maintainerRe: [PATCH v3 1/8] dt-bindings: adc: ad9467: add new io-backend property
Quoted 10 lines · Nuno Sa
The ad9467 will make use of the new IIO backend framework which is a provider - consumer interface where IIO backends provide services to consumers. As such, and being this device a consumer, add the new generic io-backend property to the bindings.
Signed-off-by Nuno Sa <[email protected]>--- Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml | 5 +++++ 1 file changed, 5 insertions(+)
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml: io-backends: missing type definition
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Re: [PATCH v3 1/8] dt-bindings: adc: ad9467: add new io-backend property
Quoted 35 lines · Rob Herring
Quoted 10 lines · Nuno Sa
The ad9467 will make use of the new IIO backend framework which is a provider - consumer interface where IIO backends provide services to consumers. As such, and being this device a consumer, add the new generic io-backend property to the bindings.
Signed-off-by Nuno Sa <[email protected]>---
Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml | 5 +++++1 file changed, 5 insertions(+)My bot found errors running 'make DT_CHECKER_FLAGS=-m
dt_binding_check' on your patch (DT_CHECKER_FLAGSis new in v5.13):yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml: io-backends:
missing type definitiondoc reference errors (make refcheckdocs):
See
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
Quoted 6 lines
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that
DT_SCHEMA_FILEScan be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
This is kind of expected as the property is being proposed as a generic one...
- Nuno Sá
Rob Herring
maintainerRe: [PATCH v3 1/8] dt-bindings: adc: ad9467: add new io-backend property
In reply to Nuno SaQuoted 25 lines · Nuno Sa
The ad9467 will make use of the new IIO backend framework which is a provider - consumer interface where IIO backends provide services to consumers. As such, and being this device a consumer, add the new generic io-backend property to the bindings.
Signed-off-by Nuno Sa <[email protected]>--- Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml +3
-0@@ -44,6 +44,9 @@ properties: Pin that controls the powerdown mode of the device. maxItems: 1 + io-backends: + maxItems: 1 + reset-gpios: description: Reset pin for the device.
Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml required: · line 60
Quoted 4 lines
Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml +1
-0@@ -54,6 +57,7 @@ required: - reg - clocks - clock-names + - io-backends
New required properties are an ABI break. Please justify this in the commit message.
Rob
Re: [PATCH v3 1/8] dt-bindings: adc: ad9467: add new io-backend property
Quoted 26 lines · Rob Herring
Quoted 25 lines · Nuno Sa
The ad9467 will make use of the new IIO backend framework which is a provider - consumer interface where IIO backends provide services to consumers. As such, and being this device a consumer, add the new generic io-backend property to the bindings.
Signed-off-by Nuno Sa <[email protected]>---
Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml | 5 +++++1 file changed, 5 insertions(+)Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml +0
-0@@ -44,6 +44,9 @@ properties:Pin that controls the powerdown mode of the device.
maxItems: 1
+ io-backends:
+ maxItems: 1
+
reset-gpios:
description:
Reset pin for the device.
Quoted 9 lines
Quoted 5 lines
Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml +0
-0@@ -54,6 +57,7 @@ required:- reg
- clocks
- clock-names
+ - io-backendsNew required properties are an ABI break. Please justify this in the commit message.
Yeah, I know... I'll further comment on the cover and depending on the conclusion we get I'll justify it (or not if not needed) in the message.
- Nuno Sá
Nuno Sa
maintainerPATCH v3 2/8 dt-bindings: adc: axi-adc: deprecate 'adi,adc-dev'
In reply to Nuno Sa'adi,adc-dev' is now deprecated and must not be used anymore. Hence, also remove it from being required.
The reason why it's being deprecated is because the axi-adc CORE is now an IIO service provider hardware (IIO backends) for consumers to make use of. Before, the logic with 'adi,adc-dev' was the opposite (it was kind of consumer referencing other nodes/devices) and that proved to be wrong and to not scale.
Now, IIO consumers of this hardware are expected to reference it using the io-backends property.
--- Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml +1 -3
@@ -39,12 +39,12 @@ properties: $ref: /schemas/types.yaml#/definitions/phandle description: A reference to a the actual ADC to which this FPGA ADC interfaces to. + deprecated: true required: - compatible - dmas - reg - - adi,adc-dev additionalProperties: false
@@ -55,7 +55,5 @@ examples: reg = <0x44a00000 0x10000>; dmas = <&rx_dma 0>; dma-names = "rx"; - - adi,adc-dev = <&spi_adc>; }; ...
Signature · 1 line
2.43.0
Nuno Sa
maintainerPATCH v3 3/8 driver: core: allow modifying device_links flags
In reply to Nuno SaIf a device_link is previously created (eg: via fw_devlink_create_devlink()) before the supplier + consumer are both present and bound to their respective drivers, there's no way to set DL_FLAG_AUTOREMOVE_CONSUMER anymore while one can still set DL_FLAG_AUTOREMOVE_SUPPLIER. Hence, rework the flags checks to allow for DL_FLAG_AUTOREMOVE_CONSUMER in the same way DL_FLAG_AUTOREMOVE_SUPPLIER is done.
While at it, make sure that we are never left with DL_FLAG_AUTOPROBE_CONSUMER set together with one of DL_FLAG_AUTOREMOVE_CONSUMER or DL_FLAG_AUTOREMOVE_SUPPLIER.
--- drivers/base/core.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/base/core.c +9 -5
@@ -807,11 +807,15 @@ struct device_link *device_link_add(struct device *consumer,* update the existing link to stay around longer. */ if (flags &DL_FLAG_AUTOREMOVE_SUPPLIER ) { -if (link->flags &DL_FLAG_AUTOREMOVE_CONSUMER ) { - link->flags &= ~DL_FLAG_AUTOREMOVE_CONSUMER ; - link->flags |=DL_FLAG_AUTOREMOVE_SUPPLIER ; - } - }else if (!(flags &DL_FLAG_AUTOREMOVE_CONSUMER )) { + link->flags &= ~DL_FLAG_AUTOREMOVE_CONSUMER ; + link->flags &= ~DL_FLAG_AUTOPROBE_CONSUMER ; + link->flags |=DL_FLAG_AUTOREMOVE_SUPPLIER ; + + }else if (flags &DL_FLAG_AUTOREMOVE_CONSUMER ) { + link->flags &= ~DL_FLAG_AUTOREMOVE_SUPPLIER ; + link->flags &= ~DL_FLAG_AUTOPROBE_CONSUMER ; + link->flags |=DL_FLAG_AUTOREMOVE_CONSUMER ; + }else { link->flags &= ~(DL_FLAG_AUTOREMOVE_CONSUMER |DL_FLAG_AUTOREMOVE_SUPPLIER ); }
Signature · 1 line
2.43.0
Nuno Sa
maintainerPATCH v3 4/8 of: property: add device link support for io-backends
In reply to Nuno SaFrom: Olivier Moysan <[email protected]>
Add support for creating device links out of more DT properties.
--- drivers/of/property.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/of/property.c +2 -0
@@ -1244,6 +1244,7 @@ DEFINE_SIMPLE_PROP(interconnects, "interconnects", "#interconnect-cells") DEFINE_SIMPLE_PROP(iommus, "iommus", "#iommu-cells") DEFINE_SIMPLE_PROP(mboxes, "mboxes", "#mbox-cells") DEFINE_SIMPLE_PROP(io_channels, "io-channel", "#io-channel-cells") +DEFINE_SIMPLE_PROP(io_backends, "io-backends", NULL) DEFINE_SIMPLE_PROP(interrupt_parent, "interrupt-parent", NULL) DEFINE_SIMPLE_PROP(dmas, "dmas", "#dma-cells")DEFINE_SIMPLE_PROP (power_domains,"power-domains" ,"#power-domain-cells" )
@@ -1334,6 +1335,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_iommu_maps, .optional = true, }, { .parse_prop = parse_mboxes, }, { .parse_prop = parse_io_channels, }, + { .parse_prop = parse_io_backends, }, { .parse_prop = parse_interrupt_parent, }, { .parse_prop = parse_dmas, .optional = true, }, { .parse_prop = parse_power_domains, },
Signature · 1 line
2.43.0
Nuno Sa
maintainerPATCH v3 5/8 iio: buffer-dmaengine: export buffer alloc and free functions
In reply to Nuno SaExport iio_dmaengine_buffer_free() and iio_dmaengine_buffer_alloc(). This is in preparation of introducing IIO backends support. This will allow us to allocate a buffer and control it's lifetime from a device different from the one holding the DMA firmware properties. Effectively, in this case the struct device holding the firmware information about the DMA channels is not the same as iio_dev->dev.parent (typical case).
While at it, namespace the buffer-dmaengine exports and update the current user of these buffers.
--- drivers/iio/adc/adi-axi-adc.c | 1 + drivers/iio/buffer/industrialio-buffer-dmaengine.c | 8 +++++--- include/linux/iio/buffer-dmaengine.h | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-)
drivers/iio/adc/adi-axi-adc.c +1 -0
@@ -447,3 +447,4 @@ module_platform_driver(adi_axi_adc_driver);MODULE_AUTHOR ("Michael Hennerich <[email protected]>" );MODULE_DESCRIPTION ("Analog Devices Generic AXI ADC IP core driver" );MODULE_LICENSE ("GPL v2" ); +MODULE_IMPORT_NS (IIO_DMAENGINE_BUFFER );
drivers/iio/buffer/industrialio-buffer-dmaengine.c +5 -3
@@ -159,7 +159,7 @@ static const struct iio_dev_attr *iio_dmaengine_buffer_attrs[] = {* Once done using the buffer iio_dmaengine_buffer_free() should be used to * release it. */ -static struct iio_buffer *iio_dmaengine_buffer_alloc (struct device *dev, +struct iio_buffer *iio_dmaengine_buffer_alloc (struct device *dev,const char *channel) {struct dmaengine_buffer *dmaengine_buffer;
@@ -210,6 +210,7 @@ static struct iio_buffer *iio_dmaengine_buffer_alloc(struct device *dev,kfree (dmaengine_buffer);return ERR_PTR (ret); } +EXPORT_SYMBOL_NS_GPL (iio_dmaengine_buffer_alloc,IIO_DMAENGINE_BUFFER );/** * iio_dmaengine_buffer_free() - Free dmaengine buffer
@@ -217,7 +218,7 @@ static struct iio_buffer *iio_dmaengine_buffer_alloc(struct device *dev,* * Frees a buffer previously allocated with iio_dmaengine_buffer_alloc(). */ -static void iio_dmaengine_buffer_free (struct iio_buffer *buffer) +void iio_dmaengine_buffer_free (struct iio_buffer *buffer) {struct dmaengine_buffer *dmaengine_buffer =iio_buffer_to_dmaengine_buffer (buffer);
@@ -227,6 +228,7 @@ static void iio_dmaengine_buffer_free(struct iio_buffer *buffer)iio_buffer_put (buffer); } +EXPORT_SYMBOL_NS_GPL (iio_dmaengine_buffer_free,IIO_DMAENGINE_BUFFER );static void __devm_iio_dmaengine_buffer_free (void *buffer) {
@@ -288,7 +290,7 @@ int devm_iio_dmaengine_buffer_setup(struct device *dev,return iio_device_attach_buffer (indio_dev, buffer); } -EXPORT_SYMBOL_GPL (devm_iio_dmaengine_buffer_setup); +EXPORT_SYMBOL_NS_GPL (devm_iio_dmaengine_buffer_setup,IIO_DMAENGINE_BUFFER );MODULE_AUTHOR ("Lars-Peter Clausen <[email protected]>" );MODULE_DESCRIPTION ("DMA buffer for the IIO framework" );
include/linux/iio/buffer-dmaengine.h +3 -0
@@ -10,6 +10,9 @@struct iio_dev ;struct device ; +struct iio_buffer *iio_dmaengine_buffer_alloc (struct device *dev, +const char *channel); +void iio_dmaengine_buffer_free (struct iio_buffer *buffer);int devm_iio_dmaengine_buffer_setup (struct device *dev,struct iio_dev *indio_dev,const char *channel);
Signature · 1 line
2.43.0
Nuno Sa
maintainerPATCH v3 6/8 iio: add the IIO backend framework
In reply to Nuno SaThis is a Framework to handle complex IIO aggregate devices.
The typical architecture is to have one device as the frontend device which can be "linked" against one or multiple backend devices. All the IIO and userspace interface is expected to be registers/managed by the frontend device which will callback into the backends when needed (to get/set some configuration that it does not directly control).
The basic framework interface is pretty simple:
- Backends should register themselves with @devm_iio_backend_register()
- Frontend devices should get backends with @devm_iio_backend_get()
--- MAINTAINERS | 8 + drivers/iio/Kconfig | 5 + drivers/iio/Makefile | 1 + drivers/iio/industrialio-backend.c | 386 +++++++++++++++++++++++++++++++++++++ include/linux/iio/backend.h | 68 +++++++ 5 files changed, 468 insertions(+)
MAINTAINERS +8 -0
@@ -10320,6 +10320,14 @@ L: [email protected] S: Maintained F: drivers/media/rc/iguanair.c +IIO BACKEND FRAMEWORK +M: Nuno Sa <[email protected]> +R: Olivier Moysan <[email protected]> +L: [email protected] +S: Maintained +F: drivers/iio/industrialio-backend.c +F: include/linux/iio/backend.h + IIO DIGITAL POTENTIOMETER DAC M: Peter Rosin <[email protected]> L: [email protected]
drivers/iio/Kconfig +5 -0
@@ -71,6 +71,11 @@ config IIO_TRIGGERED_EVENT help Provides helper functions for setting up triggered events. +config IIO_BACKEND + tristate + help + Framework to handle complex IIO aggregate devices. + source "drivers/iio/accel/Kconfig" source "drivers/iio/adc/Kconfig" source "drivers/iio/addac/Kconfig"
drivers/iio/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_IIO_GTS_HELPER) += industrialio-gts-helper.o obj-$(CONFIG_IIO_SW_DEVICE) += industrialio-sw-device.o obj-$(CONFIG_IIO_SW_TRIGGER) += industrialio-sw-trigger.o obj-$(CONFIG_IIO_TRIGGERED_EVENT) += industrialio-triggered-event.o +obj-$(CONFIG_IIO_BACKEND) += industrialio-backend.o obj-y += accel/ obj-y += adc/
drivers/iio/industrialio-backend.c new file +386 -0
386 lines not on this page · raw message
include/linux/iio/backend.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
2.43.0
Nuno Sa
maintainerPATCH v3 7/8 iio: adc: ad9467: convert to backend framework
In reply to Nuno SaConvert the driver to use the new IIO backend framework. The device functionality is expected to be the same (meaning no added or removed features).
Also note this patch effectively breaks ABI and that's needed so we can properly support this device and add needed features making use of the new IIO framework.
--- drivers/iio/adc/Kconfig | 2 +- drivers/iio/adc/ad9467.c | 243 +++++++++++++++++++++++++++-------------------- 2 files changed, 143 insertions(+), 102 deletions(-)
drivers/iio/adc/Kconfig +1 -1
@@ -275,7 +275,7 @@ config AD799X config AD9467 tristate "Analog Devices AD9467 High Speed ADC driver" depends on SPI - depends on ADI_AXI_ADC + select IIO_BACKEND help Say yes here to build support for Analog Devices: * AD9467 16-Bit, 200 MSPS/250 MSPS Analog-to-Digital Converter
drivers/iio/adc/ad9467.c +142 -101
432 lines not on this page · raw message
Signature · 1 line
2.43.0
Nuno Sa
maintainerPATCH v3 8/8 iio: adc: adi-axi-adc: move to backend framework
In reply to Nuno SaMove to the IIO backend framework. Devices supported by adi-axi-adc now register themselves as backend devices.
--- drivers/iio/adc/Kconfig | 2 +- drivers/iio/adc/adi-axi-adc.c | 380 +++++++++--------------------------- include/linux/iio/adc/adi-axi-adc.h | 68 ------- 3 files changed, 93 insertions(+), 357 deletions(-)
drivers/iio/adc/Kconfig +1 -1
@@ -293,7 +293,7 @@ config ADI_AXI_ADC select IIO_BUFFER_HW_CONSUMER select IIO_BUFFER_DMAENGINE select REGMAP_MMIO - depends on OF + select IIO_BACKEND help Say yes here to build support for Analog Devices Generic AXI ADC IP core. The IP core is used for interfacing with
drivers/iio/adc/adi-axi-adc.c +92 -288
494 lines not on this page · raw message
include/linux/iio/adc/adi-axi-adc.h deleted +0 -68
68 lines not on this page · raw message
Signature · 1 line
2.43.0
Rob Herring
maintainerQuoted 38 lines · Nuno Sa
v2:
https://lore.kernel.org/r/[email protected]Changes in v3:
- Patch 1:
* Use proposed generic schema [1]. Also make it a required property;
* Improved the commit message.
- Patch 2:
* Improved commit message.
- Patch 4:
* Namespace all IIO DMAENGINE buffer exports;
* Removed unrelated new line removal change.
- Patch 5:
* Namespace all IIO backend exports.
- Patch 6:
* Setbackend.hin alphabetical order;
* Import IIO backend namespace.
- Patch 7:
* Don't depend on OF in kbuild anymore;
* Import IIO backend namespace.For the bindings patches, I tried not to enter into much details about the IIO framework as I think specifics of the implementation don't care from the bindings perspective. Hopefully the commit messages are good enough.
I'm also aware that patch 1 is not backward compatible but we are anyways doing it on the driver side (and on the driver the property is indeed required). Anyways, just let me know if making the property required is not acceptable (I'm fairly confident no one was using the upstream version of the driver and so validating devicetrees for it).
Keeping the block diagram in v3's cover so we don't have to follow links to check the one of the typicals setups.
Quoted 6 lines
------------------------------------------------------- ------------------ | ----------- ------------ ------- FPGA | | ADC |------------------------| | AXI ADC |---------| DMA CORE |------| RAM | | | (Frontend/IIO) | Serial Data (eg: LVDS) | |(backend)|---------| |------| | | | |------------------------| ----------- ------------ ------- | ------------------ -------------------------------------------------------
Why doesn't axi-adc just have an io-channels property to adc? It's the opposite direction for the link, but it seems more logical to me that axi-adc depends on adc rather than the other way around.
And if there's another consumer in the chain, then a node could certainly be both an io-channels consumer and producer.
The architecture of the drivers seems odd to me. It looks similar to making a phy driver handle all the state and protocol with the host controller being a backend.
Rob
Quoted 54 lines · Rob Herring
Quoted 44 lines · Nuno Sa
v1:
https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f5175273b81dbfe40b7f0daffcdc67d6cb8ffv2:
https://lore.kernel.org/r/[email protected]Changes in v3:
- Patch 1:
* Use proposed generic schema [1]. Also make it a required property;
* Improved the commit message.
- Patch 2:
* Improved commit message.
- Patch 4:
* Namespace all IIO DMAENGINE buffer exports;
* Removed unrelated new line removal change.
- Patch 5:
* Namespace all IIO backend exports.
- Patch 6:
* Setbackend.hin alphabetical order;
* Import IIO backend namespace.
- Patch 7:
* Don't depend on OF in kbuild anymore;
* Import IIO backend namespace.For the bindings patches, I tried not to enter into much details about the IIO framework as I think specifics of the implementation don't care from the bindings perspective. Hopefully the commit messages are good enough.
I'm also aware that patch 1 is not backward compatible but we are anyways doing it on the driver side (and on the driver the property is indeed required). Anyways, just let me know if making the property required is not acceptable (I'm fairly confident no one was using the upstream version of the driver and so validating devicetrees for it).
Keeping the block diagram in v3's cover so we don't have to follow links to check the one of the typicals setups.
--------------------------------------
-----------------
------------------ | ----------- ------------ ------- FPGA |Quoted 8 lines
| ADC |------------------------| | AXI ADC |---------| DMA CORE |---- --| RAM | | | (Frontend/IIO) | Serial Data (eg: LVDS) | |(backend)|---------| |---- --| | | | |------------------------| ----------- ------------ ------- |------------------ --------------------------------------
-----------------
Quoted 4 lines
Why doesn't axi-adc just have an io-channels property to adc? It's the opposite direction for the link, but it seems more logical to me that axi-adc depends on adc rather than the other way around.
We are not interested on a single channel but on the complete device. From the axi- adc point of view, there's not much we could do with the adc channel. I mean, maybe we could still do something but it would be far from ideal (see below).
The opposite direction is exactly what we had (look at patch 2) just with another custom property. The problem with that is that we would then need a bidirectional link (we would need to callback into the provider and the provider would need to access the consumer) between consumers and providers and that would be far from optimal. The bidirectional link would exist because if we want to support fundamental things like LVDS/CMOS interface tuning we need to set/get settings from the axi-adc core. And as Jonathan suggested, the real data is captured or sent on the converters (ADC or DACs) and that is why we have the IIO device/interface in there and why we call them "frontends". In ADI usecases, backends are these FPGA cores providing "services" to the "real" high speed converters. To put it in another way, the real converter is the one who knows how to use the axi-adc core and not the other way around. That's also one of the reasons why it would be way more difficult to handle things with the opposite link. That's how we have done it so far and the mess we have out of tree is massive :sweat_smile: We ended up doing raw writes and reads on the axi-adc MMIO registers from the converter driver just because we had to configure or get something from the axi-adc device but the link was backwards.
Quoted 3 lines
And if there's another consumer in the chain, then a node could certainly be both an io-channels consumer and producer.
This should also be possible with this architecture. A node can be both a backend (provider) and a consumer and we have an out of tree design that fits this (that I surely want to upstream after the foundations are done).
Quoted 3 lines
The architecture of the drivers seems odd to me. It looks similar to making a phy driver handle all the state and protocol with the host controller being a backend.
In this case, it's not really a controller. It's more like an extension of the device because we need a way to handle the high sample rates this ADCs can do. Then we can also do test tones with the backend which is useful for interface tuning (as mentioned above).
To give you a bit more context, I'm adding the generic property because we will have more users for it (from ADI - the next should be the axi-dac core) but STM is also interested in this (likely the next user).
Hope this makes it a bit more clear...
- Nuno Sá
Rob Herring
maintainerQuoted 55 lines · Nuno Sá
Quoted 54 lines · Rob Herring
Quoted 52 lines · Nuno Sa
v1:
https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f5175273b81dbfe40b7f0daffcdc67d6cb8ffv2:
https://lore.kernel.org/r/[email protected]Changes in v3:
- Patch 1:
* Use proposed generic schema [1]. Also make it a required property;
* Improved the commit message.
- Patch 2:
* Improved commit message.
- Patch 4:
* Namespace all IIO DMAENGINE buffer exports;
* Removed unrelated new line removal change.
- Patch 5:
* Namespace all IIO backend exports.
- Patch 6:
* Setbackend.hin alphabetical order;
* Import IIO backend namespace.
- Patch 7:
* Don't depend on OF in kbuild anymore;
* Import IIO backend namespace.For the bindings patches, I tried not to enter into much details about the IIO framework as I think specifics of the implementation don't care from the bindings perspective. Hopefully the commit messages are good enough.
I'm also aware that patch 1 is not backward compatible but we are anyways doing it on the driver side (and on the driver the property is indeed required). Anyways, just let me know if making the property required is not acceptable (I'm fairly confident no one was using the upstream version of the driver and so validating devicetrees for it).
Keeping the block diagram in v3's cover so we don't have to follow links to check the one of the typicals setups.
--------------------------------------
-----------------
------------------ | ----------- ------------ ------- FPGA || ADC |------------------------| | AXI ADC |---------| DMA CORE |---- --| RAM | | | (Frontend/IIO) | Serial Data (eg: LVDS) | |(backend)|---------| |---- --| | | | |------------------------| ----------- ------------ ------- |------------------ --------------------------------------
-----------------
Quoted 8 lines
Quoted 4 lines
Why doesn't axi-adc just have an io-channels property to adc? It's the opposite direction for the link, but it seems more logical to me that axi-adc depends on adc rather than the other way around.
We are not interested on a single channel but on the complete device. >From the axi- adc point of view, there's not much we could do with the adc channel. I mean, maybe we could still do something but it would be far from ideal (see below).
Will this hold up for everyone? Could there be a backend device that handles multiple ADCs? IOW, do you need #io-backend-cells? It's somewhat better if we add that up front rather than later and have to treat missing as 0 cells. It is also the only way to generically identify the providers (well, there's also 'foo-controller' properties, but we've gone away from those).
Quoted 8 lines
The opposite direction is exactly what we had (look at patch 2) just with another custom property. The problem with that is that we would then need a bidirectional link (we would need to callback into the provider and the provider would need to access the consumer) between consumers and providers and that would be far from optimal. The bidirectional link would exist because if we want to support fundamental things like LVDS/CMOS interface tuning we need to set/get settings from the axi-adc core. And as Jonathan suggested, the real data is captured or sent on the converters (ADC or DACs) and that is why we have the IIO device/interface in there and why we
Quoted 8 lines
call them "frontends". In ADI usecases, backends are these FPGA cores providing "services" to the "real" high speed converters. To put it in another way, the real converter is the one who knows how to use the axi-adc core and not the other way around. That's also one of the reasons why it would be way more difficult to handle things with the opposite link. That's how we have done it so far and the mess we have out of tree is massive :sweat_smile: We ended up doing raw writes and reads on the axi-adc MMIO registers from the converter driver just because we had to configure or get something from the axi-adc device but the link was backwards.
The direction (for the binding) doesn't really matter. It doesn't dictate the direction in the OS. In the ad9467 driver, you can search the DT for 'adi,adc-dev' and find the node which matches your node's phandle. It's not exactly efficient, but you are doing it once. It would also prevent the DT ABI break you are introducing.
Quoted 17 lines
Quoted 3 lines
And if there's another consumer in the chain, then a node could certainly be both an io-channels consumer and producer.
This should also be possible with this architecture. A node can be both a backend (provider) and a consumer and we have an out of tree design that fits this (that I surely want to upstream after the foundations are done).
Quoted 3 lines
The architecture of the drivers seems odd to me. It looks similar to making a phy driver handle all the state and protocol with the host controller being a backend.
In this case, it's not really a controller. It's more like an extension of the device because we need a way to handle the high sample rates this ADCs can do. Then we can also do test tones with the backend which is useful for interface tuning (as mentioned above).
Quoted 5 lines
To give you a bit more context, I'm adding the generic property because we will have more users for it (from ADI - the next should be the axi-dac core) but STM is also interested in this (likely the next user).
Hope this makes it a bit more clear...
Yes, thanks.
I generally ask for 2 users on new common bindings. I've accepted too many only to have the 2nd user come in a month later and need additions. An ack on the binding from the STM folks would be nice here. And Jonathan too.
Rob
Quoted 73 lines · Rob Herring
Quoted 66 lines · Nuno Sá
Quoted 60 lines · Rob Herring
Quoted 55 lines · Nuno Sa
v1:
https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f5175273b81dbfe40b7f0daffcdc67d6cb8ffv2:
https://lore.kernel.org/r/[email protected]
mChanges in v3:
- Patch 1:
* Use proposed generic schema [1]. Also make it a required property;
* Improved the commit message.
- Patch 2:
* Improved commit message.
- Patch 4:
* Namespace all IIO DMAENGINE buffer exports;
* Removed unrelated new line removal change.
- Patch 5:
* Namespace all IIO backend exports.
- Patch 6:
* Setbackend.hin alphabetical order;
* Import IIO backend namespace.
- Patch 7:
* Don't depend on OF in kbuild anymore;
* Import IIO backend namespace.For the bindings patches, I tried not to enter into much details about the IIO framework as I think specifics of the implementation don't care from the bindings perspective. Hopefully the commit messages are good enough.
I'm also aware that patch 1 is not backward compatible but we are anyways doing it on the driver side (and on the driver the property is indeed required). Anyways, just let me know if making the property required is not acceptable (I'm fairly confident no one was using the upstream version of the driver and so validating devicetrees for it).
Keeping the block diagram in v3's cover so we don't have to follow links to check the one of the typicals setups.
----------------------------------
----
-----------------
------------------ | ----------- ------------ ------- FPGA || ADC |------------------------| | AXI ADC |---------| DMA CORE |---- --| RAM | | | (Frontend/IIO) | Serial Data (eg: LVDS) | |(backend)|---------| |---- --| | | | |------------------------| ----------- ------------ ------- |Quoted 3 lines
------------------ ----------------------------------
----
-----------------Quoted 4 lines
Why doesn't axi-adc just have an io-channels property to adc? It's the opposite direction for the link, but it seems more logical to me that axi-adc depends on adc rather than the other way around.
Quoted 5 lines
We are not interested on a single channel but on the complete device. >From the axi-
adc point of view, there's not much we could do with the adc channel. I mean, maybe
we could still do something but it would be far from ideal (see below).
Quoted 7 lines
Will this hold up for everyone? Could there be a backend device that handles multiple ADCs? IOW, do you need #io-backend-cells? It's somewhat better if we add that up front rather than later and have to treat missing as 0 cells. It is also the only way to generically identify the providers (well, there's also 'foo-controller' properties, but we've gone away from those).
For the axi-adc backend, it's very unlikely. The way the core connects to the converters is through a serial data interface (LVDS, CMOS or JESD in ADI usecases). This interface is not really a bus so it's kind of a 1:1 connection. Now, in more complicated devices (like highly integrated RF transceivers) what we have is that we have multiple of these cores (one per RX/TX port) connected to the frontend. So, effectively 1 frontend could have multiple backends. So, yes, your first "doubts" are not that "crazy" as this is also not the "typical" provider - consumer relationship. However, for all of what I've said in the previous email, even in these cases, thinking in these cores as the provider, makes things much more easier to handle.
However, the above is just ADI usecases. In theory, yes, it can be very possible for another backend other than axi-adc to have multiple frontends connected so I guess we can make #io-backend-cells already available in the schema.
For the axi-adc bindings this would be 'const: 0', right?
Quoted 27 lines
Quoted 18 lines
The opposite direction is exactly what we had (look at patch 2) just with another custom property. The problem with that is that we would then need a bidirectional link (we would need to callback into the provider and the provider would need to access the consumer) between consumers and providers and that would be far from optimal. The bidirectional link would exist because if we want to support fundamental
things like LVDS/CMOS interface tuning we need to set/get settings from the axi- adc
core. And as Jonathan suggested, the real data is captured or sent on the converters
(ADC or DACs) and that is why we have the IIO device/interface in there and why we
call them "frontends". In ADI usecases, backends are these FPGA cores providing "services" to the "real" high speed converters. To put it in another way, the real
converter is the one who knows how to use the axi-adc core and not the other way around. That's also one of the reasons why it would be way more difficult toQuoted 8 lines
handle
things with the opposite link. That's how we have done it so far and the mess we have
out of tree is massive :sweat_smile: We ended up doing raw writes and reads on the
axi-adc MMIO registers from the converter driver just because we had to configure or
get something from the axi-adc device but the link was backwards.
Quoted 6 lines
The direction (for the binding) doesn't really matter. It doesn't dictate the direction in the OS. In the ad9467 driver, you can search the DT for 'adi,adc-dev' and find the node which matches your node's phandle. It's not exactly efficient, but you are doing it once. It would also prevent the DT ABI break you are introducing.
Hmm, I think I see your idea. So you mean something like devm_iio_backend_get_optional() and if not present, then we would look for nodes having the 'adi,adc-dev' property and look for the one pointing at us... Then, we would need another API in the backend to look for registered backends matching that fwnode. Right?
I mean, I guess this could work but we would already have to start a fresh framework with API's that are not really meant to be used anymore other than the ad9467 driver (not devm_iio_backend_get_optional() because sooner or later I think we'll need that one). We are already breaking ABI in the driver and I'm still fairly confident no one is really using the upstream driver because it's lacking support for devices and important features (not even in ADI fork we're using it).
Anyways, if you still insist on having something like this (and feel more comfortable in not breaking DT ABI), I can see how this would look like in the next version...
Quoted 27 lines
Quoted 27 lines
Quoted 4 lines
And if there's another consumer in the chain, then a node could certainly be both an io-channels consumer and producer.
This should also be possible with this architecture. A node can be both a backend (provider) and a consumer and we have an out of tree design that fits this (that I
surely want to upstream after the foundations are done).Quoted 3 lines
The architecture of the drivers seems odd to me. It looks similar to making a phy driver handle all the state and protocol with the host controller being a backend.
In this case, it's not really a controller. It's more like an extension of the device
because we need a way to handle the high sample rates this ADCs can do. Then we can
also do test tones with the backend which is useful for interface tuning (as mentioned above).To give you a bit more context, I'm adding the generic property because we will have
more users for it (from ADI - the next should be the axi-dac core) but STM is also
interested in this (likely the next user).
Quoted 9 lines
Quoted 1 line
Hope this makes it a bit more clear...
Yes, thanks.
I generally ask for 2 users on new common bindings. I've accepted too many only to have the 2nd user come in a month later and need additions. An ack on the binding from the STM folks would be nice here. And Jonathan too.
Olivier, could we get an ack on the bindings patch? Do you also have any idea about how long it would take for you to send patches so we have another user of the schema?
On my side, it might very well take a month or so (given we have holidays nearby) as the axi-dac core is more complex than the axi-adc. Bah it might take less than a month to have the first version of it posted in the lists but I can't make any promises.
- Nuno Sá
Jonathan Cameron
maintainerQuoted 92 lines · On Fri, 15 Dec 2023 16:18:39 +0100 Nuno Sá <[email protected]> wrote:
Quoted 73 lines · Rob Herring
Quoted 66 lines · Nuno Sá
Quoted 60 lines · Rob Herring
Quoted 55 lines · Nuno Sa
v1:
https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f5175273b81dbfe40b7f0daffcdc67d6cb8ffv2:
https://lore.kernel.org/r/[email protected]
mChanges in v3:
- Patch 1:
* Use proposed generic schema [1]. Also make it a required property;
* Improved the commit message.
- Patch 2:
* Improved commit message.
- Patch 4:
* Namespace all IIO DMAENGINE buffer exports;
* Removed unrelated new line removal change.
- Patch 5:
* Namespace all IIO backend exports.
- Patch 6:
* Setbackend.hin alphabetical order;
* Import IIO backend namespace.
- Patch 7:
* Don't depend on OF in kbuild anymore;
* Import IIO backend namespace.For the bindings patches, I tried not to enter into much details about the IIO framework as I think specifics of the implementation don't care from the bindings perspective. Hopefully the commit messages are good enough.
I'm also aware that patch 1 is not backward compatible but we are anyways doing it on the driver side (and on the driver the property is indeed required). Anyways, just let me know if making the property required is not acceptable (I'm fairly confident no one was using the upstream version of the driver and so validating devicetrees for it).
Keeping the block diagram in v3's cover so we don't have to follow links to check the one of the typicals setups.
----------------------------------
----
-----------------
------------------ | ----------- ------------ ------- FPGA || ADC |------------------------| | AXI ADC |---------| DMA CORE |---- --| RAM | | | (Frontend/IIO) | Serial Data (eg: LVDS) | |(backend)|---------| |---- --| | | | |------------------------| ----------- ------------ ------- |Quoted 3 lines
------------------ ----------------------------------
----
-----------------Quoted 4 lines
Why doesn't axi-adc just have an io-channels property to adc? It's the opposite direction for the link, but it seems more logical to me that axi-adc depends on adc rather than the other way around.
Quoted 5 lines
We are not interested on a single channel but on the complete device. >From the axi-
adc point of view, there's not much we could do with the adc channel. I mean, maybe
we could still do something but it would be far from ideal (see below).Quoted 7 lines
Will this hold up for everyone? Could there be a backend device that handles multiple ADCs? IOW, do you need #io-backend-cells? It's somewhat better if we add that up front rather than later and have to treat missing as 0 cells. It is also the only way to generically identify the providers (well, there's also 'foo-controller' properties, but we've gone away from those).
For the axi-adc backend, it's very unlikely. The way the core connects to the converters is through a serial data interface (LVDS, CMOS or JESD in ADI usecases). This interface is not really a bus so it's kind of a 1:1 connection. Now, in more complicated devices (like highly integrated RF transceivers) what we have is that we have multiple of these cores (one per RX/TX port) connected to the frontend. So, effectively 1 frontend could have multiple backends. So, yes, your first "doubts" are not that "crazy" as this is also not the "typical" provider - consumer relationship. However, for all of what I've said in the previous email, even in these cases, thinking in these cores as the provider, makes things much more easier to handle.
Quoted 3 lines
However, the above is just ADI usecases. In theory, yes, it can be very possible for another backend other than axi-adc to have multiple frontends connected so I guess we can make #io-backend-cells already available in the schema.
I'd like ultimately to consider making this work for new instances of dfsdm devices (separately front end ADC that spits out a modulated signal that a host controller then turns into something useful). In those cases we might well see a mix of front ends connected to one backend (at least in theory - not sure anyone would build such thing outside of an eval board).
Adding the flexibility from the start would be sensible. So I agree with Rob here.
Quoted 50 lines
For the axi-adc bindings this would be 'const: 0', right?
Quoted 27 lines
Quoted 18 lines
The opposite direction is exactly what we had (look at patch 2) just with another custom property. The problem with that is that we would then need a bidirectional link (we would need to callback into the provider and the provider would need to access the consumer) between consumers and providers and that would be far from optimal. The bidirectional link would exist because if we want to support fundamental
things like LVDS/CMOS interface tuning we need to set/get settings from the axi- adc
core. And as Jonathan suggested, the real data is captured or sent on the converters
(ADC or DACs) and that is why we have the IIO device/interface in there and why we
call them "frontends". In ADI usecases, backends are these FPGA cores providing "services" to the "real" high speed converters. To put it in another way, the real
converter is the one who knows how to use the axi-adc core and not the other way around. That's also one of the reasons why it would be way more difficult toQuoted 8 lines
handle
things with the opposite link. That's how we have done it so far and the mess we have
out of tree is massive :sweat_smile: We ended up doing raw writes and reads on the
axi-adc MMIO registers from the converter driver just because we had to configure or
get something from the axi-adc device but the link was backwards.Quoted 6 lines
The direction (for the binding) doesn't really matter. It doesn't dictate the direction in the OS. In the ad9467 driver, you can search the DT for 'adi,adc-dev' and find the node which matches your node's phandle. It's not exactly efficient, but you are doing it once. It would also prevent the DT ABI break you are introducing.
Hmm, I think I see your idea. So you mean something like
devm_iio_backend_get_optional()and if not present, then we would look for nodes having the 'adi,adc-dev' property and look for the one pointing at us... Then, we would need another API in the backend to look for registered backends matching that fwnode. Right?I mean, I guess this could work but we would already have to start a fresh framework with API's that are not really meant to be used anymore other than the ad9467 driver (not
devm_iio_backend_get_optional()because sooner or later I think we'll need that one). We are already breaking ABI in the driver and I'm still fairly confident no one is really using the upstream driver because it's lacking support for devices and important features (not even in ADI fork we're using it).
Quoted 2 lines
Anyways, if you still insist on having something like this (and feel more comfortable in not breaking DT ABI), I can see how this would look like in the next version...
See how it looks. If it means removing the need to convince Rob then it's probably easier to write the code than try and talk him around ;) Can happily stick a bit deprecated note next to the binding and the code.
Quoted 38 lines
Quoted 28 lines
Quoted 28 lines
Quoted 5 lines
And if there's another consumer in the chain, then a node could certainly be both an io-channels consumer and producer.
This should also be possible with this architecture. A node can be both a backend (provider) and a consumer and we have an out of tree design that fits this (that I
surely want to upstream after the foundations are done).Quoted 3 lines
The architecture of the drivers seems odd to me. It looks similar to making a phy driver handle all the state and protocol with the host controller being a backend.
In this case, it's not really a controller. It's more like an extension of the device
because we need a way to handle the high sample rates this ADCs can do. Then we can
also do test tones with the backend which is useful for interface tuning (as mentioned above).To give you a bit more context, I'm adding the generic property because we will have
more users for it (from ADI - the next should be the axi-dac core) but STM is also
interested in this (likely the next user).Quoted 9 lines
Quoted 1 line
Hope this makes it a bit more clear...
Yes, thanks.
I generally ask for 2 users on new common bindings. I've accepted too many only to have the 2nd user come in a month later and need additions. An ack on the binding from the STM folks would be nice here. And Jonathan too.
Quoted 7 lines
Olivier, could we get an ack on the bindings patch? Do you also have any idea about how long it would take for you to send patches so we have another user of the schema?
On my side, it might very well take a month or so (given we have holidays nearby) as the axi-dac core is more complex than the axi-adc. Bah it might take less than a month to have the first version of it posted in the lists but I can't make any promises.
For the driver side of things I'd like at least 2, preferably 3 users before merging. We have more flexibility to rework things as any issues will probably be internal interfaces, but I'd rather wait if we are going to have 3 users within another month or 2.
Jonathan
Quoted 3 lines
- Nuno Sá
Quoted 135 lines · Jonathan Cameron
Quoted 117 lines · On Fri, 15 Dec 2023 16:18:39 +0100 Nuno Sá <[email protected]> wrote:
Quoted 89 lines · Rob Herring
Quoted 80 lines · Nuno Sá
Quoted 74 lines · Rob Herring
Quoted 64 lines · Nuno Sa
v1:
https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f5175273b81dbfe40b7f0daffcdc67d6cb8ffv2:
https://lore.kernel.org/r/[email protected]
mChanges in v3:
- Patch 1:
* Use proposed generic schema [1]. Also make it a required property;
* Improved the commit message.
- Patch 2:
* Improved commit message.
- Patch 4:
* Namespace all IIO DMAENGINE buffer exports;
* Removed unrelated new line removal change.
- Patch 5:
* Namespace all IIO backend exports.
- Patch 6:
* Setbackend.hin alphabetical order;
* Import IIO backend namespace.
- Patch 7:
* Don't depend on OF in kbuild anymore;
* Import IIO backend namespace.For the bindings patches, I tried not to enter into much details about
the IIO framework as I think specifics of the implementation don't care
from the bindings perspective. Hopefully the commit messages are good
enough.I'm also aware that patch 1 is not backward compatible but we are anyways doing it on the driver side (and on the driver the property is
indeed required). Anyways, just let me know if making the property required is not acceptable (I'm fairly confident no one was using the
upstream version of the driver and so validating devicetrees for it).Keeping the block diagram in v3's cover so we don't have to follow links
to check the one of the typicals setups.-------------------------
---------
----
-----------------
------------------ | ----------- ---
---------
------- FPGA |
| ADC |------------------------| | AXI ADC |---------| DMA COREQuoted 1 line
----
--| RAM | |
| (Frontend/IIO) | Serial Data (eg: LVDS) | |(backend)|--------- |Quoted 1 line
----
Quoted 8 lines
--| | |
| |------------------------| ----------- ---
---------
------- |
------------------ -------------------------
---------
----
-----------------Quoted 4 lines
Why doesn't axi-adc just have an io-channels property to adc? It's the opposite direction for the link, but it seems more logical to me that axi-adc depends on adc rather than the other way around.
Quoted 7 lines
We are not interested on a single channel but on the complete device. >From the
axi-
adc point of view, there's not much we could do with the adc channel. I mean,
maybe
we could still do something but it would be far from ideal (see below).Quoted 7 lines
Will this hold up for everyone? Could there be a backend device that handles multiple ADCs? IOW, do you need #io-backend-cells? It's somewhat better if we add that up front rather than later and have to treat missing as 0 cells. It is also the only way to generically identify the providers (well, there's also 'foo-controller' properties, but we've gone away from those).
For the axi-adc backend, it's very unlikely. The way the core connects to the
converters is through a serial data interface (LVDS, CMOS or JESD in ADI usecases).
This interface is not really a bus so it's kind of a 1:1 connection. Now, in more
complicated devices (like highly integrated RF transceivers) what we have is that we
have multiple of these cores (one per RX/TX port) connected to the frontend. So,
effectively 1 frontend could have multiple backends. So, yes, your first "doubts" are
not that "crazy" as this is also not the "typical" provider - consumer relationship.
However, for all of what I've said in the previous email, even in these cases,
thinking in these cores as the provider, makes things much more easier to handle.Quoted 5 lines
However, the above is just ADI usecases. In theory, yes, it can be very possible for
another backend other than axi-adc to have multiple frontends connected so I guess we
can make #io-backend-cells already available in the schema.I'd like ultimately to consider making this work for new instances of dfsdm devices (separately front end ADC that spits out a modulated signal that a host
controller then turns into something useful). In those cases we might well see a mix
of front ends connected to one backend (at least in theory - not sure anyone would
build such thing outside of an eval board).
Quoted 3 lines
Adding the flexibility from the start would be sensible. So I agree with Rob here.
Agreed...
Quoted 78 lines
Quoted 73 lines
For the axi-adc bindings this would be 'const: 0', right?
Quoted 42 lines
Quoted 32 lines
The opposite direction is exactly what we had (look at patch 2) just with another
custom property. The problem with that is that we would then need a bidirectional
link (we would need to callback into the provider and the provider would need to
access the consumer) between consumers and providers and that would be far from
optimal. The bidirectional link would exist because if we want to support
fundamental
things like LVDS/CMOS interface tuning we need to set/get settings from the axi-
adc
core. And as Jonathan suggested, the real data is captured or sent on the
converters
(ADC or DACs) and that is why we have the IIO device/interface in there and why
we
call them "frontends". In ADI usecases, backends are these FPGA cores providing
"services" to the "real" high speed converters. To put it in another way, the
real
converter is the one who knows how to use the axi-adc core and not the other way
around. That's also one of the reasons why it would be way more difficult to
handle
things with the opposite link. That's how we have done it so far and the mess weQuoted 8 lines
have
out of tree is massive :sweat_smile: We ended up doing raw writes and reads on
the
axi-adc MMIO registers from the converter driver just because we had to configure
or
get something from the axi-adc device but the link was backwards.Quoted 6 lines
The direction (for the binding) doesn't really matter. It doesn't dictate the direction in the OS. In the ad9467 driver, you can search the DT for 'adi,adc-dev' and find the node which matches your node's phandle. It's not exactly efficient, but you are doing it once. It would also prevent the DT ABI break you are introducing.
Hmm, I think I see your idea. So you mean something like
devm_iio_backend_get_optional()and if not present, then we would look for nodes
having the 'adi,adc-dev' property and look for the one pointing at us... Then, we
would need another API in the backend to look for registered backends matching that
fwnode. Right?I mean, I guess this could work but we would already have to start a fresh framework
with API's that are not really meant to be used anymore other than the ad9467 driver
(notdevm_iio_backend_get_optional()because sooner or later I think we'll need that
one). We are already breaking ABI in the driver and I'm still fairly confident no one
is really using the upstream driver because it's lacking support for devices and
important features (not even in ADI fork we're using it).Quoted 4 lines
Anyways, if you still insist on having something like this (and feel more comfortable
in not breaking DT ABI), I can see how this would look like in the next version...
Quoted 6 lines
See how it looks. If it means removing the need to convince Rob then it's probably easier
to write the code than try and talk him around ;) Can happily stick a bit deprecated
note next to the binding and the code.
Will do...
Quoted 58 lines
Quoted 50 lines
Quoted 37 lines
Quoted 33 lines
Quoted 3 lines
And if there's another consumer in the chain, then a node could certainly be both an io-channels consumer and producer.
This should also be possible with this architecture. A node can be both a backend
(provider) and a consumer and we have an out of tree design that fits this (that
I
surely want to upstream after the foundations are done).Quoted 3 lines
The architecture of the drivers seems odd to me. It looks similar to making a phy driver handle all the state and protocol with the host controller being a backend.
In this case, it's not really a controller. It's more like an extension of the
device
because we need a way to handle the high sample rates this ADCs can do. Then we
can
also do test tones with the backend which is useful for interface tuning (as
mentioned above).To give you a bit more context, I'm adding the generic property because we will
have
more users for it (from ADI - the next should be the axi-dac core) but STM is
also
interested in this (likely the next user).Quoted 1 line
Hope this makes it a bit more clear...
Quoted 7 lines
Yes, thanks.
I generally ask for 2 users on new common bindings. I've accepted too many only to have the 2nd user come in a month later and need additions. An ack on the binding from the STM folks would be nice here. And Jonathan too.
Olivier, could we get an ack on the bindings patch? Do you also have any idea about
how long it would take for you to send patches so we have another user of the schema?Quoted 7 lines
On my side, it might very well take a month or so (given we have holidays nearby) as
the axi-dac core is more complex than the axi-adc. Bah it might take less than a
month to have the first version of it posted in the lists but I can't make any
promises.
Quoted 8 lines
For the driver side of things I'd like at least 2, preferably 3 users before merging.
We have more flexibility to rework things as any issues will probably be internal
interfaces, but I'd rather wait if we are going to have 3 users within another month
or 2.
Totally fine by me. But how would this look like? Could we have an immutable branch where we can send patches about this? Or maybe staging? I'm asking because adding more stuff into these series might make it harder to review (the axi-dac might have some fun ABI discussion :)). Ideally, we would have this merged somewhere and then add users on top of it.
- Nuno Sá
Jonathan Cameron
maintainerQuoted 68 lines
Quoted 59 lines
Quoted 51 lines
Quoted 38 lines
Quoted 33 lines
Quoted 3 lines
And if there's another consumer in the chain, then a node could certainly be both an io-channels consumer and producer.
This should also be possible with this architecture. A node can be both a backend
(provider) and a consumer and we have an out of tree design that fits this (that
I
surely want to upstream after the foundations are done).Quoted 3 lines
The architecture of the drivers seems odd to me. It looks similar to making a phy driver handle all the state and protocol with the host controller being a backend.
In this case, it's not really a controller. It's more like an extension of the
device
because we need a way to handle the high sample rates this ADCs can do. Then we
can
also do test tones with the backend which is useful for interface tuning (as
mentioned above).To give you a bit more context, I'm adding the generic property because we will
have
more users for it (from ADI - the next should be the axi-dac core) but STM is
also
interested in this (likely the next user).Quoted 1 line
Hope this makes it a bit more clear...
Quoted 7 lines
Yes, thanks.
I generally ask for 2 users on new common bindings. I've accepted too many only to have the 2nd user come in a month later and need additions. An ack on the binding from the STM folks would be nice here. And Jonathan too.
Olivier, could we get an ack on the bindings patch? Do you also have any idea about
how long it would take for you to send patches so we have another user of the schema?Quoted 7 lines
On my side, it might very well take a month or so (given we have holidays nearby) as
the axi-dac core is more complex than the axi-adc. Bah it might take less than a
month to have the first version of it posted in the lists but I can't make any
promises.Quoted 8 lines
For the driver side of things I'd like at least 2, preferably 3 users before merging.
We have more flexibility to rework things as any issues will probably be internal
interfaces, but I'd rather wait if we are going to have 3 users within another month
or 2.
Quoted 5 lines
Totally fine by me. But how would this look like? Could we have an immutable branch where we can send patches about this? Or maybe staging? I'm asking because adding more stuff into these series might make it harder to review (the axi-dac might have some fun ABI discussion :)). Ideally, we would have this merged somewhere and then add users on top of it.
It's fine to post a bunch of series with stated dependencies (I've gotten 5 series + deep in the past :)
Obviously useful to have a git tree with them all on somewhere though but if you host that it would be ideal given you are driving this work in general.
Jonathan
Quoted 2 lines
- Nuno Sá
Rob Herring
maintainerQuoted 157 lines · Jonathan Cameron
Quoted 92 lines · On Fri, 15 Dec 2023 16:18:39 +0100 Nuno Sá <[email protected]> wrote:
Quoted 73 lines · Rob Herring
Quoted 66 lines · Nuno Sá
Quoted 60 lines · Rob Herring
Quoted 55 lines · Nuno Sa
v1:
https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f5175273b81dbfe40b7f0daffcdc67d6cb8ffv2:
https://lore.kernel.org/r/[email protected]
mChanges in v3:
- Patch 1:
* Use proposed generic schema [1]. Also make it a required property;
* Improved the commit message.
- Patch 2:
* Improved commit message.
- Patch 4:
* Namespace all IIO DMAENGINE buffer exports;
* Removed unrelated new line removal change.
- Patch 5:
* Namespace all IIO backend exports.
- Patch 6:
* Setbackend.hin alphabetical order;
* Import IIO backend namespace.
- Patch 7:
* Don't depend on OF in kbuild anymore;
* Import IIO backend namespace.For the bindings patches, I tried not to enter into much details about the IIO framework as I think specifics of the implementation don't care from the bindings perspective. Hopefully the commit messages are good enough.
I'm also aware that patch 1 is not backward compatible but we are anyways doing it on the driver side (and on the driver the property is indeed required). Anyways, just let me know if making the property required is not acceptable (I'm fairly confident no one was using the upstream version of the driver and so validating devicetrees for it).
Keeping the block diagram in v3's cover so we don't have to follow links to check the one of the typicals setups.
----------------------------------
----
-----------------
------------------ | ----------- ------------ ------- FPGA || ADC |------------------------| | AXI ADC |---------| DMA CORE |---- --| RAM | | | (Frontend/IIO) | Serial Data (eg: LVDS) | |(backend)|---------| |---- --| | | | |------------------------| ----------- ------------ ------- |Quoted 3 lines
------------------ ----------------------------------
----
-----------------Quoted 4 lines
Why doesn't axi-adc just have an io-channels property to adc? It's the opposite direction for the link, but it seems more logical to me that axi-adc depends on adc rather than the other way around.
Quoted 5 lines
We are not interested on a single channel but on the complete device. >From the axi-
adc point of view, there's not much we could do with the adc channel. I mean, maybe
we could still do something but it would be far from ideal (see below).Quoted 7 lines
Will this hold up for everyone? Could there be a backend device that handles multiple ADCs? IOW, do you need #io-backend-cells? It's somewhat better if we add that up front rather than later and have to treat missing as 0 cells. It is also the only way to generically identify the providers (well, there's also 'foo-controller' properties, but we've gone away from those).
For the axi-adc backend, it's very unlikely. The way the core connects to the converters is through a serial data interface (LVDS, CMOS or JESD in ADI usecases). This interface is not really a bus so it's kind of a 1:1 connection. Now, in more complicated devices (like highly integrated RF transceivers) what we have is that we have multiple of these cores (one per RX/TX port) connected to the frontend. So, effectively 1 frontend could have multiple backends. So, yes, your first "doubts" are not that "crazy" as this is also not the "typical" provider - consumer relationship. However, for all of what I've said in the previous email, even in these cases, thinking in these cores as the provider, makes things much more easier to handle.
Quoted 3 lines
However, the above is just ADI usecases. In theory, yes, it can be very possible for another backend other than axi-adc to have multiple frontends connected so I guess we can make #io-backend-cells already available in the schema.
I'd like ultimately to consider making this work for new instances of dfsdm devices (separately front end ADC that spits out a modulated signal that a host controller then turns into something useful). In those cases we might well see a mix of front ends connected to one backend (at least in theory - not sure anyone would build such thing outside of an eval board).
Adding the flexibility from the start would be sensible. So I agree with Rob here.
Quoted 50 lines
For the axi-adc bindings this would be 'const: 0', right?
Quoted 27 lines
Quoted 18 lines
The opposite direction is exactly what we had (look at patch 2) just with another custom property. The problem with that is that we would then need a bidirectional link (we would need to callback into the provider and the provider would need to access the consumer) between consumers and providers and that would be far from optimal. The bidirectional link would exist because if we want to support fundamental
things like LVDS/CMOS interface tuning we need to set/get settings from the axi- adc
core. And as Jonathan suggested, the real data is captured or sent on the converters
(ADC or DACs) and that is why we have the IIO device/interface in there and why we
call them "frontends". In ADI usecases, backends are these FPGA cores providing "services" to the "real" high speed converters. To put it in another way, the real
converter is the one who knows how to use the axi-adc core and not the other way around. That's also one of the reasons why it would be way more difficult toQuoted 8 lines
handle
things with the opposite link. That's how we have done it so far and the mess we have
out of tree is massive :sweat_smile: We ended up doing raw writes and reads on the
axi-adc MMIO registers from the converter driver just because we had to configure or
get something from the axi-adc device but the link was backwards.Quoted 6 lines
The direction (for the binding) doesn't really matter. It doesn't dictate the direction in the OS. In the ad9467 driver, you can search the DT for 'adi,adc-dev' and find the node which matches your node's phandle. It's not exactly efficient, but you are doing it once. It would also prevent the DT ABI break you are introducing.
Hmm, I think I see your idea. So you mean something like
devm_iio_backend_get_optional()and if not present, then we would look for nodes having the 'adi,adc-dev' property and look for the one pointing at us... Then, we would need another API in the backend to look for registered backends matching that fwnode. Right?I mean, I guess this could work but we would already have to start a fresh framework with API's that are not really meant to be used anymore other than the ad9467 driver (not
devm_iio_backend_get_optional()because sooner or later I think we'll need that one). We are already breaking ABI in the driver and I'm still fairly confident no one is really using the upstream driver because it's lacking support for devices and important features (not even in ADI fork we're using it).
Quoted 6 lines
Quoted 2 lines
Anyways, if you still insist on having something like this (and feel more comfortable in not breaking DT ABI), I can see how this would look like in the next version...
See how it looks. If it means removing the need to convince Rob then it's probably easier to write the code than try and talk him around ;) Can happily stick a bit deprecated note next to the binding and the code.
I only point out ABI breaks and require they are justified in the commit message (basically stating what you state above). Otherwise, I don't care if I don't use the platform.
Quoted 44 lines
Quoted 36 lines
Quoted 26 lines
Quoted 26 lines
Quoted 3 lines
And if there's another consumer in the chain, then a node could certainly be both an io-channels consumer and producer.
This should also be possible with this architecture. A node can be both a backend (provider) and a consumer and we have an out of tree design that fits this (that I
surely want to upstream after the foundations are done).Quoted 3 lines
The architecture of the drivers seems odd to me. It looks similar to making a phy driver handle all the state and protocol with the host controller being a backend.
In this case, it's not really a controller. It's more like an extension of the device
because we need a way to handle the high sample rates this ADCs can do. Then we can
also do test tones with the backend which is useful for interface tuning (as mentioned above).To give you a bit more context, I'm adding the generic property because we will have
more users for it (from ADI - the next should be the axi-dac core) but STM is also
interested in this (likely the next user).Quoted 9 lines
Quoted 1 line
Hope this makes it a bit more clear...
Yes, thanks.
I generally ask for 2 users on new common bindings. I've accepted too many only to have the 2nd user come in a month later and need additions. An ack on the binding from the STM folks would be nice here. And Jonathan too.
Quoted 7 lines
Olivier, could we get an ack on the bindings patch? Do you also have any idea about how long it would take for you to send patches so we have another user of the schema?
On my side, it might very well take a month or so (given we have holidays nearby) as the axi-dac core is more complex than the axi-adc. Bah it might take less than a month to have the first version of it posted in the lists but I can't make any promises.
Quoted 4 lines
For the driver side of things I'd like at least 2, preferably 3 users before merging. We have more flexibility to rework things as any issues will probably be internal interfaces, but I'd rather wait if we are going to have 3 users within another month or 2.
Really, for the binding, I'm fine with participation in the upstreaming of this (i.e. reviewing and/or testing on another platform) and a 'this works for us' on the binding.
Rob
Quoted 226 lines · Rob Herring
Quoted 219 lines · Jonathan Cameron
Quoted 120 lines · On Fri, 15 Dec 2023 16:18:39 +0100 Nuno Sá <[email protected]> wrote:
Quoted 92 lines · Rob Herring
Quoted 82 lines · Nuno Sá
Quoted 74 lines · Rob Herring
Quoted 64 lines · Nuno Sa
v1:
https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f5175273b81dbfe40b7f0daffcdc67d6cb8ffv2:
https://lore.kernel.org/r/[email protected]
mChanges in v3:
- Patch 1:
* Use proposed generic schema [1]. Also make it a required property;
* Improved the commit message.
- Patch 2:
* Improved commit message.
- Patch 4:
* Namespace all IIO DMAENGINE buffer exports;
* Removed unrelated new line removal change.
- Patch 5:
* Namespace all IIO backend exports.
- Patch 6:
* Setbackend.hin alphabetical order;
* Import IIO backend namespace.
- Patch 7:
* Don't depend on OF in kbuild anymore;
* Import IIO backend namespace.For the bindings patches, I tried not to enter into much details about
the IIO framework as I think specifics of the implementation don't care
from the bindings perspective. Hopefully the commit messages are good
enough.I'm also aware that patch 1 is not backward compatible but we are anyways doing it on the driver side (and on the driver the property is
indeed required). Anyways, just let me know if making the property required is not acceptable (I'm fairly confident no one was using the
upstream version of the driver and so validating devicetrees for it).Keeping the block diagram in v3's cover so we don't have to follow links
to check the one of the typicals setups.-----------------------
-----------
----
-----------------
------------------ | ----------- -
-----------
------- FPGA |
| ADC |------------------------| | AXI ADC |---------| DMA COREQuoted 1 line
----
--| RAM | |
| (Frontend/IIO) | Serial Data (eg: LVDS) | |(backend)|--------- |Quoted 1 line
----
Quoted 8 lines
--| | |
| |------------------------| ----------- -
-----------
------- |
------------------ -----------------------
-----------
----
-----------------Quoted 6 lines
Why doesn't axi-adc just have an io-channels property to adc? It's the
opposite direction for the link, but it seems more logical to me that
axi-adc depends on adc rather than the other way around.Quoted 8 lines
We are not interested on a single channel but on the complete device. >From the
axi-
adc point of view, there's not much we could do with the adc channel. I mean,
maybe
we could still do something but it would be far from ideal (see below).Quoted 7 lines
Will this hold up for everyone? Could there be a backend device that handles multiple ADCs? IOW, do you need #io-backend-cells? It's somewhat better if we add that up front rather than later and have to treat missing as 0 cells. It is also the only way to generically identify the providers (well, there's also 'foo-controller' properties, but we've gone away from those).
For the axi-adc backend, it's very unlikely. The way the core connects to the
converters is through a serial data interface (LVDS, CMOS or JESD in ADI usecases).
This interface is not really a bus so it's kind of a 1:1 connection. Now, in more
complicated devices (like highly integrated RF transceivers) what we have is that we
have multiple of these cores (one per RX/TX port) connected to the frontend. So,
effectively 1 frontend could have multiple backends. So, yes, your first "doubts" are
not that "crazy" as this is also not the "typical" provider - consumer relationship.
However, for all of what I've said in the previous email, even in these cases,
thinking in these cores as the provider, makes things much more easier to handle.Quoted 5 lines
However, the above is just ADI usecases. In theory, yes, it can be very possible for
another backend other than axi-adc to have multiple frontends connected so I guess we
can make #io-backend-cells already available in the schema.I'd like ultimately to consider making this work for new instances of dfsdm devices (separately front end ADC that spits out a modulated signal that a host
controller then turns into something useful). In those cases we might well see a mix
of front ends connected to one backend (at least in theory - not sure anyone would
build such thing outside of an eval board).Adding the flexibility from the start would be sensible. So I agree with Rob here.
Quoted 73 lines
For the axi-adc bindings this would be 'const: 0', right?
Quoted 42 lines
Quoted 32 lines
The opposite direction is exactly what we had (look at patch 2) just with another
custom property. The problem with that is that we would then need a bidirectional
link (we would need to callback into the provider and the provider would need to
access the consumer) between consumers and providers and that would be far from
optimal. The bidirectional link would exist because if we want to support
fundamental
things like LVDS/CMOS interface tuning we need to set/get settings from the axi-
adc
core. And as Jonathan suggested, the real data is captured or sent on the
converters
(ADC or DACs) and that is why we have the IIO device/interface in there and why
we
call them "frontends". In ADI usecases, backends are these FPGA cores providing
"services" to the "real" high speed converters. To put it in another way, the
real
converter is the one who knows how to use the axi-adc core and not the other way
around. That's also one of the reasons why it would be way more difficult to
handle
things with the opposite link. That's how we have done it so far and the mess weQuoted 8 lines
have
out of tree is massive :sweat_smile: We ended up doing raw writes and reads on
the
axi-adc MMIO registers from the converter driver just because we had to configure
or
get something from the axi-adc device but the link was backwards.Quoted 6 lines
The direction (for the binding) doesn't really matter. It doesn't dictate the direction in the OS. In the ad9467 driver, you can search the DT for 'adi,adc-dev' and find the node which matches your node's phandle. It's not exactly efficient, but you are doing it once. It would also prevent the DT ABI break you are introducing.
Hmm, I think I see your idea. So you mean something like
devm_iio_backend_get_optional()and if not present, then we would look for nodes
having the 'adi,adc-dev' property and look for the one pointing at us... Then, we
would need another API in the backend to look for registered backends matching that
fwnode. Right?I mean, I guess this could work but we would already have to start a fresh framework
with API's that are not really meant to be used anymore other than the ad9467 driver
(notdevm_iio_backend_get_optional()because sooner or later I think we'll need that
one). We are already breaking ABI in the driver and I'm still fairly confident no one
is really using the upstream driver because it's lacking support for devices and
important features (not even in ADI fork we're using it).Quoted 4 lines
Anyways, if you still insist on having something like this (and feel more comfortable
in not breaking DT ABI), I can see how this would look like in the next version...Quoted 5 lines
See how it looks. If it means removing the need to convince Rob then it's probably easier
to write the code than try and talk him around ;) Can happily stick a bit deprecated
note next to the binding and the code.
Quoted 4 lines
I only point out ABI breaks and require they are justified in the commit message (basically stating what you state above). Otherwise, I don't care if I don't use the platform.
Good to know. I already worked on a new series only with your suggestion so now I'll send it anyways :). In the end it will be up to me and Jonathan to decide if we want to add an API only meant to be used for this.
Thanks!
- Nuno Sá
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Olivier MOYSAN
reviewerHi Nuno,
Quoted 185 lines · Nuno Sá
Quoted 73 lines · Rob Herring
Quoted 66 lines · Nuno Sá
Quoted 60 lines · Rob Herring
Quoted 55 lines · Nuno Sa
v1:
https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f517
5273b81dbfe40b7f0daffcdc67d6cb8ffv2:
https://lore.kernel.org/r/[email protected]
mChanges in v3:
- Patch 1:
* Use proposed generic schema [1]. Also make it a required property;
* Improved the commit message.
- Patch 2:
* Improved commit message.
- Patch 4:
* Namespace all IIO DMAENGINE buffer exports;
* Removed unrelated new line removal change.
- Patch 5:
* Namespace all IIO backend exports.
- Patch 6:
* Setbackend.hin alphabetical order;
* Import IIO backend namespace.
- Patch 7:
* Don't depend on OF in kbuild anymore;
* Import IIO backend namespace.For the bindings patches, I tried not to enter into much details about the IIO framework as I think specifics of the implementation don't care from the bindings perspective. Hopefully the commit messages are good enough.
I'm also aware that patch 1 is not backward compatible but we are anyways doing it on the driver side (and on the driver the property is indeed required). Anyways, just let me know if making the property required is not acceptable (I'm fairly confident no one was using the upstream version of the driver and so validating devicetrees for it).
Keeping the block diagram in v3's cover so we don't have to follow links to check the one of the typicals setups.
----------------------------------
----
-----------------
------------------ | ----------- ------------ ------- FPGA || ADC |------------------------| | AXI ADC |---------| DMA CORE |---- --| RAM | | | (Frontend/IIO) | Serial Data (eg: LVDS) | |(backend)|---------| |---- --| | | | |------------------------| ----------- ------------ ------- |Quoted 3 lines
------------------ ----------------------------------
----
-----------------Quoted 4 lines
Why doesn't axi-adc just have an io-channels property to adc? It's the opposite direction for the link, but it seems more logical to me that axi-adc depends on adc rather than the other way around.
Quoted 5 lines
We are not interested on a single channel but on the complete device. >From the axi-
adc point of view, there's not much we could do with the adc channel. I mean, maybe
we could still do something but it would be far from ideal (see below).Quoted 7 lines
Will this hold up for everyone? Could there be a backend device that handles multiple ADCs? IOW, do you need #io-backend-cells? It's somewhat better if we add that up front rather than later and have to treat missing as 0 cells. It is also the only way to generically identify the providers (well, there's also 'foo-controller' properties, but we've gone away from those).
For the axi-adc backend, it's very unlikely. The way the core connects to the converters is through a serial data interface (LVDS, CMOS or JESD in ADI usecases). This interface is not really a bus so it's kind of a 1:1 connection. Now, in more complicated devices (like highly integrated RF transceivers) what we have is that we have multiple of these cores (one per RX/TX port) connected to the frontend. So, effectively 1 frontend could have multiple backends. So, yes, your first "doubts" are not that "crazy" as this is also not the "typical" provider - consumer relationship. However, for all of what I've said in the previous email, even in these cases, thinking in these cores as the provider, makes things much more easier to handle.
However, the above is just ADI usecases. In theory, yes, it can be very possible for another backend other than axi-adc to have multiple frontends connected so I guess we can make #io-backend-cells already available in the schema.
For the axi-adc bindings this would be 'const: 0', right?
Quoted 27 lines
Quoted 18 lines
The opposite direction is exactly what we had (look at patch 2) just with another custom property. The problem with that is that we would then need a bidirectional link (we would need to callback into the provider and the provider would need to access the consumer) between consumers and providers and that would be far from optimal. The bidirectional link would exist because if we want to support fundamental
things like LVDS/CMOS interface tuning we need to set/get settings from the axi- adc
core. And as Jonathan suggested, the real data is captured or sent on the converters
(ADC or DACs) and that is why we have the IIO device/interface in there and why we
call them "frontends". In ADI usecases, backends are these FPGA cores providing "services" to the "real" high speed converters. To put it in another way, the real
converter is the one who knows how to use the axi-adc core and not the other way around. That's also one of the reasons why it would be way more difficult toQuoted 8 lines
handle
things with the opposite link. That's how we have done it so far and the mess we have
out of tree is massive :sweat_smile: We ended up doing raw writes and reads on the
axi-adc MMIO registers from the converter driver just because we had to configure or
get something from the axi-adc device but the link was backwards.Quoted 6 lines
The direction (for the binding) doesn't really matter. It doesn't dictate the direction in the OS. In the ad9467 driver, you can search the DT for 'adi,adc-dev' and find the node which matches your node's phandle. It's not exactly efficient, but you are doing it once. It would also prevent the DT ABI break you are introducing.
Hmm, I think I see your idea. So you mean something like
devm_iio_backend_get_optional()and if not present, then we would look for nodes having the 'adi,adc-dev' property and look for the one pointing at us... Then, we would need another API in the backend to look for registered backends matching that fwnode. Right?I mean, I guess this could work but we would already have to start a fresh framework with API's that are not really meant to be used anymore other than the ad9467 driver (not
devm_iio_backend_get_optional()because sooner or later I think we'll need that one). We are already breaking ABI in the driver and I'm still fairly confident no one is really using the upstream driver because it's lacking support for devices and important features (not even in ADI fork we're using it).Anyways, if you still insist on having something like this (and feel more comfortable in not breaking DT ABI), I can see how this would look like in the next version...
Quoted 27 lines
Quoted 27 lines
Quoted 4 lines
And if there's another consumer in the chain, then a node could certainly be both an io-channels consumer and producer.
This should also be possible with this architecture. A node can be both a backend (provider) and a consumer and we have an out of tree design that fits this (that I
surely want to upstream after the foundations are done).Quoted 3 lines
The architecture of the drivers seems odd to me. It looks similar to making a phy driver handle all the state and protocol with the host controller being a backend.
In this case, it's not really a controller. It's more like an extension of the device
because we need a way to handle the high sample rates this ADCs can do. Then we can
also do test tones with the backend which is useful for interface tuning (as mentioned above).To give you a bit more context, I'm adding the generic property because we will have
more users for it (from ADI - the next should be the axi-dac core) but STM is also
interested in this (likely the next user).Quoted 9 lines
Quoted 1 line
Hope this makes it a bit more clear...
Yes, thanks.
I generally ask for 2 users on new common bindings. I've accepted too many only to have the 2nd user come in a month later and need additions. An ack on the binding from the STM folks would be nice here. And Jonathan too.
Quoted 8 lines
Olivier, could we get an ack on the bindings patch? Do you also have any idea about how long it would take for you to send patches so we have another user of the schema?
On my side, it might very well take a month or so (given we have holidays nearby) as the axi-dac core is more complex than the axi-adc. Bah it might take less than a month to have the first version of it posted in the lists but I can't make any promises.
Sorry for late answer.
Regarding bindings patch, I assume you refer to [1]. After adding the #io-backend-cells property in v5 you can add my Ack-by Olivier Moysan <[email protected]>
I will prepare a serie based on these bindings. Hopefully it should be possible this month.
BRs
Olivier
[1] https://github.com/devicetree-org/dt-schema/pull/120
Quoted 2 lines
- Nuno Sá