Skip to content
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

smartbond_timer: Use hw clock frequency for watchdog expire ticks #83635

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions drivers/timer/smartbond_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void sys_clock_set_timeout(int32_t ticks, bool idle)
* as soon as system is awaken. Following code makes sure that
* system never goes to sleep for longer time that watchdog reload value.
*/
if (!IS_ENABLED(CONFIG_WDT_SMARTBOND) && IS_ENABLED(CONFIG_PM)) {
if (IS_ENABLED(CONFIG_PM)) {
uint32_t watchdog_expire_ticks;

if (CRG_TOP->CLK_RCX_REG & CRG_TOP_CLK_RCX_REG_RCX_ENABLE_Msk) {
Expand All @@ -120,7 +120,8 @@ void sys_clock_set_timeout(int32_t ticks, bool idle)
* RC32K maximum frequency.
*/
watchdog_expire_ticks = SYS_WDOG->WATCHDOG_REG *
CONFIG_SYS_CLOCK_TICKS_PER_SEC / (get_rc32k_max_frequency() / 320);
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC /
(get_rc32k_max_frequency() / 320);
}
if (watchdog_expire_ticks - 2 < ticks) {
ticks = watchdog_expire_ticks - 2;
Expand Down
Loading