diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 3d346292ba84..70d4ad63095f 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -3585,7 +3585,9 @@ struct hdd_config { uint16_t obss_passive_dwelltime; uint16_t obss_width_trigger_interval; uint8_t inform_bss_rssi_raw; +#ifdef WLAN_FEATURE_TSF uint32_t tsf_gpio_pin; +#endif #ifdef QCA_WIFI_3_0_EMU bool enable_m2m_limitation; #endif diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 47198bcdfc19..6722d4677832 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -5671,6 +5671,35 @@ QDF_STATUS hdd_register_for_sap_restart_with_channel_switch(void) } #endif +/** + * hdd_tsf_init() - Initialize the TSF synchronization interface + * @hdd_ctx: HDD global context + * + * When TSF synchronization via GPIO is supported by the driver and + * has been enabled in the configuration file, this function plumbs + * the GPIO value down to firmware via SME. + * + * Return: None + */ +#ifdef WLAN_FEATURE_TSF +static void hdd_tsf_init(hdd_context_t *hdd_ctx) +{ + QDF_STATUS status; + + if (hdd_ctx->config->tsf_gpio_pin == TSF_GPIO_PIN_INVALID) + return; + + status = sme_set_tsf_gpio(hdd_ctx->hHal, + hdd_ctx->config->tsf_gpio_pin); + if (!QDF_IS_STATUS_SUCCESS(status)) + hdd_err("Set tsf GPIO failed, status: %d", status); +} +#else +static void hdd_tsf_init(hdd_context_t *hdd_ctx) +{ +} +#endif + /** * hdd_wlan_startup() - HDD init function * @dev: Pointer to the underlying device @@ -5943,13 +5972,7 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc) if (QDF_IS_STATUS_SUCCESS(status)) hdd_err("Error setting txlimit in sme: %d", status); - if (hdd_ctx->config->tsf_gpio_pin != TSF_GPIO_PIN_INVALID) { - status = sme_set_tsf_gpio(hdd_ctx->hHal, - hdd_ctx->config->tsf_gpio_pin); - if (!QDF_IS_STATUS_SUCCESS(status)) - hdd_err("set tsf GPIO fail"); - } - + hdd_tsf_init(hdd_ctx); #ifdef MSM_PLATFORM spin_lock_init(&hdd_ctx->bus_bw_lock); qdf_mc_timer_init(&hdd_ctx->bus_bw_timer,