瀏覽代碼

qcacld-3.0: Add support for gpio based strobe to capture tsf

Add configuration for gpio pin used to send strobe to wlan hw.

The host driver will latch the current time and toggle the gpio
to generate a strobe to wlan hw.

The tsf will be latched on detecting the strobe and it will be
made available in a register for sw access.
The wlan fw will read this tsf and report it to driver using tsf event.

Change-Id: I4365d97d22836ddbbd2bf9913d4f723e5a870369
CRs-Fixed: 2495152
Subrat Dash 6 年之前
父節點
當前提交
57c3962868

+ 4 - 0
fw_offload/core/inc/wlan_fw_offload_main.h

@@ -178,6 +178,7 @@ struct wlan_fwol_neighbor_report_cfg {
  * @is_rate_limit_enabled: Enable/disable RA rate limited
  * @tsf_gpio_pin: TSF GPIO Pin config
  * @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
  * @lprx_enable: LPRx feature enable config
  * @sae_enable: SAE feature enable config
@@ -219,6 +220,9 @@ struct wlan_fwol_cfg {
 #ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_IRQ
 	uint32_t tsf_irq_host_gpio_pin;
 #endif
+#ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_SYNC
+	uint32_t tsf_sync_host_gpio_pin;
+#endif
 #endif
 #endif
 	bool lprx_enable;

+ 28 - 0
fw_offload/core/src/wlan_fw_offload_main.c

@@ -411,6 +411,33 @@ ucfg_fwol_fetch_tsf_irq_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
 {
 }
 #endif
+
+#ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_SYNC
+/**
+ * ucfg_fwol_fetch_tsf_sync_host_gpio_pin: Populate the
+ * tsf_sync_host_gpio_pin from cfg
+ * @psoc: The global psoc handler
+ * @fwol_cfg: The cfg structure
+ *
+ * This function is used to populate the cfg value of host platform
+ * gpio pin configured to drive tsf sync interrupt pin on wlan chip.
+ *
+ * Return: none
+ */
+static void
+ucfg_fwol_fetch_tsf_sync_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
+				       struct wlan_fwol_cfg *fwol_cfg)
+{
+	fwol_cfg->tsf_sync_host_gpio_pin =
+		cfg_get(psoc, CFG_SET_TSF_SYNC_HOST_GPIO_PIN);
+}
+#else
+static void
+ucfg_fwol_fetch_tsf_sync_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
+				       struct wlan_fwol_cfg *fwol_cfg)
+{
+}
+#endif
 /**
  * ucfg_fwol_init_sae_cfg: Populate the sae control config from cfg
  * @psoc: The global psoc handler
@@ -504,6 +531,7 @@ QDF_STATUS fwol_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
 	ucfg_fwol_fetch_ra_filter(psoc, fwol_cfg);
 	ucfg_fwol_fetch_tsf_gpio_pin(psoc, fwol_cfg);
 	ucfg_fwol_fetch_tsf_irq_host_gpio_pin(psoc, fwol_cfg);
+	ucfg_fwol_fetch_tsf_sync_host_gpio_pin(psoc, fwol_cfg);
 	ucfg_fwol_fetch_dhcp_server_settings(psoc, fwol_cfg);
 
 	return status;

+ 35 - 0
fw_offload/dispatcher/inc/cfg_fwol_generic.h

@@ -462,6 +462,40 @@
 #define __CFG_SET_TSF_IRQ_HOST_GPIO_PIN
 #endif
 
+#ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_SYNC
+/*
+ * <ini>
+ * gtsf_sync_host_gpio_pin
+ * @Min: 0
+ * @Max: 254
+ * @Default: 255
+ *
+ * TSF sync GPIO pin of host platform
+ *
+ * The driver will use this gpio on host platform
+ * to drive the TSF sync pin on wlan chip.
+ * Toggling this gpio  will generate a strobe to fw
+ * for latching TSF.
+ *
+ * Related: None
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SET_TSF_SYNC_HOST_GPIO_PIN CFG_INI_UINT( \
+		"gtsf_sync_host_gpio_pin", \
+		0, \
+		254, \
+		255, \
+		CFG_VALUE_OR_DEFAULT, \
+		"TSF sync GPIO pin of host platform")
+
+#define __CFG_SET_TSF_SYNC_HOST_GPIO_PIN CFG(CFG_SET_TSF_SYNC_HOST_GPIO_PIN)
+#else
+#define __CFG_SET_TSF_SYNC_HOST_GPIO_PIN
+#endif
+
 #if defined(WLAN_FEATURE_TSF) && defined(WLAN_FEATURE_TSF_PLUS)
 /* <ini>
  * gtsf_ptp_options: TSF Plus feature options
@@ -687,6 +721,7 @@
 	CFG(CFG_RA_FILTER_ENABLE) \
 	CFG(CFG_SET_TSF_GPIO_PIN) \
 	__CFG_SET_TSF_IRQ_HOST_GPIO_PIN \
+	__CFG_SET_TSF_SYNC_HOST_GPIO_PIN \
 	__CFG_SET_TSF_PTP_OPT \
 	CFG(CFG_LPRX) \
 	__CFG_IS_SAE_ENABLED \

+ 13 - 0
fw_offload/dispatcher/inc/wlan_fwol_ucfg_api.h

@@ -317,6 +317,19 @@ ucfg_fwol_get_tsf_irq_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
 				    uint32_t *tsf_irq_host_gpio_pin);
 #endif
 
+#ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_SYNC
+/**
+ * ucfg_fwol_get_tsf_sync_host_gpio_pin() - Assigns tsf_sync_host_gpio_pin value
+ * @psoc: pointer to the psoc object
+ *
+ * Return: QDF Status
+ */
+
+QDF_STATUS
+ucfg_fwol_get_tsf_sync_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
+				     uint32_t *tsf_irq_host_gpio_pin);
+#endif
+
 #ifdef DHCP_SERVER_OFFLOAD
 /**
  * ucfg_fwol_get_enable_dhcp_server_offload()-Assign enable_dhcp_server_offload

+ 21 - 0
fw_offload/dispatcher/src/wlan_fwol_ucfg_api.c

@@ -578,6 +578,27 @@ ucfg_fwol_get_tsf_irq_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+#endif
+
+#ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_SYNC
+QDF_STATUS
+ucfg_fwol_get_tsf_sync_host_gpio_pin(struct wlan_objmgr_psoc *psoc,
+				     uint32_t *tsf_sync_host_gpio_pin)
+{
+	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_host_gpio_pin =
+			cfg_default(CFG_SET_TSF_SYNC_HOST_GPIO_PIN);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	*tsf_sync_host_gpio_pin = fwol_obj->cfg.tsf_sync_host_gpio_pin;
+	return QDF_STATUS_SUCCESS;
+}
+
 #endif
 #endif
 #else