Skip to content

Add support for ADA4355 #2806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Add support for ADA4355 #2806

wants to merge 3 commits into from

Conversation

PIoandan
Copy link
Collaborator

@PIoandan PIoandan commented May 29, 2025

PR Description

The ADA4355 is a complete, high performance, current input µModule. The 14-bit ADC converts the amplified voltage signal at a rate of up to 125 MSPS and outputs the digitized signals through two serial, low voltage differential signaling (LVDS) data lanes. The data clock output (DCO) operates at frequencies of up to 500 MHz and supports double data rate (DDR) operation.

This driver is also in the process of upstreaming.

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly (if there is the case)

@PIoandan PIoandan marked this pull request as draft May 29, 2025 10:42
@PIoandan PIoandan force-pushed the dev_ada4355 branch 3 times, most recently from dd3c40b to 7c9e53a Compare May 30, 2025 07:16

config ADA4355
tristate "Analog Devices ADA4355 uModule Data Acquisition Module"
depends on SPI
Copy link
Contributor

@gastmaier gastmaier May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edit: my comment looks into why it was lacking symbols, nuno suggestion is the correct solution.

Suggested change
depends on SPI
depends on SPI
depends on CF_AXI_ADC

The driver uses axiadc_write and axiadc_read, exported from cf_axi_adc_core.c, enabled with CF_AXI_ADC.
So the driver depends on this symbol as well.
Without this change, it cannot be compiled as a module without blindly enabling symbols.
This is an issue in other drivers.

For curiosity, we have now a script that resolves the tree of depends in the KConfig based on a target:

$ python3 ci/symbols_depend.py drivers/iio/adc/ada4355.o
Symbols of touched files:
{'ADA4355'}
Resolved symbols:
{'PCI', 'IIO_BUFFER', 'HAS_IOMEM', 'HAVE_PCI', 'ADA4355', 'SPI', 'IIO'}

as committed, it lacks the CF_AXI_ADC symbol.

#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>

#include "cf_axi_adc.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why using the above and not the new IIO backend framework? That's what we want to use for all new drivers interfacing with the AXI ADC IP. This also makes it possible to upstream the driver.

Copy link
Contributor

@machschmitt machschmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, dropping in some comments. Not doing a detailed code review since I believe switching to the IIO backend framework will lead to a major driver refactoring.


#include "zynq-zed.dtsi"
#include "zynq-zed-adv7511.dtsi"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, the PR description says the driver is in the process of upstreaming, but I didn't find it in the mailing list so commenting here.
For upstreaming, a dt-binding (.yaml file) will be needed.
And dt maintainers will probably ask to describe the voltage supplies.
Looks like this will have a required 3.3V VCC supply and two (VEA and VED) optional supplies.

/*PATTERN*/
#define ADA4355_ALT_CHECKERBOARD_PATTERN 0x44

/*INPUT_SIGNALS*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments don't add much to the driver. I'd say they are not need if the defines are given sane names.

Comment on lines +57 to +58
/*REG TRANSFER 0xFF*/
#define ADA4355_OVERRIDE BIT(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add REG to the define and drop the comment:

-/*REG TRANSFER 0xFF*/
-#define ADA4355_OVERRIDE			BIT(0)
+#define ADA4355_OVERRIDE_REG			BIT(0)

Comment on lines +54 to +55
/*CHIP ID*/
#define ADA4355_CHIP_ID 0x8B
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name in the define already says it's the chip ID.

Comment on lines +124 to +127
tmp = (conv->chip_info->scale_table[0][0] * 1000000ULL) >>
conv->chip_info->channel[0].scan_type.realbits;
*val = tmp / 1000000;
*val2 = tmp % 1000000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it applicable to use include/linux/units.h here?
e.g. *val = tmp / MICRO;

Comment on lines +150 to +164
static int ada4355_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{
switch (mask) {
case IIO_CHAN_INFO_SCALE:
return -EINVAL;
case IIO_CHAN_INFO_SAMP_FREQ:
return -EINVAL;
default:
return -EINVAL;
}

return 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have write_raw if nothing can be written to the device? Need to implement something that writes to the device or drop write_raw.

.scale_table = ada4355_scale_table,
.num_scales = ARRAY_SIZE(ada4355_scale_table),
.num_channels = 1,
.channel[0] = ADA4355_CHAN(0, 0, 14, 's', 2),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this driver support devices with more than one channel?
If not, can we assign the channel at probe? Maybe that will only be possible after switching to the IIO backend framework.

PIoandan added 3 commits July 14, 2025 13:59
Signed-off-by: Pop Ioan Daniel <[email protected]>
Add driver for ADA4355.

Signed-off-by: Pop Ioan Daniel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants