-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Drivers: RTC: NXP: introduce Counter-based generic driver #95087
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: main
Are you sure you want to change the base?
Drivers: RTC: NXP: introduce Counter-based generic driver #95087
Conversation
2565ef1
to
838fb61
Compare
The twister build failure is caused by: cba0742#diff-db8ba35bdefd7627bfa4c2a0d7d13c9d1f20787ddf7181333981f6c01a32cc34 |
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 is the counter based rtc driver not based on the counter API? It should not need to be specific to any vendor, that's what the APIs are there to abstract.
@bjarki-andreasen Do you mean the "set_calibration", "get_calibration"? There are no such corresponding APIs in counter driver model. All other APIs are using counter APIs. Or I miss understand anything? If so, please be more specific. |
Yes, fsl anything should not be in a generic counter to rtc wrapper. Keyword here is generic. If the counter API is missing a feature, like calibration it would seem, that should be added to the counter API first, then the generic wrapper can wrap it. |
838fb61
to
b06d820
Compare
90f26ec
to
79a8187
Compare
@sylvioalves Your input would be useful here I think since ESP32 can also use this new driver to provide Zephyr RTC API, following the rejection of #92253 |
79a8187
to
cb69f1d
Compare
Need to fix the compliance check here |
cb69f1d
to
57cc2e5
Compare
Add new zephyr,counter-rtc.yaml for virtual RTC device wrapping counter APIs Signed-off-by: Holt Sun <[email protected]>
Fix some build warning. Signed-off-by: Holt Sun <[email protected]>
57cc2e5
to
a381a40
Compare
Counter RTC driver is written using the counter API as a target instead of a hardware. It can adapt to all RTC device without broken-down time register but with counter. Signed-off-by: Holt Sun <[email protected]>
Add counter_rtc in nxp device and board. Signed-off-by: Holt Sun <[email protected]>
Add confs for nxp boards. Signed-off-by: Holt Sun <[email protected]>
Add rtc test confs for nxp boards. Signed-off-by: Holt Sun <[email protected]>
a381a40
to
9929a45
Compare
|
return -EINVAL; | ||
} | ||
|
||
const struct counter_rtc_config *config = dev->config; |
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.
For the sake of code organization, would you mind moving all declarations/variables (specially all those struct
) to the beginning of the function?
static int counter_rtc_alarm_get_supported_fields(const struct device *dev, uint16_t id, | ||
uint16_t *mask) |
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 don't you map the id
to an alarm channel? For example NXP's SNVS RTC (Real Time Counter) has 2 channels, HP (High Power) and LP (Low Power)
Create generic NXP RTC driver using Zephyr RTC driver model. The RTC driver invokes counter APIs. It can works with existing RTC counter drivers counter_mcux_rtc.c and counter_mcux_lpc_rtc.c.