Add support for AD4080 ADC
Subsystems (5)
Antoniu Miclaus
maintainerv6 cover Add support for AD4080 ADC
The AD4080 is a high-speed, low noise, low distortion, 20-bit, Easy Drive, successive approximation register (SAR) analog-to-digital converter (ADC). Maintaining high performance (signal-to-noise and distortion (SINAD) ratio > 90 dBFS) at signal frequencies in excess of 1 MHz enables the AD4080 to service a wide variety of precision, wide bandwidth data acquisition applications.
This driver aims to be extended in the future to support multiple parts that are not released yet:
AD4081
AD4082
AD4083
AD4084
AD4085
AD4086
AD4087
AD4088Antoniu Miclaus (10):
iio: backend: add support for filter config
iio: backend: add support for data alignment
iio: backend: add support for number of lanes
dt-bindings: iio: adc: add ad408x axi variant
iio: adc: adi-axi-adc: add filter type config
iio: adc: adi-axi-adc: add data align process
iio: adc: adi-axi-adc: add num lanes support
dt-bindings: iio: adc: add ad4080
iio: adc: ad4080: add driver support
Documetation: ABI: add sinc1 and sinc5+pf1 filter
Documentation/ABI/testing/sysfs-bus-iio | 4 + .../bindings/iio/adc/adi,ad4080.yaml | 96 +++ .../bindings/iio/adc/adi,axi-adc.yaml | 2 + MAINTAINERS | 8 + drivers/iio/adc/Kconfig | 14 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ad4080.c | 620 ++++++++++++++++++ drivers/iio/adc/adi-axi-adc.c | 77 +++ drivers/iio/industrialio-backend.c | 58 ++ include/linux/iio/backend.h | 19 + 10 files changed, 899 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad4080.yaml create mode 100644 drivers/iio/adc/ad4080.c
Signature · 1 line
2.49.0
Antoniu Miclaus
maintainerPATCH v6 1/10 iio: backend: add support for filter config
Add backend support for digital filter type selection.
This setting can be adjusted within the IP cores interfacing devices.
The IP core can be configured based on the state of the actual digital filter configuration of the part.
---
no changes in v6.
drivers/iio/industrialio-backend.c | 18 ++++++++++++++++++ include/linux/iio/backend.h | 13 +++++++++++++ 2 files changed, 31 insertions(+)
drivers/iio/industrialio-backend.c +18 -0
@@ -778,6 +778,24 @@ static int __devm_iio_backend_get(struct device *dev, struct iio_backend *back)return 0 ; } +/** +* iio_backend_filter_type_set - Set filter type +* @back: Backend device +* @type: Filter type. +* +* RETURNS: +* 0 on success, negative error number on failure. +*/ +int iio_backend_filter_type_set (struct iio_backend *back, +enum iio_backend_filter_type type) +{ +if (type >=IIO_BACKEND_FILTER_TYPE_MAX ) +return -EINVAL ; + +return iio_backend_op_call (back, filter_type_set, type); +} +EXPORT_SYMBOL_NS_GPL (iio_backend_filter_type_set,"IIO_BACKEND" ); +/** * iio_backend_ddr_enable - Enable interface DDR (Double Data Rate) mode * @back: Backend device
include/linux/iio/backend.h +13 -0
@@ -76,6 +76,14 @@ enum iio_backend_interface_type { IIO_BACKEND_INTERFACE_MAX }; +enum iio_backend_filter_type { +IIO_BACKEND_FILTER_TYPE_DISABLED , +IIO_BACKEND_FILTER_TYPE_SINC1 , +IIO_BACKEND_FILTER_TYPE_SINC5 , +IIO_BACKEND_FILTER_TYPE_SINC5_PLUS_COMP , +IIO_BACKEND_FILTER_TYPE_MAX +}; +/** * struct iio_backend_ops - operations structure for an iio_backend * @enable: Enable backend.
@@ -100,6 +108,7 @@ enum iio_backend_interface_type {* @read_raw: Read a channel attribute from a backend device * @debugfs_print_chan_status: Print channel status into a buffer. * @debugfs_reg_access: Read or write register value of backend. +* @filter_type_set: Set filter type. * @ddr_enable: Enable interface DDR (Double Data Rate) mode. * @ddr_disable: Disable interface DDR (Double Data Rate) mode. * @data_stream_enable: Enable data stream.
@@ -150,6 +159,8 @@ struct iio_backend_ops { size_t len);int (*debugfs_reg_access)(struct iio_backend *back,unsigned int reg,unsigned int writeval,unsigned int *readval); +int (*filter_type_set)(struct iio_backend *back, +enum iio_backend_filter_type type);int (*ddr_enable)(struct iio_backend *back);int (*ddr_disable)(struct iio_backend *back);int (*data_stream_enable)(struct iio_backend *back);
@@ -190,6 +201,8 @@ int iio_backend_data_sample_trigger(struct iio_backend *back,int devm_iio_backend_request_buffer (struct device *dev,struct iio_backend *back,struct iio_dev *indio_dev); +int iio_backend_filter_type_set (struct iio_backend *back, +enum iio_backend_filter_type type);int iio_backend_ddr_enable (struct iio_backend *back);int iio_backend_ddr_disable (struct iio_backend *back);int iio_backend_data_stream_enable (struct iio_backend *back);
Signature · 1 line
2.49.0
Antoniu Miclaus
maintainerPATCH v6 2/10 iio: backend: add support for data alignment
In reply to Antoniu MiclausAdd backend support for staring the capture synchronization. When activated, it initates a proccess that aligns the sample's most significant bit (MSB) based solely on the captured data, without considering any other external signals.
---
no changes in v6.
drivers/iio/industrialio-backend.c | 23 +++++++++++++++++++++++ include/linux/iio/backend.h | 3 +++ 2 files changed, 26 insertions(+)
drivers/iio/industrialio-backend.c +23 -0
@@ -796,6 +796,29 @@ int iio_backend_filter_type_set(struct iio_backend *back, }EXPORT_SYMBOL_NS_GPL (iio_backend_filter_type_set,"IIO_BACKEND" ); +/** +* iio_backend_data_align - Perform the data alignment process. +* @back: Backend device +* @timeout_us: Timeout value in us. +* +* When activated, it initates a proccess that aligns the sample's most +* significant bit (MSB) based solely on the captured data, without +* considering any other external signals. +* +* The timeout_us value must be greater than 0. +* +* RETURNS: +* 0 on success, negative error number on failure. +*/ +int iio_backend_interface_data_align (struct iio_backend *back,u32 timeout_us) +{ +if (!timeout_us) +return -EINVAL ; + +return iio_backend_op_call (back, interface_data_align, timeout_us); +} +EXPORT_SYMBOL_NS_GPL (iio_backend_interface_data_align,"IIO_BACKEND" ); +/** * iio_backend_ddr_enable - Enable interface DDR (Double Data Rate) mode * @back: Backend device
include/linux/iio/backend.h +3 -0
@@ -109,6 +109,7 @@ enum iio_backend_filter_type {* @debugfs_print_chan_status: Print channel status into a buffer. * @debugfs_reg_access: Read or write register value of backend. * @filter_type_set: Set filter type. +* @interface_data_align: Perform the data alignment process. * @ddr_enable: Enable interface DDR (Double Data Rate) mode. * @ddr_disable: Disable interface DDR (Double Data Rate) mode. * @data_stream_enable: Enable data stream.
@@ -161,6 +162,7 @@ struct iio_backend_ops { unsigned int writeval, unsigned int *readval);int (*filter_type_set)(struct iio_backend *back,enum iio_backend_filter_type type); +int (*interface_data_align)(struct iio_backend *back,u32 timeout_us);int (*ddr_enable)(struct iio_backend *back);int (*ddr_disable)(struct iio_backend *back);int (*data_stream_enable)(struct iio_backend *back);
@@ -203,6 +205,7 @@ int devm_iio_backend_request_buffer(struct device *dev, struct iio_dev *indio_dev);int iio_backend_filter_type_set (struct iio_backend *back,enum iio_backend_filter_type type); +int iio_backend_interface_data_align (struct iio_backend *back,u32 timeout_us);int iio_backend_ddr_enable (struct iio_backend *back);int iio_backend_ddr_disable (struct iio_backend *back);int iio_backend_data_stream_enable (struct iio_backend *back);
Signature · 1 line
2.49.0
Jonathan Cameron
maintainerRe: [PATCH v6 02/10] iio: backend: add support for data alignment
Quoted 18 lines · On Fri, 16 May 2025 11:26:22 +0300 Antoniu Miclaus…
Add backend support for staring the capture synchronization. When activated, it initates a proccess that aligns the sample's most significant bit (MSB) based solely on the captured data, without considering any other external signals.
Reviewed-by Nuno Sá <[email protected]>Signed-off-by Antoniu Miclaus <[email protected]>---
no changes in v6.drivers/iio/industrialio-backend.c | 23 +++++++++++++++++++++++ include/linux/iio/backend.h | 3 +++ 2 files changed, 26 insertions(+)drivers/iio/industrialio-backend.c +0
-0
drivers/iio/industrialio-backend.c int iio_backend_filter_type_set(struct iio_backend *back, · line 800
Quoted 5 lines
drivers/iio/industrialio-backend.c +2
-0@@ -796,6 +796,29 @@ int iio_backend_filter_type_set(struct iio_backend *back, }EXPORT_SYMBOL_NS_GPL (iio_backend_filter_type_set,"IIO_BACKEND" ); +/** +* iio_backend_data_align - Perform the data alignment process.
Wrong name. If all else is good I can fix this up.
Quoted 52 lines
drivers/iio/industrialio-backend.c +21
-0+* @back: Backend device +* @timeout_us: Timeout value in us. +* +* When activated, it initates a proccess that aligns the sample's most +* significant bit (MSB) based solely on the captured data, without +* considering any other external signals. +* +* The timeout_us value must be greater than 0. +* +* RETURNS: +* 0 on success, negative error number on failure. +*/ +int iio_backend_interface_data_align (struct iio_backend *back,u32 timeout_us) +{ +if (!timeout_us) +return -EINVAL ; + +return iio_backend_op_call (back, interface_data_align, timeout_us); +} +EXPORT_SYMBOL_NS_GPL (iio_backend_interface_data_align,"IIO_BACKEND" ); +/** * iio_backend_ddr_enable - Enable interface DDR (Double Data Rate) mode * @back: Backend device include/linux/iio/backend.h +3
-0@@ -109,6 +109,7 @@ enum iio_backend_filter_type {* @debugfs_print_chan_status: Print channel status into a buffer. * @debugfs_reg_access: Read or write register value of backend. * @filter_type_set: Set filter type. +* @interface_data_align: Perform the data alignment process. * @ddr_enable: Enable interface DDR (Double Data Rate) mode. * @ddr_disable: Disable interface DDR (Double Data Rate) mode. * @data_stream_enable: Enable data stream. @@ -161,6 +162,7 @@ struct iio_backend_ops { unsigned int writeval, unsigned int *readval);int (*filter_type_set)(struct iio_backend *back,enum iio_backend_filter_type type); +int (*interface_data_align)(struct iio_backend *back,u32 timeout_us);int (*ddr_enable)(struct iio_backend *back);int (*ddr_disable)(struct iio_backend *back);int (*data_stream_enable)(struct iio_backend *back);@@ -203,6 +205,7 @@ int devm_iio_backend_request_buffer(struct device *dev, struct iio_dev *indio_dev);int iio_backend_filter_type_set (struct iio_backend *back,enum iio_backend_filter_type type); +int iio_backend_interface_data_align (struct iio_backend *back,u32 timeout_us);int iio_backend_ddr_enable (struct iio_backend *back);int iio_backend_ddr_disable (struct iio_backend *back);int iio_backend_data_stream_enable (struct iio_backend *back);
Antoniu Miclaus
maintainerPATCH v6 3/10 iio: backend: add support for number of lanes
In reply to Antoniu MiclausAdd iio backend support for number of lanes to be enabled.
---
no changes in v6.
drivers/iio/industrialio-backend.c | 17 +++++++++++++++++ include/linux/iio/backend.h | 3 +++ 2 files changed, 20 insertions(+)
drivers/iio/industrialio-backend.c +17 -0
@@ -819,6 +819,23 @@ int iio_backend_interface_data_align(struct iio_backend *back, u32 timeout_us) }EXPORT_SYMBOL_NS_GPL (iio_backend_interface_data_align,"IIO_BACKEND" ); +/** +* iio_backend_num_lanes_set - Number of lanes enabled. +* @back: Backend device +* @num_lanes: Number of lanes. +* +* RETURNS: +* 0 on success, negative error number on failure. +*/ +int iio_backend_num_lanes_set (struct iio_backend *back,unsigned int num_lanes) +{ +if (!num_lanes) +return -EINVAL ; + +return iio_backend_op_call (back, num_lanes_set, num_lanes); +} +EXPORT_SYMBOL_NS_GPL (iio_backend_num_lanes_set,"IIO_BACKEND" ); +/** * iio_backend_ddr_enable - Enable interface DDR (Double Data Rate) mode * @back: Backend device
include/linux/iio/backend.h +3 -0
@@ -110,6 +110,7 @@ enum iio_backend_filter_type {* @debugfs_reg_access: Read or write register value of backend. * @filter_type_set: Set filter type. * @interface_data_align: Perform the data alignment process. +* @num_lanes_set: Set the number of lanes enabled. * @ddr_enable: Enable interface DDR (Double Data Rate) mode. * @ddr_disable: Disable interface DDR (Double Data Rate) mode. * @data_stream_enable: Enable data stream.
@@ -163,6 +164,7 @@ struct iio_backend_ops {int (*filter_type_set)(struct iio_backend *back,enum iio_backend_filter_type type);int (*interface_data_align)(struct iio_backend *back,u32 timeout_us); +int (*num_lanes_set)(struct iio_backend *back,unsigned int num_lanes);int (*ddr_enable)(struct iio_backend *back);int (*ddr_disable)(struct iio_backend *back);int (*data_stream_enable)(struct iio_backend *back);
@@ -206,6 +208,7 @@ int devm_iio_backend_request_buffer(struct device *dev,int iio_backend_filter_type_set (struct iio_backend *back,enum iio_backend_filter_type type);int iio_backend_interface_data_align (struct iio_backend *back,u32 timeout_us); +int iio_backend_num_lanes_set (struct iio_backend *back,unsigned int num_lanes);int iio_backend_ddr_enable (struct iio_backend *back);int iio_backend_ddr_disable (struct iio_backend *back);int iio_backend_data_stream_enable (struct iio_backend *back);
Signature · 1 line
2.49.0
Antoniu Miclaus
maintainerPATCH v6 4/10 dt-bindings: iio: adc: add ad408x axi variant
In reply to Antoniu MiclausAdd a new compatible and related bindings for the fpga-based AD408x AXI IP core, a variant of the generic AXI ADC IP.
The AXI AD408x IP is a very similar HDL (fpga) variant of the generic AXI ADC IP, intended to control ad408x familiy.
Although there are some particularities added for extended control of the ad408x devices such as the filter configuration.
Wildcard naming is used to match the naming of the published firmware.
---
no changes in v6.
Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml +2 -0
@@ -27,6 +27,7 @@ description: | the ad7606 family. https://wiki.analog.com/resources/fpga/docs/axi_adc_ip + https://analogdevicesinc.github.io/hdl/library/axi_ad408x/index.html https://analogdevicesinc.github.io/hdl/library/axi_ad485x/index.html http://analogdevicesinc.github.io/hdl/library/axi_ad7606x/index.html
@@ -34,6 +35,7 @@ properties: compatible: enum: - adi,axi-adc-10.0.a + - adi,axi-ad408x - adi,axi-ad7606x - adi,axi-ad485x
Signature · 1 line
2.49.0
Antoniu Miclaus
maintainerPATCH v6 5/10 iio: adc: adi-axi-adc: add filter type config
In reply to Antoniu MiclausAdd support for enabling/disabling filter based on the filter type provided.
This feature is specific to the axi ad408x IP core, therefore add new compatible string and corresponding iio_backend_ops.
---
no changes in v6.
drivers/iio/adc/adi-axi-adc.c | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
drivers/iio/adc/adi-axi-adc.c +38 -0
@@ -52,6 +52,7 @@#define AXI_AD485X_PACKET_FORMAT_20BIT 0x0#define AXI_AD485X_PACKET_FORMAT_24BIT 0x1#define AXI_AD485X_PACKET_FORMAT_32BIT 0x2 +#define AXI_AD408X_CNTRL_3_FILTER_EN_MSK BIT(0)#define ADI_AXI_ADC_REG_DRP_STATUS 0x0074#define ADI_AXI_ADC_DRP_LOCKED BIT(17)
@@ -402,6 +403,19 @@ static int axi_adc_ad485x_oversampling_ratio_set(struct iio_backend *back, } } +static int axi_adc_ad408x_filter_type_set (struct iio_backend *back, +enum iio_backend_filter_type type) +{ +struct adi_axi_adc_state *st =iio_backend_get_priv (back); + +if (type) +return regmap_set_bits (st->regmap,ADI_AXI_ADC_REG_CNTRL_3 , +AXI_AD408X_CNTRL_3_FILTER_EN_MSK ); + +return regmap_clear_bits (st->regmap,ADI_AXI_ADC_REG_CNTRL_3 , +AXI_AD408X_CNTRL_3_FILTER_EN_MSK ); +} +static struct iio_buffer *axi_adc_request_buffer (struct iio_backend *back,struct iio_dev *indio_dev) {
@@ -582,6 +596,24 @@ static const struct iio_backend_info axi_ad485x = { .ops = &adi_ad485x_ops, }; +static const struct iio_backend_ops adi_ad408x_ops = { + .enable = axi_adc_enable, + .disable = axi_adc_disable, + .chan_enable = axi_adc_chan_enable, + .chan_disable = axi_adc_chan_disable, + .request_buffer = axi_adc_request_buffer, + .free_buffer = axi_adc_free_buffer, + .data_sample_trigger = axi_adc_data_sample_trigger, + .filter_type_set = axi_adc_ad408x_filter_type_set, + .debugfs_reg_access =iio_backend_debugfs_ptr (axi_adc_reg_access), + .debugfs_print_chan_status =iio_backend_debugfs_ptr (axi_adc_debugfs_print_chan_status), +}; + +static const struct iio_backend_info axi_ad408x = { + .name ="axi-ad408x" , + .ops = &adi_ad408x_ops, +}; +static int adi_axi_adc_probe (struct platform_device *pdev) {struct adi_axi_adc_state *st;
@@ -697,9 +729,15 @@ static const struct axi_adc_info adc_ad7606 = { .has_child_nodes = true, }; +static const struct axi_adc_info adi_axi_ad408x = { + .version =ADI_AXI_PCORE_VER (10 ,0 ,'a' ), + .backend_info = &axi_ad408x, +}; +/* Match table for of_platform binding */ static const struct of_device_id adi_axi_adc_of_match[] = { { .compatible ="adi,axi-adc-10.0.a" , .data = &adc_generic }, + { .compatible ="adi,axi-ad408x" , .data = &adi_axi_ad408x }, { .compatible ="adi,axi-ad485x" , .data = &adi_axi_ad485x }, { .compatible ="adi,axi-ad7606x" , .data = &adc_ad7606 }, {/* end of list */ }
Signature · 1 line
2.49.0
Antoniu Miclaus
maintainerPATCH v6 6/10 iio: adc: adi-axi-adc: add data align process
In reply to Antoniu MiclausAdd support for starting the sync process used for data capture alignment.
---
no changes in v6.
drivers/iio/adc/adi-axi-adc.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/iio/adc/adi-axi-adc.c +24 -0
@@ -44,6 +44,7 @@#define ADI_AXI_ADC_REG_CONFIG_CMOS_OR_LVDS_N BIT(7)#define ADI_AXI_ADC_REG_CTRL 0x0044 +#define ADI_AXI_ADC_CTRL_SYNC_MSK BIT(3)#define ADI_AXI_ADC_CTRL_DDR_EDGESEL_MASK BIT(1)#define ADI_AXI_ADC_REG_CNTRL_3 0x004c
@@ -54,6 +55,9 @@#define AXI_AD485X_PACKET_FORMAT_32BIT 0x2#define AXI_AD408X_CNTRL_3_FILTER_EN_MSK BIT(0) +#define ADI_AXI_ADC_REG_SYNC_STATUS 0x0068 +#define ADI_AXI_ADC_SYNC_STATUS_ADC_SYNC_MSK BIT(0) +#define ADI_AXI_ADC_REG_DRP_STATUS 0x0074#define ADI_AXI_ADC_DRP_LOCKED BIT(17)
@@ -416,6 +420,25 @@ static int axi_adc_ad408x_filter_type_set(struct iio_backend *back, AXI_AD408X_CNTRL_3_FILTER_EN_MSK); } +static int axi_adc_ad408x_interface_data_align (struct iio_backend *back, +u32 timeout_us) +{ +struct adi_axi_adc_state *st =iio_backend_get_priv (back); +bool sync_en; +u32 val; +int ret; + + ret =regmap_set_bits (st->regmap,ADI_AXI_ADC_REG_CTRL , +ADI_AXI_ADC_CTRL_SYNC_MSK ); +if (ret) +return ret; + +return regmap_read_poll_timeout (st->regmap,ADI_AXI_ADC_REG_SYNC_STATUS , + val, +FIELD_GET (ADI_AXI_ADC_SYNC_STATUS_ADC_SYNC_MSK , val), +1 , timeout_us); +} +static struct iio_buffer *axi_adc_request_buffer (struct iio_backend *back,struct iio_dev *indio_dev) {
@@ -605,6 +628,7 @@ static const struct iio_backend_ops adi_ad408x_ops = { .free_buffer = axi_adc_free_buffer, .data_sample_trigger = axi_adc_data_sample_trigger, .filter_type_set = axi_adc_ad408x_filter_type_set, + .interface_data_align = axi_adc_ad408x_interface_data_align, .debugfs_reg_access = iio_backend_debugfs_ptr(axi_adc_reg_access), .debugfs_print_chan_status = iio_backend_debugfs_ptr(axi_adc_debugfs_print_chan_status), };
Signature · 1 line
2.49.0
Jonathan Cameron
maintainerRe: [PATCH v6 06/10] iio: adc: adi-axi-adc: add data align process
drivers/iio/adc/adi-axi-adc.c static int axi_adc_ad408x_filter_type_set(struct iio_backend *back, · line 427
Quoted 7 lines
drivers/iio/adc/adi-axi-adc.c +5
-0+static int axi_adc_ad408x_interface_data_align (struct iio_backend *back, +u32 timeout_us) +{ +struct adi_axi_adc_state *st =iio_backend_get_priv (back); +bool sync_en;
Not used.
Make sure to run your test builds with W=1 which I think would have warned about this. Fixed up.
Quoted 1 line
drivers/iio/adc/adi-axi-adc.c +1
-0+u32 val;
Antoniu Miclaus
maintainerPATCH v6 7/10 iio: adc: adi-axi-adc: add num lanes support
In reply to Antoniu MiclausAdd support for setting the number of lanes enabled.
---
no changes in v6.
drivers/iio/adc/adi-axi-adc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/iio/adc/adi-axi-adc.c +15 -0
@@ -44,6 +44,7 @@#define ADI_AXI_ADC_REG_CONFIG_CMOS_OR_LVDS_N BIT(7)#define ADI_AXI_ADC_REG_CTRL 0x0044 +#define ADI_AXI_ADC_CTRL_NUM_LANES_MSK GENMASK(12, 8)#define ADI_AXI_ADC_CTRL_SYNC_MSK BIT(3)#define ADI_AXI_ADC_CTRL_DDR_EDGESEL_MASK BIT(1)
@@ -439,6 +440,19 @@ static int axi_adc_ad408x_interface_data_align(struct iio_backend *back, 1, timeout_us); } +static int axi_adc_num_lanes_set (struct iio_backend *back, +unsigned int num_lanes) +{ +struct adi_axi_adc_state *st =iio_backend_get_priv (back); + +if (!num_lanes) +return -EINVAL ; + +return regmap_update_bits (st->regmap,ADI_AXI_ADC_REG_CTRL , +ADI_AXI_ADC_CTRL_NUM_LANES_MSK , +FIELD_PREP (ADI_AXI_ADC_CTRL_NUM_LANES_MSK , num_lanes)); +} +static struct iio_buffer *axi_adc_request_buffer (struct iio_backend *back,struct iio_dev *indio_dev) {
@@ -629,6 +643,7 @@ static const struct iio_backend_ops adi_ad408x_ops = { .data_sample_trigger = axi_adc_data_sample_trigger, .filter_type_set = axi_adc_ad408x_filter_type_set, .interface_data_align = axi_adc_ad408x_interface_data_align, + .num_lanes_set = axi_adc_num_lanes_set, .debugfs_reg_access = iio_backend_debugfs_ptr(axi_adc_reg_access), .debugfs_print_chan_status = iio_backend_debugfs_ptr(axi_adc_debugfs_print_chan_status), };
Signature · 1 line
2.49.0
Antoniu Miclaus
maintainerPATCH v6 8/10 dt-bindings: iio: adc: add ad4080
In reply to Antoniu MiclausAdd devicetree bindings for ad4080 family.
---
changes in v6:
- add MAINTAINERS changes.
.../bindings/iio/adc/adi,ad4080.yaml | 96 +++++++++++++++++++ MAINTAINERS | 7 ++ 2 files changed, 103 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad4080.yaml
Documentation/devicetree/bindings/iio/adc/adi,ad4080.yaml new file +96 -0
@@ -0,0 +1,96 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2025 Analog Devices Inc. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/adi,ad4080.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices AD4080 20-Bit, 40 MSPS, Differential SAR ADC + +maintainers: + - Antoniu Miclaus <[email protected]> + +description: | + The AD4080 is a high speed, low noise, low distortion, 20-bit, Easy Drive, + successive approximation register (SAR) analog-to-digital converter (ADC). + Maintaining high performance (signal-to-noise and distortion (SINAD) ratio + > 90 dBFS) at signal frequencies in excess of 1 MHz enables the AD4080 to + service a wide variety of precision, wide bandwidth data acquisition + applications. + + https://www.analog.com/media/en/technical-documentation/data-sheets/ad4080.pdf + +$ref: /schemas/spi/spi-peripheral-props.yaml# + +properties: + compatible: + enum: + - adi,ad4080 + + reg: + maxItems: 1 + + spi-max-frequency: + description: Configuration of the SPI bus. + maximum: 50000000 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: cnv + + vdd33-supply: true + + vdd11-supply: true + + vddldo-supply: true + + iovdd-supply: true + + vrefin-supply: true + + io-backends: + maxItems: 1 + + adi,lvds-cnv-enable: + description: Enable the LVDS signal type on the CNV pin. Default is CMOS. + type: boolean + + adi,num-lanes: + description: + Number of lanes on which the data is sent on the output (DA, DB pins). + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [1, 2] + default: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - vdd33-supply + - vrefin-supply + +additionalProperties: false + +examples: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + + adc@0 { + compatible = "adi,ad4080"; + reg = <0>; + spi-max-frequency = <10000000>; + vdd33-supply = <&vdd33>; + vddldo-supply = <&vddldo>; + vrefin-supply = <&vrefin>; + clocks = <&cnv>; + clock-names = "cnv"; + io-backends = <&iio_backend>; + }; + }; +...
MAINTAINERS +7 -0
@@ -1317,6 +1317,13 @@ F: Documentation/devicetree/bindings/iio/adc/adi,ad4030.yaml F: Documentation/iio/ad4030.rst F: drivers/iio/adc/ad4030.c +ANALOG DEVICES INC AD4080 DRIVER +M: Antoniu Miclaus <[email protected]> +L: [email protected] +S: Supported +W: https://ez.analog.com/linux-software-drivers +F: Documentation/devicetree/bindings/iio/adc/adi,ad4080.yaml + ANALOG DEVICES INC AD4130 DRIVER M: Cosmin Tanislav <[email protected]> L: [email protected]
Signature · 1 line
2.49.0
Antoniu Miclaus
maintainerPATCH v6 9/10 iio: adc: ad4080: add driver support
In reply to Antoniu MiclausAdd support for AD4080 high-speed, low noise, low distortion, 20-bit, Easy Drive, successive approximation register (SAR) analog-to-digital converter (ADC).
---
changes in v6:
- use _avail suffix
- drop clk from ad4080_state
- check ad4080_get_dec_rate return values for error codes
- check if st->filter_type == FILTER_NONE and update read/write raw functions.
- update read_avail function for different filter types.
- add extra macros/comments where needed.
MAINTAINERS | 1 + drivers/iio/adc/Kconfig | 14 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ad4080.c | 620 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 636 insertions(+) create mode 100644 drivers/iio/adc/ad4080.c
MAINTAINERS +1 -0
@@ -1323,6 +1323,7 @@ L: [email protected] S: Supported W: https://ez.analog.com/linux-software-drivers F: Documentation/devicetree/bindings/iio/adc/adi,ad4080.yaml +F: drivers/iio/adc/ad4080.c ANALOG DEVICES INC AD4130 DRIVER M: Cosmin Tanislav <[email protected]>
drivers/iio/adc/Kconfig +14 -0
@@ -47,6 +47,20 @@ config AD4030 To compile this driver as a module, choose M here: the module will be called ad4030. +config AD4080 + tristate "Analog Devices AD4080 high speed ADC" + depends on SPI + select REGMAP_SPI + select IIO_BACKEND + help + Say yes here to build support for Analog Devices AD4080 + high speed, low noise, low distortion, 20-bit, Easy Drive, + successive approximation register (SAR) analog-to-digital + converter (ADC). Supports iio_backended devices for AD4080. + + To compile this driver as a module, choose M here: the module will be + called ad4080. + config AD4130 tristate "Analog Device AD4130 ADC Driver" depends on SPI
drivers/iio/adc/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_AB8500_GPADC) += ab8500-gpadc.o obj-$(CONFIG_AD_SIGMA_DELTA) += ad_sigma_delta.o obj-$(CONFIG_AD4000) += ad4000.o obj-$(CONFIG_AD4030) += ad4030.o +obj-$(CONFIG_AD4080) += ad4080.o obj-$(CONFIG_AD4130) += ad4130.o obj-$(CONFIG_AD4695) += ad4695.o obj-$(CONFIG_AD4851) += ad4851.o
drivers/iio/adc/ad4080.c new file +619 -0
619 lines not on this page · raw message
Signature · 1 line
2.49.0
Jonathan Cameron
maintainerRe: [PATCH v6 09/10] iio: adc: ad4080: add driver support
Quoted 5 lines · On Fri, 16 May 2025 11:26:29 +0300 Antoniu Miclaus…
Add support for AD4080 high-speed, low noise, low distortion, 20-bit, Easy Drive, successive approximation register (SAR) analog-to-digital converter (ADC).
Signed-off-by Antoniu Miclaus <[email protected]>
I'm not sure why by the patch I got from b4 for this was subtly corrupted at the end. I just deleted the non patch part and it was fine.
One other issue below that I fixed up.
Quoted 1 line
+static
ssize_tad4080_get_filter_type(structiio_dev*dev,
should return an int.
Quoted 12 lines
drivers/iio/adc/ad4080.c new file +12
-0+ const struct iio_chan_spec *chan) +{ +struct ad4080_state *st =iio_priv (dev); +unsigned int data; +int ret; + + ret =regmap_read (st->regmap,AD4080_REG_FILTER_CONFIG , &data); +if (ret) +return ret; + +return FIELD_GET (AD4080_FILTER_CONFIG_FILTER_SEL_MSK , data); +}
David Lechner
reviewerRe: [PATCH v6 09/10] iio: adc: ad4080: add driver support
In reply to Antoniu MiclausQuoted 6 lines · Antoniu Miclaus
Add support for AD4080 high-speed, low noise, low distortion, 20-bit, Easy Drive, successive approximation register (SAR) analog-to-digital converter (ADC).
Signed-off-by Antoniu Miclaus <[email protected]>---
...
drivers/iio/adc/ad4080.c line 519
Quoted 9 lines
drivers/iio/adc/ad4080.c new file +9
-0+static int ad4080_properties_parse (struct ad4080_state *st) +{ +struct device *dev =regmap_get_device (st->regmap); + + st->lvds_cnv_en =device_property_read_bool (dev,"adi,lvds-cnv-enable" ); + + st->num_lanes =1 ; +device_property_read_u32 (dev,"adi,num-lanes" , &st->num_lanes); +if (!st->num_lanes)
Error checking seems not strict enough. Allowed values are only 1 and 2.
Quoted 7 lines
drivers/iio/adc/ad4080.c new file +7
-0+return dev_err_probe (dev, -EINVAL , +"Invalid 'adi,num-lanes' value: %u" , + st->num_lanes); + +return 0 ; +} +
Re: [PATCH v6 09/10] iio: adc: ad4080: add driver support
Quoted 11 lines · David Lechner
Quoted 6 lines · Antoniu Miclaus
Add support for AD4080 high-speed, low noise, low distortion, 20-bit, Easy Drive, successive approximation register (SAR) analog-to-digital converter (ADC).
Signed-off-by Antoniu Miclaus <[email protected]>---
...
Quoted 12 lines
drivers/iio/adc/ad4080.c line 519
Quoted 10 lines
drivers/iio/adc/ad4080.c new file +5
-0+static int ad4080_properties_parse (struct ad4080_state *st) +{ +struct device *dev =regmap_get_device (st->regmap); + + st->lvds_cnv_en = device_property_read_bool(dev, "adi,lvds-cnv-enable");
drivers/iio/adc/ad4080.c new file +4
-0+ + st->num_lanes =1 ; +device_property_read_u32 (dev,"adi,num-lanes" , &st->num_lanes); +if (!st->num_lanes)Error checking seems not strict enough. Allowed values are only 1 and 2.
I also find it more readable to check the return value and only validate when needed. But this is pretty much a nit and personal taste.
Regarding your point, agree that the check should be better. Maybe Jonathan can tweak or Antoniu can follow up on this?
- Nuno Sá
Quoted 8 lines
Quoted 8 lines
drivers/iio/adc/ad4080.c new file +7
-0+return dev_err_probe (dev, -EINVAL , + "Invalid 'adi,num-lanes' value: %u", + st->num_lanes); + +return 0 ; +} +
Miclaus, Antoniu
maintainerRE: [PATCH v6 09/10] iio: adc: ad4080: add driver support
In reply to David LechnerQuoted 27 lines
-----Original Message-----
From: David Lechner <[email protected]>
Sent: Monday, May 19, 2025 6:51 PM
To: Miclaus, Antoniu <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v6 09/10] iio: adc: ad4080: add driver support[External]
Quoted 6 lines · Antoniu Miclaus
Add support for AD4080 high-speed, low noise, low distortion, 20-bit, Easy Drive, successive approximation register (SAR) analog-to-digital converter (ADC).
Signed-off-by Antoniu Miclaus <[email protected]>---
...
drivers/iio/adc/ad4080.c
Quoted 5 lines
drivers/iio/adc/ad4080.c new file +5
-0+static int ad4080_properties_parse (struct ad4080_state *st) +{ +struct device *dev =regmap_get_device (st->regmap); + + st->lvds_cnv_en = device_property_read_bool(dev, "adi,lvds-cnv-enable");
Quoted 7 lines
drivers/iio/adc/ad4080.c line 519
Quoted 4 lines
drivers/iio/adc/ad4080.c new file +4
-0+ + st->num_lanes =1 ; +device_property_read_u32 (dev,"adi,num-lanes" , &st->num_lanes); +if (!st->num_lanes)Error checking seems not strict enough. Allowed values are only 1 and 2.
Since this was already applied, I will add a follow-up patch on this topic.
Quoted 7 lines
Quoted 7 lines
drivers/iio/adc/ad4080.c new file +7
-0+return dev_err_probe (dev, -EINVAL , +"Invalid 'adi,num-lanes' value: %u" , + st->num_lanes); + +return 0 ; +} +
Antoniu Miclaus
maintainerPATCH v6 10/10 Documetation: ABI: add sinc1 and sinc5+pf1 filter
In reply to Antoniu MiclausAdd sinc1 and sinc5+pf1 filter types used for ad4080 device.
Include these two options into the filter_type available attribute.
Add also the option for filter disabled.
---
changes in v6:
- add doc for filter "none".
Documentation/ABI/testing/sysfs-bus-iio | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/ABI/testing/sysfs-bus-iio +4 -0
@@ -2275,6 +2275,9 @@ Description: Reading returns a list with the possible filter modes. Options for the attribute: + * "none" - Filter is disabled/bypassed. + * "sinc1" - The digital sinc1 filter. Fast 1st + conversion time. Poor noise performance. * "sinc3" - The digital sinc3 filter. Moderate 1st conversion time. Good noise performance. * "sinc4" - Sinc 4. Excellent noise performance. Long
@@ -2290,6 +2293,7 @@ Description: * "sinc3+pf2" - Sinc3 + device specific Post Filter 2. * "sinc3+pf3" - Sinc3 + device specific Post Filter 3. * "sinc3+pf4" - Sinc3 + device specific Post Filter 4. + * "sinc5+pf1" - Sinc5 + device specific Post Filter 1. What: /sys/bus/iio/devices/iio:deviceX/filter_type What: /sys/bus/iio/devices/iio:deviceX/in_voltageY-voltageZ_filter_type
Signature · 1 line
2.49.0
Jonathan Cameron
maintainerRe: [PATCH v6 10/10] Documetation: ABI: add sinc1 and sinc5+pf1 filter
Quoted 1 line · On Fri, 16 May 2025 11:26:30 +0300 Antoniu Miclaus…
Add sinc1 and sinc5+pf1 filter types used for ad4080 device.
Typo in patch title. I'll fix up.
Jonathan Cameron
maintainerQuoted 9 lines · On Fri, 16 May 2025 11:26:20 +0300 Antoniu Miclaus…
The AD4080 is a high-speed, low noise, low distortion, 20-bit, Easy Drive, successive approximation register (SAR) analog-to-digital converter (ADC). Maintaining high performance (signal-to-noise and distortion (SINAD) ratio > 90 dBFS) at signal frequencies in excess of 1 MHz enables the AD4080 to service a wide variety of precision, wide bandwidth data acquisition applications.
This driver aims to be extended in the future to support multiple parts that are not released yet:
Quoted 9 lines
AD4081
AD4082
AD4083
AD4084
AD4085
AD4086
AD4087
AD4088Applied with various tweaks as called out in the individual patch reviews
Note that this is queued up for 6.17 now as we are almost certainly too close to the merge window (and hence not enough time in linux-next).
If the 6.15 release is delayed I might do another pull request. If not this will be on the togreg branch after I rebase on rc1. Until then pushed out only as testing.
Thanks,
Jonathan
Quoted 26 lines
Antoniu Miclaus (10):
iio: backend: add support for filter config
iio: backend: add support for data alignment
iio: backend: add support for number of lanes
dt-bindings: iio: adc: add ad408x axi variant
iio: adc: adi-axi-adc: add filter type config
iio: adc: adi-axi-adc: add data align process
iio: adc: adi-axi-adc: add num lanes support
dt-bindings: iio: adc: add ad4080
iio: adc: ad4080: add driver support
Documetation: ABI: add sinc1 and sinc5+pf1 filterDocumentation/ABI/testing/sysfs-bus-iio | 4 + .../bindings/iio/adc/adi,ad4080.yaml | 96 +++ .../bindings/iio/adc/adi,axi-adc.yaml | 2 + MAINTAINERS | 8 + drivers/iio/adc/Kconfig | 14 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ad4080.c | 620 ++++++++++++++++++ drivers/iio/adc/adi-axi-adc.c | 77 +++ drivers/iio/industrialio-backend.c | 58 ++ include/linux/iio/backend.h | 19 + 10 files changed, 899 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad4080.yaml create mode 100644 drivers/iio/adc/ad4080.c