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
AD469X driver #2433
base: main
Are you sure you want to change the base?
AD469X driver #2433
Conversation
I'll try to do a proper review in the next few days... One thing that I'll already ask is to rename your driver name. Typically we don't name it with "wildcards" like 'x'. Just pick one of the parts the drivers supports (maybe the one you have) and name the driver against it. |
Add ADI AD469X 16-Bit Easy Drive Multiplexed SAR ADC devicetree document. Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
The AD469X are compact, high accuracy, low power, 16-bit, 500 kSPS/1 MSPS, multiplexed input precision, successive approximation register (SAR) analog-to-digital converters (ADCs) with Easy Drive features and extensive digital functionality. Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ad4695_4696.pdf Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ad4697-4698.pdf Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Imply AD4696 ADC. Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
This is an example dts for AD4696 adc. Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
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.
Finally remembered about this one 😅
description: The regulator supply for ADC reference voltage. | ||
|
||
"#io-channel-cells": | ||
const: 1 |
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.
why the above?
|
||
clock-names: | ||
items: | ||
- const: ref_clk |
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.
just one clock... drop this one
|
||
pwm-names: | ||
items: | ||
- const: cnv |
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.
I know that for dma we need the -names property. Is that also true for pwm? Being just one, I would expect not to need it.
Select the pin-oairing option on the specific channel. Valid values | ||
are: | ||
0: Channel paired with REFGND. | ||
1: Channel paired with COM |
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.
what's the difference between refgnd and com from a software point of view? Could both be seen as single-ended channels?
are: | ||
0: Channel paired with REFGND. | ||
1: Channel paired with COM | ||
2: Even and odd channels pairing. |
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.
The above needs more explanations? What's the meaning of odd and even in this case? (yes, not reading the datasheet at this point :))
reg_data &= ~mask; | ||
reg_data |= data; | ||
|
||
return ad4696_spi_reg_write(st, reg_addr, reg_data); |
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 safe... needs a lock
static int ad4696_enable_cnv(struct ad4696_state *st) | ||
{ | ||
return ad4696_set_sampling_freq(st, st->sampling_freq); | ||
} |
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.
drop the function
unsigned int vref_mv; | ||
int sampling_freq; | ||
u8 num_channels; | ||
u8 data[3] ____cacheline_aligned; |
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.
just use one space... also use the IIO define for DMA safe buffere... This one is not safe for all platforms and hence not the one to use
const char *name; | ||
enum ad4696_ids dev_id; | ||
int max_sample_rate; | ||
u8 max_num_channels; |
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.
nit: single space
if (ret) | ||
return ret; | ||
|
||
*reg_data = st->data[2]; |
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.
Hmm, the question is... Can't we use regmap?
No description provided.