[Silabs] Add CSL support to silabs platform (#31838)

* Add CSL support for Silabs platform

* Clean up CSL support

* enable ssed ICD on window-app by default

* remove --ssed build flag

* restyle

* Enable ICDM cluster
diff --git a/examples/light-switch-app/silabs/openthread.gni b/examples/light-switch-app/silabs/openthread.gni
index 19b09c0..2ea7cd4 100644
--- a/examples/light-switch-app/silabs/openthread.gni
+++ b/examples/light-switch-app/silabs/openthread.gni
@@ -31,7 +31,7 @@
 sl_use_subscription_synching = true
 
 # Openthread Configuration flags
-sl_ot_idle_interval_ms = 30000  # 30s Idle Intervals
+sl_ot_idle_interval_ms = 15000  # 15s Idle Intervals
 sl_ot_active_interval_ms = 500  # 500ms Active Intervals
 
 # ICD Matter Configuration flags
diff --git a/examples/light-switch-app/silabs/src/AppTask.cpp b/examples/light-switch-app/silabs/src/AppTask.cpp
index 2f8d012..c9759d2 100644
--- a/examples/light-switch-app/silabs/src/AppTask.cpp
+++ b/examples/light-switch-app/silabs/src/AppTask.cpp
@@ -25,29 +25,24 @@
 #include "AppConfig.h"
 #include "AppEvent.h"
 #include "BindingHandler.h"
-
 #include "LEDWidget.h"
-
 #include "LightSwitchMgr.h"
-
 #ifdef DISPLAY_ENABLED
 #include "lcd.h"
 #ifdef QR_CODE_ENABLED
 #include "qrcodegen.h"
 #endif // QR_CODE_ENABLED
 #endif // DISPLAY_ENABLED
-
 #include <app/server/OnboardingCodesUtil.h>
 #include <app/server/Server.h>
 #include <app/util/attribute-storage.h>
 #include <assert.h>
 #include <lib/support/CodeUtils.h>
 #include <platform/CHIPDeviceLayer.h>
+#include <platform/silabs/platformAbstraction/SilabsPlatform.h>
 #include <setup_payload/QRCodeSetupPayloadGenerator.h>
 #include <setup_payload/SetupPayload.h>
 
-#include <platform/silabs/platformAbstraction/SilabsPlatform.h>
-
 /**********************************************************
  * Defines and Constants
  *********************************************************/
diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp
index 3a78cf7..e9fed8d 100644
--- a/examples/platform/silabs/MatterConfig.cpp
+++ b/examples/platform/silabs/MatterConfig.cpp
@@ -113,7 +113,11 @@
     ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router));
 #else // CHIP_DEVICE_CONFIG_THREAD_FTD
 #if CHIP_CONFIG_ENABLE_ICD_SERVER
+#if CHIP_DEVICE_CONFIG_THREAD_SSED
+    ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice));
+#else
     ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice));
+#endif
 #else  // CHIP_CONFIG_ENABLE_ICD_SERVER
     ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice));
 #endif // CHIP_CONFIG_ENABLE_ICD_SERVER
diff --git a/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h b/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h
index e906e48..d7492f4 100644
--- a/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h
+++ b/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h
@@ -45,35 +45,39 @@
 // Timeout after 2 missed checkin or 4 mins if sleep interval is too short.
 #define OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT ((SL_MLE_TIMEOUT_s < 120) ? 240 : ((SL_MLE_TIMEOUT_s * 2) + 1))
 
+#if defined(SL_CSL_ENABLE) && SL_CSL_ENABLE
+
+#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 1
+#define OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE 1
+#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1
+#define OPENTHREAD_CONFIG_CHILD_SUPERVISION_CHECK_TIMEOUT 0
+#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD 750
+#define OPENTHREAD_CONFIG_CSL_TIMEOUT SL_CSL_TIMEOUT
+#define SL_OPENTHREAD_CSL_TX_UNCERTAINTY 200
+
+#endif // SL_CSL_ENABLE
+
 #endif // SL_ICD_ENABLED
 
 /****Uncomment below section for OpenThread Debug logs*/
 // #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG
 
 // #ifndef OPENTHREAD_CONFIG_LOG_CLI
