-
Notifications
You must be signed in to change notification settings - Fork 901
iio: adc: Add initial driver support for MAX14001/MAX14002 #2848
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
base: rpi-6.6.y_GSOC_2025_MAX14001
Are you sure you want to change the base?
iio: adc: Add initial driver support for MAX14001/MAX14002 #2848
Conversation
8e965dc
to
0ecd86d
Compare
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.
Hi @MarileneGarcia , a few comments about this initial driver version.
Note that, aside from the comments above, there are still some improvements that need to be made to make this driver usable (e.g. read ADC sample data, provide scale to convert output codes to mV). Those features shall be implemented next. Though, overall, this looks good to me as an initial driver version.
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 a few more notes.
Ok, thank you for the comments! I think I have address them. I will start working in the other needed features, like the read ADC sample data and provide scale to convert output codes to mV. |
d29debd
to
f6eaef5
Compare
Ok, thank you for the comments! I think I have address them. The ones related to the write_raw I am going to check in the next steps. |
f6eaef5
to
b451319
Compare
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.
Looks good to me.
A few more comments.
The regulator thing can be done on a different PR (we might need to rebase or create another GSoC branch if updating to kernel 6.12).
Keep up the good work.
d83610c
to
42f812b
Compare
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.
Hi @MarileneGarcia , the updates to MAX14001 driver look mostly good to me. I would merge the PR, but I think it will actually be easier to do the suggested changes before merging this rather than doing them later. So, I'll wait until the last adjustments are done to merge this PR.
Hello @machschmitt. Sure, I have done the requested changes, thank you! |
81f5aa9
to
6c5e260
Compare
3bd2356
to
295b094
Compare
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.
Hi @MarileneGarcia , a few comments about the dt-bindings and new code. I'll have a closer look at MAX14001 data sheets to provide a more accurate review this weekend.
c6e0590
to
34cee15
Compare
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.
Hi @MarileneGarcia,
This initial driver version looks very good.
I'm leaving a few suggestions.
Aside from a few potentially buggy things, most of the comments are about code style nitpicking.
My advise is to address those last nits and send it to the mailing lists. Experienced kernel maintainers may find further possible improvements for this driver but I do think this is a very good starting point for upstream review.
drivers/iio/adc/max14001.c
Outdated
{ | ||
.tx_buf = &st->tx_buffer, | ||
.len = sizeof(st->tx_buffer), | ||
.bits_per_word = 16, |
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, did you really need that? I think it's unlikely that rpi5 SPI controller actually supports 16 bits_per_word since rpi4 SPI controller only supported 8 bits_per_word. I would just drop bits_per_word = 16,
unless somehow rpi5 supports it and register read stops working without that.
7e74a0e
to
248596e
Compare
Okay, I believe I’ve addressed them, but I’ll wait for your approval before sending the patches to the maintainers. |
The patches look great. But, unfortunately, they don't apply to IIO testing branch. The patches need to be ported to the testing branch of IIO tree. It should not be hard to port the patches by editing the git hunks.
change patch2 to be like
We may talk more about it at next week's meeting. |
248596e
to
a4cd2bb
Compare
Add device-tree documentation for MAX14001/MAX14002 ADCs. The MAX14001/MAX14002 are isolated, single-channel analog-to-digital converters with programmable voltage comparators and inrush current control optimized for configurable binary input applications. Signed-off-by: Marilene Andrade Garcia <[email protected]>
The MAX14001/MAX14002 are configurable, isolated 10-bit ADCs for multi-range binary inputs. Besides the ADC readings, the MAX14001/MAX14002 offers more features, like a binary comparator, a filtered reading that can provide the average of the last 2, 4, or 8 ADC readings, and an inrush comparator that triggers the inrush current. There is also a fault feature that can diagnose seven possible fault conditions. And an option to select an external or internal ADC voltage reference. Add basic support for MAX14001/MAX14002 with the following features: - Raw ADC reading. - Filtered ADC average reading with the default configuration. Signed-off-by: Marilene Andrade Garcia <[email protected]>
The MAX14001 is a configurable, isolated 10-bit ADC for multi-range binary inputs. Besides the ADC readings, the MAX14001 offers more features, like a binary comparator, a filtered reading that can provide the average of the last 2, 4, or 8 ADC readings, and an inrush comparator that triggers the inrush current. There is also a fault feature that can diagnose seven possible fault conditions. And an option to select an external or internal ADC voltage reference. The MAX14001PMB provides the hardware to evaluate the MAX14001 to measure two channels of data, line voltage and load current. Signed-off-by: Marilene Andrade Garcia <[email protected]>
a4cd2bb
to
d6dc4f7
Compare
The MAX14001/MAX14002 are configurable, isolated 10-bit ADCs for multi-range binary inputs.
Datasheet:
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/MAX14001-MAX14002.pdf
PR Description
Basic IIO ADC max14001 driver features:
PR Type
PR Checklist