Skip to content
Open
Show file tree
Hide file tree
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
19 changes: 17 additions & 2 deletions kernel/timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@
#ifdef CONFIG_SOC_FAMILY_REALTEK_BEE
/* To support RTK PM */
extern void sys_clock_only_add_cycle_count(int32_t ticks);
extern void CPU_DLPS_Exit(void);
struct _timeout *get_first_timeout(void)
{
return first();
Expand Down Expand Up @@ -366,6 +367,7 @@

void sys_clock_announce_process_timeout(void)
{
/* Update the timeout list: only handle pended ticks. */
k_spinlock_key_t key = k_spin_lock(&timeout_lock);

struct _timeout *t;
Expand All @@ -383,11 +385,24 @@

pended_ticks = 0;

/* Separate the handling of pending tick counts and timeout
* callback functions to avoid errors when a timer is started
k_spin_unlock(&timeout_lock, key);

/* Resume NVIC to trigger interrupts that occurred during DLPS.
* ISR might update the timout list, so ensure this is done after updating

Check warning on line 391 in kernel/timeout.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

TYPO_SPELLING

kernel/timeout.c:391 'timout' may be misspelled - perhaps 'timeout'?
* the timeout list.
*/
__disable_irq();
CPU_DLPS_Exit();
__enable_irq();

/* Manually trigger processing of the timeout callback.
* Separating updating pended ticks and timeout
* callback processing to avoid errors if timer behaivor happens
* during the timer callback.
*/

key = k_spin_lock(&timeout_lock);

Check warning on line 404 in kernel/timeout.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LEADING_SPACE

kernel/timeout.c:404 please, no spaces at the start of a line

Check warning on line 404 in kernel/timeout.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACE_BEFORE_TAB

kernel/timeout.c:404 please, no space before tabs

Check failure on line 404 in kernel/timeout.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

CODE_INDENT

kernel/timeout.c:404 code indent should use tabs where possible

for (t = first(); (t != NULL) && (t->dticks == 0); t = first()) {
remove_timeout(t);

Expand Down
5 changes: 2 additions & 3 deletions soc/realtek/bee/rtl87x2g/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@
PM_DEVICE_ACTION_RESUME);
}

CPU_DLPS_Exit();

num_susp_rtk = 0;
}

Expand All @@ -183,7 +181,8 @@
sys_clock_restore_tick_and_cycle();
__enable_irq();

/* Subtract the pended tick from the timeout list and manually trigger a timeout process. */
/* Subtract the pended tick from the timeout list, resume NVIC and manually trigger the
* timeout callback process. */

Check warning on line 185 in soc/realtek/bee/rtl87x2g/power.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

BLOCK_COMMENT_STYLE

soc/realtek/bee/rtl87x2g/power.c:185 Block comments use a trailing */ on a separate line
sys_clock_announce_process_timeout();
}

Expand Down
2 changes: 1 addition & 1 deletion tests/boards/rtl87x2g_evb/pm/timeout_wakeup/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ ZTEST(timeout_wakeup, test_k_thread_wakeup)
uint32_t wakeup_count_thread;

power_get_statistics(&wakeup_count_before_test, &last_wakeup_clk, &last_sleep_clk);
while (test_thread_sleep_num <= THREAD_SLEEP_NUMBERS) {
while (test_thread_sleep_num < THREAD_SLEEP_NUMBERS) {
k_msleep(100);
test_thread_sleep_num++;
}
Expand Down
Loading