-// #define OPENTHREAD_CONFIG_LOG_CLI                   1
+// #define OPENTHREAD_CONFIG_LOG_CLI 1
 // #endif
 
 // #ifndef OPENTHREAD_CONFIG_LOG_PKT_DUMP
-// #define OPENTHREAD_CONFIG_LOG_PKT_DUMP              1
+// #define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1
 // #endif
 
 // #ifndef OPENTHREAD_CONFIG_LOG_PLATFORM
-// #define OPENTHREAD_CONFIG_LOG_PLATFORM              1
+// #define OPENTHREAD_CONFIG_LOG_PLATFORM 1
 // #endif
 
 // #ifndef OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL
-// #define OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL         1
+// #define OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL 1
 // #endif
 
-// EFR32MG21A020F1024IM32 has 96k of RAM. Reduce the number of buffers to
-// conserve RAM for this Series 2 part.
-#if defined(EFR32MG21)
-#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 22
-#define OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE 512
-#define OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE 512
-#endif
-
 #define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1
 #define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1
 
diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter
index c830830..feb7bc3 100644
--- a/examples/window-app/common/window-app.matter
+++ b/examples/window-app/common/window-app.matter
@@ -1810,6 +1810,91 @@
   readonly attribute int16u clusterRevision = 65533;
 }
 
+/** Allows servers to ensure that listed clients are notified when a server is available for communication. */
+cluster IcdManagement = 70 {
+  revision 2;
+
+  enum OperatingModeEnum : enum8 {
+    kSIT = 0;
+    kLIT = 1;
+  }
+
+  bitmap Feature : bitmap32 {
+    kCheckInProtocolSupport = 0x1;
+    kUserActiveModeTrigger = 0x2;
+    kLongIdleTimeSupport = 0x4;
+  }
+
+  bitmap UserActiveModeTriggerBitmap : bitmap32 {
+    kPowerCycle = 0x1;
+    kSettingsMenu = 0x2;
+    kCustomInstruction = 0x4;
+    kDeviceManual = 0x8;
+    kActuateSensor = 0x10;
+    kActuateSensorSeconds = 0x20;
+    kActuateSensorTimes = 0x40;
+    kActuateSensorLightsBlink = 0x80;
+    kResetButton = 0x100;
+    kResetButtonLightsBlink = 0x200;
+    kResetButtonSeconds = 0x400;
+    kResetButtonTimes = 0x800;
+    kSetupButton = 0x1000;
+    kSetupButtonSeconds = 0x2000;
+    kSetupButtonLightsBlink = 0x4000;
+    kSetupButtonTimes = 0x8000;
+    kAppDefinedButton = 0x10000;
+  }
+
+  fabric_scoped struct MonitoringRegistrationStruct {
+    fabric_sensitive node_id checkInNodeID = 1;
+    fabric_sensitive int64u monitoredSubject = 2;
+    fabric_idx fabricIndex = 254;
+  }
+
+  readonly attribute int32u idleModeDuration = 0;
+  readonly attribute int32u activeModeDuration = 1;
+  readonly attribute int16u activeModeThreshold = 2;
+  readonly attribute access(read: administer) optional MonitoringRegistrationStruct registeredClients[] = 3;
+  readonly attribute access(read: administer) optional int32u ICDCounter = 4;
+  readonly attribute optional int16u clientsSupportedPerFabric = 5;
+  readonly attribute optional UserActiveModeTriggerBitmap userActiveModeTriggerHint = 6;
+  readonly attribute optional char_string<128> userActiveModeTriggerInstruction = 7;
+  readonly attribute optional OperatingModeEnum operatingMode = 8;
+  readonly attribute command_id generatedCommandList[] = 65528;
+  readonly attribute command_id acceptedCommandList[] = 65529;
+  readonly attribute event_id eventList[] = 65530;
+  readonly attribute attrib_id attributeList[] = 65531;
+  readonly attribute bitmap32 featureMap = 65532;
+  readonly attribute int16u clusterRevision = 65533;
+
+  request struct RegisterClientRequest {
+    node_id checkInNodeID = 0;
+    int64u monitoredSubject = 1;
+    octet_string<16> key = 2;
+    optional octet_string<16> verificationKey = 3;
+  }
+
+  response struct RegisterClientResponse = 1 {
+    int32u ICDCounter = 0;
+  }
+
+  request struct UnregisterClientRequest {
+    node_id checkInNodeID = 0;
+    optional octet_string<16> verificationKey = 1;
+  }
+
+  response struct StayActiveResponse = 4 {
+    int32u promisedActiveDuration = 0;
+  }
+
+  /** Register a client to the end device */
+  fabric command access(invoke: manage) RegisterClient(RegisterClientRequest): RegisterClientResponse = 0;
+  /** Unregister a client from an end device */
+  fabric command access(invoke: manage) UnregisterClient(UnregisterClientRequest): DefaultSuccess = 2;
+  /** Request the end device to stay in Active Mode for an additional ActiveModeThreshold */
+  command access(invoke: manage) StayActiveRequest(): StayActiveResponse = 3;
+}
+
 /** Provides an interface for controlling and adjusting automatic window coverings. */
 cluster WindowCovering = 258 {
   revision 5;
@@ -2360,6 +2445,18 @@
     ram      attribute featureMap default = 0;
     ram      attribute clusterRevision default = 1;
   }
