-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
drivers: adc: iadc_gecko: Use pinctrl and clock control, add bindings #84508
base: main
Are you sure you want to change the base?
drivers: adc: iadc_gecko: Use pinctrl and clock control, add bindings #84508
Conversation
The GPIO peripheral on Silabs Series 2 devices is responsible for allocating analog buses to analog peripherals. Enable support for this in the pinctrl driver. Since these bus allocations are not digital pins, introduce a new property silabs,analog-bus for this purpose. Signed-off-by: Aksel Skauge Mellbye <[email protected]>
Add definitions for analog bus selections on Series 2 devices. Signed-off-by: Aksel Skauge Mellbye <[email protected]>
Make use of ABUS support in the pinctrl driver to allocate analog buses, rather than hard-coding bus 0 in the ADC driver. Signed-off-by: Aksel Skauge Mellbye <[email protected]>
Use clock control driver instead of hard-coding HAL function calls to configure clocks. Signed-off-by: Aksel Skauge Mellbye <[email protected]>
a7542ca
to
15f82f5
Compare
drivers/adc/iadc_gecko.c
Outdated
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.
Since this driver is only compatible with SiSDK/Series-2, I suggest to drop "gecko" from its name.
#define IADC_INPUT_AIN0 64 | ||
#define IADC_INPUT_AIN1 64 | ||
#define IADC_INPUT_AIN2 80 | ||
#define IADC_INPUT_AIN3 80 |
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.
Are these duplicated value expected?
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.
Yes, 0/2 is only for POS, 1/3 is only for NEG. This is a side effect of not generating separate defines for POS/NEG.
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 have the same comment than for acmp driver. Since there are no conflicts between all the xg2*-adc.h
(check with sed -n -e 's/^+//' -e '/IADC_INPUT_/p' | sort -n -k 3 | uniq -c
), I don't think it makes sense to provide one file per part.
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.
This is not the case for xG25. While it isn't supported in Zephyr yet, its IOVDD1 entry conflicts with xG27/xG29 VBAT, and its IOVDD entry is called IOVDD0 (since there are multiple IOVDDs).
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 assume xG25 does not has VBAT
and xg27/xg29 don't have IOVDD1
? I believe it is still valuable to have only one comprehensive file even if we have to declare two symbols with the same value.
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.
acmp
uses hexadecimal values for the constants.
Add macros for use in devicetree to configure IADC on Silabs Series 2 devices. Signed-off-by: Aksel Skauge Mellbye <[email protected]>
Add overlays for xg24_dk2601b and xg27_dk2602a for the accuracy test. Update the api test to use named macros for readability. Signed-off-by: Aksel Skauge Mellbye <[email protected]>
Add support for xg24_rb4187c to the ADC sample app. Configure two channels, one measuring the AVDD supply against the 1.21V bandgap reference, and one measuring pin PB1 (wired to button 0) against the AVDD (VDDX) reference. Signed-off-by: Aksel Skauge Mellbye <[email protected]>
15f82f5
to
a03fc42
Compare
Use pinctrl for ABUS allocation (leveraging #84462), use clock control to enable peripheral clock. Add headers with utility macros for easier configuration of IADC inputs. Enable accuracy test, update api test to use bindings header.
This is a stacked PR on top of #84462. The first two commits should be reviewed as part of that PR, not this one. Approval and merge should wait until that PR is merged.