-
Notifications
You must be signed in to change notification settings - Fork 846
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
Add support for AD7944, AD7985, AD7986 #2280
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a code point of view, everything looks good. But I would say, let's wait for real testing before merging
Have the HDL now. Updated:
Still waiting on a hardware setup to be able to test. |
- adi,pulsar,ad7985 | ||
- adi,pulsar,ad7944 | ||
then: | ||
required: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this should be required, e.g. the TURBO pin could be hardwired instead of connected to a GPIO.
d606677
to
190b757
Compare
update:
We have hardware to test now, but the driver doesn't seem to be communicating with the ADC chip. The SPI transactions time out (which lead to discovering #2287). |
Hi David, I was asked why the dt_binding_check failed on this PR: CHKDT Documentation/devicetree/bindings/processed-schema.json After fixing the if/then indention this PR runs the failing checks successfully. |
This adds compatible strings for the AD7944, AD7985, and AD7986 chips. Signed-off-by: David Lechner <dlechner@baylibre.com>
This adds support for the AD7944, AD7985, and AD7986 ADCs. Signed-off-by: David Lechner <dlechner@baylibre.com>
This adds initial support for the TURBO gpio. The TURBO input is available on some chips (e.g. AD7944) and is used to enable the maximum sample rate at the expense of increased power consumption. For now, the TURBO mode is always enabled. In the future, we can add support to turn it off for lower sample rates. Signed-off-by: David Lechner <dlechner@baylibre.com>
This adds trees for ZedBoard with AD7944, AD7985, and AD7986 evaluation boards. Signed-off-by: David Lechner <dlechner@baylibre.com>
Update:
We have the hardware setup working now, so at least superficially this looks like it is working. We can see a sine wave in the IIO oscilloscope. So the only question left is the desired behavoir of the turbo gpio. Should we just automatically disable turbo mode if the requested sample rate does not require it? Or do users need more control over this? |
I also found an issue where the first sample is always 0, so I will need to fix that. Or is this the expected behavior for the pulsar driver? |
Having looked into this more deeply now, I noticed that AD7986/85/44 don't have a config register like AD7682. So should we make the config register optional in ad_pulsar.c or are these chips different enough we should create a separate driver? (I suspect this is what is causing the first sample to be zero as I mentioned in the previous comment.) |
Not know much about the device but if this is something that can be done automatically by the driver I would say it's better. Always better to simplify the ABI. I mean is the turbo meaningful at all for sampling rates not needing it?
Hmm i would be surprised if it's expected :). Those devices have any way to control the interrupt line or are we relying on {enable|disable}_irq()? |
Not that I know of. Also, there are some configurations, like daisy-chaining multiple chips where turbo mode is not allowed. So keeping it internal to the driver seems like the best option to me.
Having thought about it a bit more, I think it could be a problem with the HDL. The CNV pin is being used as the CS pin but the conversion is triggered on the rising edge. On the first sample there is probably only a falling edge because the CS/CNV line was high since startup. The HDL needs to make sure there is a low to high transition of the CNV line before each SPI read.
FYI, I'm looking at making a separate driver for this chips upstream along with the work we have started on getting SPI Engine offload support mainlined. |
This has been tested by both BayLibre and ADI now. Do we want to merge as-is and address the outstanding issues separately? Still TODO:
IMHO, it would be easier to do these if we first split |
If you agree, I would just merge this one and add the missing features in future patches... Thoughts? |
Yes, I agree. |
This adds device tree bindings compatible strings, ad_pulsar driver support and ZedBoard device trees for the AD7944, AD7985, and AD7986 chips.
This has not been tested yet since we are waiting on HDL for these.