+
+  server cluster IcdManagement {
+    callback attribute idleModeDuration;
+    callback attribute activeModeDuration;
+    callback attribute activeModeThreshold;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0x0000;
+    ram      attribute clusterRevision default = 2;
+  }
 }
 endpoint 1 {
   device type ma_windowcovering = 514, version 2;
diff --git a/examples/window-app/common/window-app.zap b/examples/window-app/common/window-app.zap
index 46ca5f5..801757e 100644
--- a/examples/window-app/common/window-app.zap
+++ b/examples/window-app/common/window-app.zap
@@ -5065,6 +5065,160 @@
               "reportableChange": 0
             }
           ]
+        },
+        {
+          "name": "ICD Management",
+          "code": 70,
+          "mfgCode": null,
+          "define": "ICD_MANAGEMENT_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "attributes": [
+            {
+              "name": "IdleModeDuration",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int32u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ActiveModeDuration",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int32u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ActiveModeThreshold",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "GeneratedCommandList",
+              "code": 65528,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "AcceptedCommandList",
+              "code": 65529,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "EventList",
+              "code": 65530,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "AttributeList",
+              "code": 65531,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0000",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ClusterRevision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "2",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            }
+          ]
         }
       ]
     },
@@ -7105,5 +7259,6 @@
       "endpointId": 2,
       "networkId": 0
     }
-  ]
+  ],
+  "log": []
 }
\ No newline at end of file
diff --git a/examples/window-app/silabs/openthread.gni b/examples/window-app/silabs/openthread.gni
index ffe5dc7..cdd7f8c 100644
--- a/examples/window-app/silabs/openthread.gni
+++ b/examples/window-app/silabs/openthread.gni
@@ -24,3 +24,18 @@
 
 openthread_external_platform =
     "${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32"
+
+# ICD Default configurations
+chip_enable_icd_server = true
+enable_synchronized_sed = true
+chip_subscription_timeout_resumption = false
+sl_use_subscription_synching = true
+
+# Openthread Configuration flags
+sl_ot_idle_interval_ms = 1000  # 1s Idle Intervals
+sl_ot_active_interval_ms = 500  # 500ms Active Intervals
+
+# ICD Matter Configuration flags
+sl_idle_mode_interval_s = 600  # 10min Idle Mode Interval
+sl_active_mode_interval_ms = 0  # 0s Active Mode Interval
+sl_active_mode_threshold_ms = 0  # 1s Active Mode Threshold
diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh
index fc8fcfd..c69f9d4 100755
--- a/scripts/examples/gn_silabs_example.sh
+++ b/scripts/examples/gn_silabs_example.sh
@@ -86,6 +86,10 @@
         chip_enable_icd_server
             Configure has a Intermitently connected device. (Default false)
             Must also set chip_openthread_ftd=false
+        enable_synchronized_sed
+            Enable Synchronized Sleepy end device. (Default false)
+            Must also set chip_enable_icd_server=true chip_openthread_ftd=false
+            --icd can be used to configure both arguments
         use_rs9116
             Build wifi example with extension board rs9116. (Default false)
         use_SiWx917
diff --git a/src/platform/silabs/CHIPDevicePlatformConfig.h b/src/platform/silabs/CHIPDevicePlatformConfig.h
index 12aadb2..fa3a509 100644
--- a/src/platform/silabs/CHIPDevicePlatformConfig.h
+++ b/src/platform/silabs/CHIPDevicePlatformConfig.h
@@ -118,22 +118,6 @@
 
 // ========== Platform-specific Configuration Overrides =========
 
