new file mode 100644
@@ -0,0 +1,80 @@
+// SPDX-License-Identifier: MIT
+/* Copyright(c) 2019-2021, Celeno Communications Ltd. */
+
+#include "maintenance.h"
+#include "utils/timer.h"
+#include "traffic.h"
+#include "vns.h"
+#include "reg/reg_access.h"
+#include "sounding.h"
+#include "utils/utils.h"
+#include "sta.h"
+#include "motion_sense.h"
+#include "cca.h"
+#include "noise.h"
+
+static void cl_maintenance_callback_slow(unsigned long data)
+{
+ struct cl_hw *cl_hw = (struct cl_hw *)data;
+
+ cl_cca_maintenance(cl_hw);
+ cl_noise_maintenance(cl_hw);
+
+ if (cl_hw->chip->conf->ce_production_mode)
+ return;
+
+ cl_vns_maintenance(cl_hw);
+
+ if (cl_sta_num(cl_hw) == 0)
+ return;
+
+ cl_motion_sense_maintenance(cl_hw);
+ cl_sounding_maintenance(cl_hw);
+}
+
+static void cl_maintenance_callback_fast(unsigned long data)
+{
+ struct cl_hw *cl_hw = (struct cl_hw *)data;
+
+ if (cl_sta_num(cl_hw) == 0)
+ return;
+
+ cl_traffic_maintenance(cl_hw);
+}
+
+void cl_maintenance_init(struct cl_hw *cl_hw)
+{
+ cl_timer_init(&cl_hw->maintenance_slow_timer,
+ cl_maintenance_callback_slow,
+ (unsigned long)cl_hw,
+ CL_MAINTENANCE_PERIOD_SLOW_MS,
+ true);
+
+ cl_timer_init(&cl_hw->maintenance_fast_timer,
+ cl_maintenance_callback_fast,
+ (unsigned long)cl_hw,
+ CL_MAINTENANCE_PERIOD_FAST_MS,
+ true);
+
+ cl_maintenance_start(cl_hw);
+}
+
+void cl_maintenance_close(struct cl_hw *cl_hw)
+{
+ cl_timer_disable_sync(&cl_hw->maintenance_slow_timer);
+ cl_timer_disable_sync(&cl_hw->maintenance_fast_timer);
+}
+
+void cl_maintenance_stop(struct cl_hw *cl_hw)
+{
+ cl_timer_disable(&cl_hw->maintenance_slow_timer);
+ cl_timer_disable(&cl_hw->maintenance_fast_timer);
+}
+
+void cl_maintenance_start(struct cl_hw *cl_hw)
+{
+ cl_timer_enable(&cl_hw->maintenance_slow_timer);
+
+ if (!cl_hw->chip->conf->ce_production_mode)
+ cl_timer_enable(&cl_hw->maintenance_fast_timer);
+}