diff options
| author | Manikandan Mohan <manikand@codeaurora.org> | 2016-03-15 16:33:31 -0700 |
|---|---|---|
| committer | Vishwajith Upendra <vishwaji@codeaurora.org> | 2016-05-02 23:27:52 -0700 |
| commit | 976e756f56c31feddb9ec661ae0e41e68f1ea13c (patch) | |
| tree | 56d3fe04a701f9f30382909cb8bf860a56050776 | |
| parent | dcc21ba7f6832710388bdf41c790683a69242c8b (diff) | |
qcacld-3.0: Configure tsf gpio pin
qcacld-2.0 to qcacld-3.0 propagation
Add configuration of gpio pin used for TSF. FW shall toggle
this gpio when receive capture/get tsf cmd.
Change-Id: I442f2de3af4f3946a20bf3f4a9d8c9b285aa7a7c
CRs-Fixed: 817527
| -rw-r--r-- | core/hdd/inc/wlan_hdd_cfg.h | 6 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_cfg.c | 9 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_main.c | 4 | ||||
| -rw-r--r-- | core/mac/src/include/sir_params.h | 2 | ||||
| -rw-r--r-- | core/sme/inc/sme_api.h | 9 | ||||
| -rw-r--r-- | core/sme/src/common/sme_api.c | 45 | ||||
| -rw-r--r-- | core/wma/inc/wma_internal.h | 28 | ||||
| -rw-r--r-- | core/wma/inc/wma_types.h | 1 | ||||
| -rw-r--r-- | core/wma/src/wma_features.c | 41 | ||||
| -rw-r--r-- | core/wma/src/wma_main.c | 4 |
10 files changed, 129 insertions, 20 deletions
diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 98c9f9a35855..e29aadf527dc 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -2911,6 +2911,11 @@ enum dot11p_mode { #define CFG_INFORM_BSS_RSSI_RAW_MAX (1) #define CFG_INFORM_BSS_RSSI_RAW_DEFAULT (1) +/* GPIO pin to toggle when capture tsf */ +#define CFG_SET_TSF_GPIO_PIN_NAME "gtsf_gpio_pin" +#define CFG_SET_TSF_GPIO_PIN_MIN (0) +#define CFG_SET_TSF_GPIO_PIN_MAX (255) +#define CFG_SET_TSF_GPIO_PIN_DEFAULT (34) /* * OBSS scan parameters @@ -3579,6 +3584,7 @@ struct hdd_config { uint16_t obss_passive_dwelltime; uint16_t obss_width_trigger_interval; uint8_t inform_bss_rssi_raw; + uint32_t tsf_gpio_pin; #ifdef QCA_WIFI_3_0_EMU bool enable_m2m_limitation; #endif diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index eba3d85c8a67..5bbae4c696c1 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -3725,6 +3725,15 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_INFORM_BSS_RSSI_RAW_MIN, CFG_INFORM_BSS_RSSI_RAW_MAX), +#ifdef WLAN_FEATURE_TSF + REG_VARIABLE(CFG_SET_TSF_GPIO_PIN_NAME, WLAN_PARAM_Integer, + struct hdd_config, tsf_gpio_pin, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_SET_TSF_GPIO_PIN_DEFAULT, + CFG_SET_TSF_GPIO_PIN_MIN, + CFG_SET_TSF_GPIO_PIN_MAX), +#endif + #ifdef QCA_WIFI_3_0_EMU REG_VARIABLE(CFG_ENABLE_M2M_LIMITATION, WLAN_PARAM_Integer, struct hdd_config, enable_m2m_limitation, diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 730ee4e82a6b..9c04a870ce60 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -5943,6 +5943,10 @@ 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); + 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"); + #ifdef MSM_PLATFORM spin_lock_init(&hdd_ctx->bus_bw_lock); qdf_mc_timer_init(&hdd_ctx->bus_bw_timer, diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h index 6287638b2b8f..75dc58bc40a0 100644 --- a/core/mac/src/include/sir_params.h +++ b/core/mac/src/include/sir_params.h @@ -599,6 +599,8 @@ typedef struct sSirMbMsgP2p { #define SIR_HAL_SET_EGAP_CONF_PARAMS (SIR_HAL_ITC_MSG_TYPES_BEGIN + 336) #define SIR_HAL_HT40_OBSS_SCAN_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 337) +#define SIR_HAL_TSF_GPIO_PIN_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 338) + #define SIR_HAL_ADD_BCN_FILTER_CMDID (SIR_HAL_ITC_MSG_TYPES_BEGIN + 339) #define SIR_HAL_REMOVE_BCN_FILTER_CMDID (SIR_HAL_ITC_MSG_TYPES_BEGIN + 340) diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 73ce120093e4..0cc23cd26ffe 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1099,6 +1099,15 @@ QDF_STATUS sme_ht40_stop_obss_scan(tHalHandle hHal, uint32_t vdev_id); QDF_STATUS sme_set_tsfcb(tHalHandle hHal, int (*cb_fn)(void *cb_ctx, struct stsf *ptsf), void *cb_ctx); +#ifdef WLAN_FEATURE_TSF +QDF_STATUS sme_set_tsf_gpio(tHalHandle h_hal, uint32_t pinvalue); +#else +static inline QDF_STATUS sme_set_tsf_gpio(tHalHandle h_hal, uint32_t pinvalue) +{ + return QDF_STATUS_E_FAILURE; +} +#endif + QDF_STATUS sme_update_mimo_power_save(tHalHandle hHal, uint8_t is_ht_smps_enabled, uint8_t ht_smps_mode, diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 8785b0b017b6..a4d636f55c7d 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -7310,26 +7310,57 @@ QDF_STATUS sme_preferred_network_found_ind(tHalHandle hHal, void *pMsg) /* * sme_set_tsfcb() - Set callback for TSF capture - * @hHal: Handler return by macOpen + * @h_hal: Handler return by mac_open * @cb_fn: Callback function pointer * @db_ctx: Callback data * * Return: QDF_STATUS */ -QDF_STATUS sme_set_tsfcb(tHalHandle hHal, +QDF_STATUS sme_set_tsfcb(tHalHandle h_hal, int (*cb_fn)(void *cb_ctx, struct stsf *ptsf), void *cb_ctx) { - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); + tpAniSirGlobal mac = PMAC_STRUCT(h_hal); QDF_STATUS status; - status = sme_acquire_global_lock(&pMac->sme); + status = sme_acquire_global_lock(&mac->sme); if (QDF_IS_STATUS_SUCCESS(status)) { - pMac->sme.get_tsf_cb = cb_fn; - pMac->sme.get_tsf_cxt = cb_ctx; - sme_release_global_lock(&pMac->sme); + mac->sme.get_tsf_cb = cb_fn; + mac->sme.get_tsf_cxt = cb_ctx; + sme_release_global_lock(&mac->sme); + } + return status; +} + +#ifdef WLAN_FEATURE_TSF +/* + * sme_set_tsf_gpio() - set gpio pin that be toggled when capture tef + * @h_hal: Handler return by mac_open + * @pinvalue: gpio pin id + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_set_tsf_gpio(tHalHandle h_hal, uint32_t pinvalue) +{ + QDF_STATUS status; + cds_msg_t tsf_msg = {0}; + tpAniSirGlobal mac = PMAC_STRUCT(h_hal); + + status = sme_acquire_global_lock(&mac->sme); + if (QDF_IS_STATUS_SUCCESS(status)) { + tsf_msg.type = WMA_TSF_GPIO_PIN; + tsf_msg.reserved = 0; + tsf_msg.bodyval = pinvalue; + + status = cds_mq_post_message(CDS_MQ_ID_WMA, &tsf_msg); + if (!QDF_IS_STATUS_SUCCESS(status)) { + sms_log(mac, LOGE, "Unable to post WMA_TSF_GPIO_PIN"); + status = QDF_STATUS_E_FAILURE; + } + sme_release_global_lock(&mac->sme); } return status; } +#endif QDF_STATUS sme_get_cfg_valid_channels(tHalHandle hHal, uint8_t *aValidChannels, uint32_t *len) diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h index 4543eaac9113..2f47901d9143 100644 --- a/core/wma/inc/wma_internal.h +++ b/core/wma/inc/wma_internal.h @@ -1072,9 +1072,37 @@ QDF_STATUS wma_set_auto_shutdown_timer_req(tp_wma_handle wma_handle, auto_sh_cmd); #endif +#ifdef WLAN_FEATURE_TSF int wma_vdev_tsf_handler(void *handle, uint8_t *data, uint32_t data_len); QDF_STATUS wma_capture_tsf(tp_wma_handle wma_handle, uint32_t vdev_id); QDF_STATUS wma_reset_tsf_gpio(tp_wma_handle wma_handle, uint32_t vdev_id); +QDF_STATUS wma_set_tsf_gpio_pin(WMA_HANDLE handle, uint32_t pin); +#else +static inline QDF_STATUS wma_capture_tsf(tp_wma_handle wma_handle, + uint32_t vdev_id) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS wma_reset_tsf_gpio(tp_wma_handle wma_handle, + uint32_t vdev_id) +{ + return QDF_STATUS_SUCCESS; +} + +static inline int wma_vdev_tsf_handler(void *handle, uint8_t *data, + uint32_t data_len) +{ + return 0; +} + +static inline QDF_STATUS wma_set_tsf_gpio_pin(WMA_HANDLE handle, uint32_t pin) +{ + return QDF_STATUS_E_INVAL; +} +#endif + + #ifdef WLAN_FEATURE_NAN diff --git a/core/wma/inc/wma_types.h b/core/wma/inc/wma_types.h index c82cfa033a33..791f0f88910b 100644 --- a/core/wma/inc/wma_types.h +++ b/core/wma/inc/wma_types.h @@ -432,6 +432,7 @@ #endif #define WMA_SET_SCAN_MAC_OUI_REQ SIR_HAL_SET_SCAN_MAC_OUI_REQ +#define WMA_TSF_GPIO_PIN SIR_HAL_TSF_GPIO_PIN_REQ #ifdef DHCP_SERVER_OFFLOAD #define WMA_SET_DHCP_SERVER_OFFLOAD_CMD SIR_HAL_SET_DHCP_SERVER_OFFLOAD diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index 3e526e53b38b..d23e1cbd2192 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -419,24 +419,39 @@ error: wmi_buf_free(buf); return status; } -#else -QDF_STATUS wma_capture_tsf(tp_wma_handle wma_handle, uint32_t vdev_id) -{ - return QDF_STATUS_SUCCESS; -} -QDF_STATUS wma_reset_tsf_gpio(tp_wma_handle wma_handle, uint32_t vdev_id) +/** + * wma_set_tsf_gpio_pin() - send wmi cmd to configure gpio pin + * @handle: wma handler + * @pin: GPIO pin id + * + * Return: QDF_STATUS + */ +QDF_STATUS wma_set_tsf_gpio_pin(WMA_HANDLE handle, uint32_t pin) { - return QDF_STATUS_SUCCESS; -} + tp_wma_handle wma = (tp_wma_handle)handle; + struct pdev_params pdev_param = {0}; + int32_t ret; -int wma_vdev_tsf_handler(void *handle, uint8_t *data, uint32_t data_len) -{ - return 0; -} -#endif + if (!wma || !wma->wmi_handle) { + WMA_LOGE("%s: WMA is closed, can not set gpio", __func__); + return QDF_STATUS_E_INVAL; + } + WMA_LOGD("%s: set tsf gpio pin: %d", __func__, pin); + pdev_param.param_id = WMI_PDEV_PARAM_WNTS_CONFIG; + pdev_param.param_value = pin; + ret = wmi_unified_pdev_param_send(wma->wmi_handle, + &pdev_param, + WMA_WILDCARD_PDEV_ID); + if (ret) { + WMA_LOGE("%s: Failed to set tsf gpio pin (%d)", __func__, ret); + return QDF_STATUS_E_FAILURE; + } + return QDF_STATUS_SUCCESS; +} +#endif #ifdef FEATURE_WLAN_LPHB /** diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index b48424401c2a..f0720411203d 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -5123,6 +5123,10 @@ QDF_STATUS wma_mc_process_msg(void *cds_context, cds_msg_t *msg) wma_get_temperature(wma_handle); qdf_mem_free(msg->bodyptr); break; + case WMA_TSF_GPIO_PIN: + wma_set_tsf_gpio_pin(wma_handle, msg->bodyval); + break; + #ifdef DHCP_SERVER_OFFLOAD case WMA_SET_DHCP_SERVER_OFFLOAD_CMD: wma_process_dhcpserver_offload(wma_handle, |