-#ifndef CHIP_DEVICE_CONFIG_BLE_LL_TASK_PRIORITY
-#define CHIP_DEVICE_CONFIG_BLE_LL_TASK_PRIORITY (configTIMER_TASK_PRIORITY - 1)
-#endif // CHIP_DEVICE_CONFIG_BLE_LL_TASK_PRIORITY
-
-#ifndef CHIP_DEVICE_CONFIG_BLE_STACK_TASK_PRIORITY
-#define CHIP_DEVICE_CONFIG_BLE_STACK_TASK_PRIORITY (CHIP_DEVICE_CONFIG_BLE_LL_TASK_PRIORITY - 1)
-#endif // CHIP_DEVICE_CONFIG_BLE_STACK_TASK_PRIORITY
-
-#ifndef CHIP_DEVICE_CONFIG_BLE_APP_TASK_PRIORITY
-#define CHIP_DEVICE_CONFIG_BLE_APP_TASK_PRIORITY (CHIP_DEVICE_CONFIG_BLE_STACK_TASK_PRIORITY - 1)
-#endif // CHIP_DEVICE_CONFIG_BLE_STACK_TASK_PRIORITY
-
-#ifndef CHIP_DEVICE_CONFIG_BLE_APP_TASK_STACK_SIZE
-#define CHIP_DEVICE_CONFIG_BLE_APP_TASK_STACK_SIZE 1536
-#endif // CHIP_DEVICE_CONFIG_BLE_APP_TASK_STACK_SIZE
-
 #ifndef CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE
 #define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE (6 * 1024)
 #endif // CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE
diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni
index 3a80deb..415f89b 100644
--- a/third_party/silabs/efr32_sdk.gni
+++ b/third_party/silabs/efr32_sdk.gni
@@ -50,6 +50,9 @@
   sl_ot_idle_interval_ms = 15000  # 15s Idle Intervals
   sl_ot_active_interval_ms = 200  # 200ms Active Intervals
 
+  # SSED Specific configurations
+  sl_ot_csl_timeout_sec = 30  # 30s CSL timeout
+
   # ICD Matter Configuration flags
   sl_idle_mode_interval_s = 600  # 10min Idle Mode Interval
   sl_active_mode_interval_ms = 1000  # 1s Active Mode Interval
@@ -59,6 +62,9 @@
 
   silabs_log_enabled = true
 
+  # Enable Synchronized Sleepy End Device
+  enable_synchronized_sed = false
+
   # Argument to enable IPv4 for wifi
   # aligning to match chip_inet_config_enable_ipv4 default configuration
   chip_enable_wifi_ipv4 = false
@@ -160,7 +166,6 @@
       "${efr32_sdk_root}/platform/radio/rail_lib/protocol/ieee802154",
       "${efr32_sdk_root}/platform/radio/rail_lib/protocol/ble",
       "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions",
-      "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_power_manager_init",
       "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_pti",
       "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_power_manager_init",
       "${efr32_sdk_root}/platform/service/device_init/inc",
@@ -296,13 +301,6 @@
       #"__STACK_SIZE=0",
     ]
 
-    if (!(use_silabs_thread_lib || use_silabs_thread_lib)) {
-      #Enabling this config temporarly to fix a build issue until
-      #official fix is pushed
-
-      defines += [ "OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1" ]
-    }
-
     # Temporary configuration to enable COAP specific configurations
     if (use_thread_coap_lib) {
       defines += [ "SL_USE_COAP_CONFIG=1" ]
@@ -433,6 +431,14 @@
           "SL_OT_IDLE_INTERVAL=${sl_ot_idle_interval_ms}",
           "SL_OT_ACTIVE_INTERVAL=${sl_ot_active_interval_ms}",
         ]
+
+        if (enable_synchronized_sed) {
+          defines += [
+            "CHIP_DEVICE_CONFIG_THREAD_SSED=1",
+            "SL_CSL_ENABLE=1",
+            "SL_CSL_TIMEOUT=${sl_ot_csl_timeout_sec}",
+          ]
+        }
       }
 
       if (defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi) {