@@ -56,8 +56,8 @@ extern "C" {
56
56
#endif
57
57
58
58
#if CHIP_CONFIG_ENABLE_ICD_SERVER
59
- #include < app/icd/server/ICDConfigurationData.h> // nogncheck
60
- #include < platform/silabs/wifi/icd/WifiSleepManager.h>
59
+ #include < app/icd/server/ICDConfigurationData.h> // nogncheck
60
+ #include < platform/silabs/wifi/icd/WifiSleepManager.h> // nogncheck
61
61
62
62
#if SLI_SI91X_MCU_INTERFACE // SoC Only
63
63
#include " rsi_rom_power_save.h"
@@ -434,6 +434,40 @@ sl_status_t SetWifiConfigurations()
434
434
return status;
435
435
}
436
436
437
+ #if CHIP_CONFIG_ENABLE_ICD_SERVER
438
+ /* *
439
+ * @brief Converts the Matter Power Save Configuration to the SiWx Power Save Configuration
440
+ *
441
+ * @param configuration Matter Power Save Configuration
442
+ *
443
+ * @return sl_si91x_performance_profile_t SiWx Power Save Configuration; Default value is High Performance
444
+ * kHighPerformance: HIGH_PERFORMANCE
445
+ * kConnectedSleep: ASSOCIATED_POWER_SAVE
446
+ * kDeepSleep: DEEP_SLEEP_WITH_RAM_RETENTION
447
+ */
448
+ sl_si91x_performance_profile_t ConvertPowerSaveConfiguration (PowerSaveInterface::PowerSaveConfiguration configuration)
449
+ {
450
+ sl_si91x_performance_profile_t profile = HIGH_PERFORMANCE;
451
+
452
+ switch (configuration)
453
+ {
454
+ case PowerSaveInterface::PowerSaveConfiguration::kHighPerformance :
455
+ profile = HIGH_PERFORMANCE;
456
+ break ;
457
+ case PowerSaveInterface::PowerSaveConfiguration::kConnectedSleep :
458
+ profile = ASSOCIATED_POWER_SAVE;
459
+ break ;
460
+ case PowerSaveInterface::PowerSaveConfiguration::kDeepSleep :
461
+ profile = DEEP_SLEEP_WITH_RAM_RETENTION;
462
+ break ;
463
+ default :
464
+ break ;
465
+ }
466
+
467
+ return profile;
468
+ }
469
+ #endif // CHIP_CONFIG_ENABLE_ICD_SERVER
470
+
437
471
} // namespace
438
472
439
473
namespace chip {
@@ -462,6 +496,11 @@ void WiseconnectWifiInterface::MatterWifiTask(void * arg)
462
496
VerifyOrReturn (status == SL_STATUS_OK,
463
497
ChipLogError (DeviceLayer, " MatterWifiTask: SiWxPlatformInit failed: 0x%lx" , static_cast <uint32_t >(status)));
464
498
499
+ #if CHIP_CONFIG_ENABLE_ICD_SERVER
500
+ // Remove High performance request after the device is initialized
501
+ chip::DeviceLayer::Silabs::WifiSleepManager::GetInstance ().RemoveHighPerformanceRequest ();
502
+ #endif // CHIP_CONFIG_ENABLE_ICD_SERVER
503
+
465
504
WifiInterfaceImpl::GetInstance ().NotifyWifiTaskInitialized ();
466
505
467
506
ChipLogDetail (DeviceLayer, " MatterWifiTask: starting event loop" );
@@ -482,6 +521,11 @@ CHIP_ERROR WifiInterfaceImpl::InitWiFiStack(void)
482
521
{
483
522
sl_status_t status = SL_STATUS_OK;
484
523
524
+ #if CHIP_CONFIG_ENABLE_ICD_SERVER
525
+ // Force the device to high performance mode during the init sequence.
526
+ chip::DeviceLayer::Silabs::WifiSleepManager::GetInstance ().RequestHighPerformanceWithoutTransition ();
527
+ #endif // CHIP_CONFIG_ENABLE_ICD_SERVER
528
+
485
529
status = sl_net_init (SL_NET_WIFI_CLIENT_INTERFACE, &config, &wifi_client_context, nullptr );
486
530
VerifyOrReturnError (status == SL_STATUS_OK, CHIP_ERROR_INTERNAL, ChipLogError (DeviceLayer, " sl_net_init failed: %lx" , status));
487
531
@@ -641,7 +685,7 @@ sl_status_t WifiInterfaceImpl::JoinWifiNetwork(void)
641
685
// To avoid IOP issues, it is recommended to enable high-performance mode before joining the network.
642
686
// TODO: Remove this once the IOP issue related to power save mode switching is fixed in the Wi-Fi SDK.
643
687
#if CHIP_CONFIG_ENABLE_ICD_SERVER
644
- chip::DeviceLayer::Silabs::WifiSleepManager::GetInstance ().RequestHighPerformance ();
688
+ chip::DeviceLayer::Silabs::WifiSleepManager::GetInstance ().RequestHighPerformanceWithTransition ();
645
689
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
646
690
647
691
status = sl_net_up (SL_NET_WIFI_CLIENT_INTERFACE, SL_NET_DEFAULT_WIFI_CLIENT_PROFILE_ID);
@@ -760,14 +804,13 @@ sl_status_t WifiInterfaceImpl::TriggerPlatformWifiDisconnection()
760
804
}
761
805
762
806
#if CHIP_CONFIG_ENABLE_ICD_SERVER
763
- CHIP_ERROR WifiInterfaceImpl::ConfigurePowerSave (rsi_power_save_profile_mode_t sl_si91x_ble_state,
764
- sl_si91x_performance_profile_t sl_si91x_wifi_state, uint32_t listenInterval)
807
+ CHIP_ERROR WifiInterfaceImpl::ConfigurePowerSave (PowerSaveInterface::PowerSaveConfiguration configuration, uint32_t listenInterval)
765
808
{
766
- int32_t error = rsi_bt_power_save_profile (sl_si91x_ble_state , RSI_MAX_PSP);
809
+ int32_t error = rsi_bt_power_save_profile (RSI_SLEEP_MODE_2 , RSI_MAX_PSP);
767
810
VerifyOrReturnError (error == RSI_SUCCESS, CHIP_ERROR_INTERNAL,
768
811
ChipLogError (DeviceLayer, " rsi_bt_power_save_profile failed: %ld" , error));
769
812
770
- sl_wifi_performance_profile_t wifi_profile = { .profile = sl_si91x_wifi_state ,
813
+ sl_wifi_performance_profile_t wifi_profile = { .profile = ConvertPowerSaveConfiguration (configuration) ,
771
814
// TODO: Performance profile fails if not alligned with DTIM
772
815
.dtim_aligned_type = SL_SI91X_ALIGN_WITH_DTIM_BEACON,
773
816
// TODO: Different types need to be fixed in the Wi-Fi SDK
0 commit comments