From 2a78824a025d41f014e91df272a7766ec36be0c2 Mon Sep 17 00:00:00 2001 From: Bhavani Manda Date: Sun, 17 Mar 2024 22:17:01 +0000 Subject: [PATCH] Pull request #1647: MATTER-3297: Bugfix/add fixes for tickless idle m4 sleep Merge in WMN_TOOLS/matter from bugfix/add_fixes_for_tickless_idle_m4_sleep to RC_2.3.0-1.3-alpha.3 Squashed commit of the following: commit 00d25d7907acae15009184eb7ab1a7b1622efba3 Author: Rehan Rasool Date: Sun Mar 17 18:15:26 2024 -0400 Move variable declaration in the else statement where it is used commit 5a50a4c86d36ff9f8414a56daa8622d82f85909a Author: Rehan Rasool Date: Sun Mar 17 18:08:01 2024 -0400 Fix indentation commit c94664e24be97acaffeaabf7f1a118a7ace8b40d Author: Junior Martinez Date: Sun Mar 17 22:05:27 2024 +0000 Applied suggestion: update comment ... and 6 more commits --- examples/platform/silabs/MatterConfig.cpp | 26 +++++++++++++++++++---- third_party/silabs/wifi_sdk | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 65d714d8e4c2e5..dcd6576cc30c5f 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -21,11 +21,14 @@ #include "BaseApplication.h" #include "OTAConfig.h" #include - #include #include +#if CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED +#include "rsi_m4.h" +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED + #ifdef SL_WIFI #include "wfx_host_events.h" #endif /* SL_WIFI */ @@ -309,13 +312,28 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void) static bool is_sleep_ready = false; void vTaskPreSuppressTicksAndSleepProcessing(uint16_t * xExpectedIdleTime) { - if (!is_sleep_ready) - { + if (!is_sleep_ready) { *xExpectedIdleTime = 0; + } else { + // Indicate M4 is Inactive + P2P_STATUS_REG &= ~M4_is_active; + P2P_STATUS_REG; + + /* Delay is added to sync between M4 and TA */ + for (uint8_t delay = 0; delay < 10; delay++) { + __ASM("NOP"); + } + + // Checking if TA has already triggered a packet to M4 + // RX_BUFFER_VALID will be cleared by TA if any packet is triggered + if ((P2P_STATUS_REG & TA_wakeup_M4) || (P2P_STATUS_REG & M4_wakeup_TA) + || (!(M4SS_P2P_INTR_SET_REG & RX_BUFFER_VALID))) { + P2P_STATUS_REG |= M4_is_active; + *xExpectedIdleTime = 0; + } } } #endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED - extern "C" void vApplicationIdleHook(void) { #if CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED diff --git a/third_party/silabs/wifi_sdk b/third_party/silabs/wifi_sdk index da3892e94eecfa..96fa5c47e7f83d 160000 --- a/third_party/silabs/wifi_sdk +++ b/third_party/silabs/wifi_sdk @@ -1 +1 @@ -Subproject commit da3892e94eecfa0195fa1419171668ad6546537a +Subproject commit 96fa5c47e7f83d0152e884a428e0aef3944cc035