From 89c66ff56cf94853cc11bb4e25ddf21413e96860 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Fri, 22 Apr 2016 15:21:37 -0700 Subject: [PATCH] qcacld-3.0: Avoid unexpected TSF GPIO failure qcacld-2.0 to qcacld-3.0 propagation A customer observed the following error log: wlan: [1662:E :HDD] hdd_wlan_startup: 12873: set tsf GPIO fail The customer was concerned that the device was not working correctly. The reality is that the TSF GPIO is only expected to be set on specific hardware platforms, and the customer platform was not one of those platforms. Fix this issue by making sure that all of the TSF GPIO logic is properly encapsulated within the WLAN_FEATURE_TSF feature flag. Change-Id: I34eab623243d4674c5fc1d0c8139d80efe5786a7 CRs-Fixed: 962955 --- core/hdd/inc/wlan_hdd_cfg.h | 2 ++ core/hdd/src/wlan_hdd_main.c | 37 +++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) 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,