Parcourir la source

qcacld-3.0: Add ini to enable/disable TSF sync feature

Add ini to enable/disable TSF sync feature.

Change-Id: I84139f14ac7d01fb2cc52e84a9a817e644a05c77
CRs-Fixed: 2932588
Nirav Shah il y a 4 ans
Parent
commit
1932ac5950

+ 2 - 0
components/fw_offload/core/inc/wlan_fw_offload_main.h

@@ -206,6 +206,7 @@ struct wlan_fwol_neighbor_report_cfg {
  * @tsf_irq_host_gpio_pin: TSF GPIO Pin config
  * @tsf_sync_host_gpio_pin: TSF Sync GPIO Pin config
  * @tsf_ptp_options: TSF Plus feature options config
+ * @tsf_sync_enable: TSF sync feature enable/disable
  * @sae_enable: SAE feature enable config
  * @gcmp_enable: GCMP feature enable config
  * @enable_tx_sch_delay: Enable TX SCH delay value config
@@ -248,6 +249,7 @@ struct wlan_fwol_cfg {
 	uint32_t tsf_gpio_pin;
 #ifdef WLAN_FEATURE_TSF_PLUS
 	uint32_t tsf_ptp_options;
+	bool tsf_sync_enable;
 #ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_IRQ
 	uint32_t tsf_irq_host_gpio_pin;
 #endif

+ 1 - 0
components/fw_offload/core/src/wlan_fw_offload_main.c

@@ -435,6 +435,7 @@ static void ucfg_fwol_init_tsf_ptp_options(struct wlan_objmgr_psoc *psoc,
 					   struct wlan_fwol_cfg *fwol_cfg)
 {
 	fwol_cfg->tsf_ptp_options = cfg_get(psoc, CFG_SET_TSF_PTP_OPT);
+	fwol_cfg->tsf_sync_enable = cfg_get(psoc, CFG_TSF_SYNC_ENABLE);
 }
 #else
 static void ucfg_fwol_init_tsf_ptp_options(struct wlan_objmgr_psoc *psoc,

+ 22 - 1
components/fw_offload/dispatcher/inc/cfg_fwol_generic.h

@@ -538,6 +538,25 @@
 #endif
 
 #if defined(WLAN_FEATURE_TSF) && defined(WLAN_FEATURE_TSF_PLUS)
+/* <ini>
+ * g_enable_tsf_sync: Enable TSF sync feature
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * Enable/disable periodic sync of TSF with firmware.
+ *
+ * Related: None
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_TSF_SYNC_ENABLE CFG_INI_BOOL( \
+		"g_enable_tsf_sync", \
+		0, \
+		"Enable TSF sync feature")
+
 /* <ini>
  * gtsf_ptp_options: TSF Plus feature options
  * @Min: 0
@@ -570,7 +589,9 @@
 		CFG_VALUE_OR_DEFAULT, \
 		"TSF Plus feature options")
 
-#define __CFG_SET_TSF_PTP_OPT CFG(CFG_SET_TSF_PTP_OPT)
+#define __CFG_SET_TSF_PTP_OPT \
+		CFG(CFG_SET_TSF_PTP_OPT) \
+		CFG(CFG_TSF_SYNC_ENABLE)
 #else
 #define __CFG_SET_TSF_PTP_OPT
 #endif

+ 10 - 0
components/fw_offload/dispatcher/inc/wlan_fwol_ucfg_api.h

@@ -445,6 +445,16 @@ QDF_STATUS ucfg_fwol_get_dhcp_max_num_clients(struct wlan_objmgr_psoc *psoc,
 					      uint32_t *dhcp_max_num_clients);
 #endif
 
+/**
+ * ucfg_fwol_get_tsf_sync_enable() - Get TSF sync enabled
+ * @psoc: pointer to the psoc object
+ * @tsf_sync_enable: Pointer to tsf sync enabled
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS ucfg_fwol_get_tsf_sync_enable(struct wlan_objmgr_psoc *psoc,
+					 bool *tsf_sync_enable);
+
 /**
  * ucfg_fwol_get_tsf_ptp_options() - Get TSF Plus feature options
  * @psoc: pointer to the psoc object

+ 16 - 0
components/fw_offload/dispatcher/src/wlan_fwol_ucfg_api.c

@@ -685,6 +685,22 @@ QDF_STATUS ucfg_fwol_get_tsf_ptp_options(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS ucfg_fwol_get_tsf_sync_enable(struct wlan_objmgr_psoc *psoc,
+					 bool *tsf_sync_enable)
+{
+	struct wlan_fwol_psoc_obj *fwol_obj;
+
+	fwol_obj = fwol_get_psoc_obj(psoc);
+	if (!fwol_obj) {
+		fwol_err("Failed to get FWOL obj");
+		*tsf_sync_enable = cfg_default(CFG_TSF_SYNC_ENABLE);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	*tsf_sync_enable = fwol_obj->cfg.tsf_sync_enable;
+	return QDF_STATUS_SUCCESS;
+}
+
 #ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_IRQ
 QDF_STATUS
 ucfg_fwol_get_tsf_irq_host_gpio_pin(struct wlan_objmgr_psoc *psoc,

+ 16 - 0
core/hdd/src/wlan_hdd_tsf.c

@@ -290,6 +290,17 @@ bool hdd_tsf_is_tsf64_tx_set(struct hdd_context *hdd)
 	else
 		return false;
 }
+
+static bool hdd_is_tsf_sync_enabled(struct hdd_context *hdd)
+{
+	bool is_tsf_sync_enable;
+
+	if (hdd && QDF_IS_STATUS_SUCCESS(
+	    ucfg_fwol_get_tsf_sync_enable(hdd->psoc, &is_tsf_sync_enable)))
+		return is_tsf_sync_enable;
+	else
+		return false;
+}
 #else
 
 static bool hdd_tsf_is_ptp_enabled(struct hdd_context *hdd)
@@ -1430,6 +1441,11 @@ static enum hdd_tsf_op_result hdd_tsf_sync_init(struct hdd_adapter *adapter)
 		return HDD_TSF_OP_FAIL;
 	}
 
+	if (!hdd_is_tsf_sync_enabled(hddctx)) {
+		hdd_err("TSF sync feature not enabled");
+		return HDD_TSF_OP_FAIL;
+	}
+
 	if (hdd_get_th_sync_status(adapter)) {
 		hdd_err("Host Target sync has been initialized!!");
 		return HDD_TSF_OP_SUCC;