-
Notifications
You must be signed in to change notification settings - Fork 8.2k
drivers: rtc: Add RV3028 RTC driver #73396
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: rtc: Add RV3028 RTC driver #73396
Conversation
|
Hello @jakubtopic, and thank you very much for your first pull request to the Zephyr project! |
|
Oh, I just realized my PR overlaps with #73385. I didn't see it at the time of submission. This is my first zephyr contribution, so I'd still appreciate any suggestions for the next time 🙂 |
|
Hi @jakubtopic and @bjarki-trackunit, I removed the RV-3028 stuff from my PR because the driver from @jakubtopic is more advanced than my driver. I will focus on RV-8263 because this RTC is more important to me. 👍 |
bjarki-andreasen
left a comment
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.
Regarding the Y2K test failing, it really shouldn't be, if the year can't be set to 1999, the RTC should return -EINVAL, and the test should be skipped, see
zephyr/tests/drivers/rtc/rtc_api/src/test_y2k.c
Lines 44 to 51 in 3570408
| int ret = rtc_set_time(rtc, &rtm[Y99]); | |
| if (ret == -EINVAL) { | |
| TC_PRINT("Rollover not supported\n"); | |
| ztest_test_skip(); | |
| } else { | |
| zassert_ok(ret, "RTC Set Time Failed"); | |
| } |
It may be a legitimate bug :)
|
Hi @Kampi, I wouldn't say it is more advanced, but I appreciate your trust. I'll keep working on my driver then. Good luck with the other device! |
|
|
@Kampi, do you want me to implement the RTC calibration? |
|
I would suggest removing this test case dependency so we can test boards that have RTC connected externally (it already looks for the
|
The RTC doesn´t have a calibration function so you have to add it (somehow) in the driver. Not sure if this would make sense. |
|
By calibration I meant setting frequency offset correction using the |
I added it because the RTC contains a register for a calibration value so it's done in hardware. You can do a software calibration for the RV3028 too and use this interface. |
I think both ICs support frequency offset compensations. It's not a feature I need, so I was wondering if you hadn't originally planned it for RV3028 as well 🙂 |
No I haven´t planed it for RV3028 because I haven´t found a calibration register or function during a quick check. 🙂 |
|
Fixed formatting errors |
|
@bjarki-trackunit, @decsny Kindly asking for re-review :) |
bjarki-andreasen
left a comment
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 driver looks really good, Minor nits and a request to use k_sem for locking to optimize size and speed compared to a mutex :)
jakubtopic
left a comment
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.
@bjarki-trackunit Thanks for all the feedback. I've addressed the requested changes.
decsny
left a comment
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.
binding seems fine
bjarki-andreasen
left a comment
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.
Great! I have one suggestion but it is just a minor nit IMO, great work!
Adds a devicetree binding for the Micro Crystal RV3028 RTC connected to the I2C bus. Signed-off-by: Jakub Topic <[email protected]>
Adds support for the Micro Crystal RV3028 RTC connected to the I2C bus. Signed-off-by: Jakub Topic <[email protected]>
|
Hi @jakubtopic! To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge. Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁 |
This PR adds basic support for microcrystal RV3028 RTC connected to the I2C bus:
I also added an API extension for accessing the user RAM registers and EEPROM.I have tested the driver using the RTC API test suite. The Y2K test is skipped because this RTC only supports the final two digits of years.
Thanks