summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCNSS_WLAN Service <cnssbldsw@qualcomm.com>2019-06-28 01:55:43 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2019-06-28 01:55:43 -0700
commitf66a9554da973ef80498e3f0a6547fa31a7b9872 (patch)
tree77a6c457620904e7cbeb97a3cb8a9340546d4a36
parent33637ee1202e8e5f2ff55502d60863d801e2f554 (diff)
parent627784f616e01dd11b50fcb77b280d1b70b996db (diff)
Merge "qcacld-2.0: Add GPIO config and output setting" into wlan-cld2.driver.lnx.1.0
-rw-r--r--CORE/MAC/src/include/sirParams.h3
-rw-r--r--CORE/SERVICES/COMMON/wma_api.h2
-rw-r--r--CORE/SERVICES/WMA/wma.c104
-rw-r--r--CORE/SME/inc/sme_Api.h8
-rw-r--r--CORE/SME/src/sme_common/sme_Api.c99
-rw-r--r--CORE/WDA/inc/legacy/halMsgApi.h26
-rw-r--r--CORE/WDA/inc/wlan_qct_wda.h3
7 files changed, 244 insertions, 1 deletions
diff --git a/CORE/MAC/src/include/sirParams.h b/CORE/MAC/src/include/sirParams.h
index 6e9b5b30545c..7ac71e536731 100644
--- a/CORE/MAC/src/include/sirParams.h
+++ b/CORE/MAC/src/include/sirParams.h
@@ -826,6 +826,9 @@ struct sir_mgmt_msg {
#define SIR_HAL_SET_LL_STAT_PRIMARY_PEER (SIR_HAL_ITC_MSG_TYPES_BEGIN + 388)
#define SIR_HAL_SET_RX_SMART_ANTENNA (SIR_HAL_ITC_MSG_TYPES_BEGIN + 389)
+#define SIR_HAL_SET_GPIO_CFG (SIR_HAL_ITC_MSG_TYPES_BEGIN + 390)
+#define SIR_HAL_SET_GPIO_OUTPUT (SIR_HAL_ITC_MSG_TYPES_BEGIN + 391)
+
#define SIR_HAL_MSG_TYPES_END (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF)
// CFG message types
diff --git a/CORE/SERVICES/COMMON/wma_api.h b/CORE/SERVICES/COMMON/wma_api.h
index 0b8e197094b0..35094bbeb272 100644
--- a/CORE/SERVICES/COMMON/wma_api.h
+++ b/CORE/SERVICES/COMMON/wma_api.h
@@ -193,4 +193,6 @@ void wma_tx_failure_cb(void *ctx, uint32_t num_msdu,
VOS_STATUS wma_set_ac_txq_optimize(void *wda_handle, uint8_t value);
VOS_STATUS wma_set_rx_antanna(void *wma_handle, uint8_t pdev_id,
uint32_t matrix);
+VOS_STATUS wma_set_gpio_cfg(void *handle, struct hal_gpio_cfg *gpio_cfg);
+VOS_STATUS wma_set_gpio_output(void *handle, struct hal_gpio_output *output);
#endif
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c
index e5b3741d0f72..18a48f942f35 100644
--- a/CORE/SERVICES/WMA/wma.c
+++ b/CORE/SERVICES/WMA/wma.c
@@ -35839,6 +35839,16 @@ VOS_STATUS wma_mc_process_msg(v_VOID_t *vos_context, vos_msg_t *msg)
case WDA_SET_RX_ANTENNA:
wma_set_rx_antanna(wma_handle, 0, msg->bodyval);
break;
+ case WDA_SET_GPIO_CFG:
+ wma_set_gpio_cfg(wma_handle,
+ (struct hal_gpio_cfg *)msg->bodyptr);
+ vos_mem_free(msg->bodyptr);
+ break;
+ case WDA_SET_GPIO_OUTPUT:
+ wma_set_gpio_output(wma_handle,
+ (struct hal_gpio_output *)msg->bodyptr);
+ vos_mem_free(msg->bodyptr);
+ break;
default:
WMA_LOGD("unknow msg type %x", msg->type);
/* Do Nothing? MSG Body should be freed at here */
@@ -42405,3 +42415,97 @@ VOS_STATUS wma_set_rx_antanna(void *handle,
}
return VOS_STATUS_SUCCESS;
}
+
+/**
+ * wma_set_gpio_cfg() - Set GPIO config
+ * @handle: pointer to wma handle
+ * @gpio_cfg: parameters for GPIO config
+ *
+ * Return: VOS_STATUS_SUCCESS for success.
+ */
+VOS_STATUS wma_set_gpio_cfg(void *handle, struct hal_gpio_cfg *gpio_cfg)
+{
+ tp_wma_handle wma_handle;
+ wmi_buf_t buf;
+ int status;
+ uint32_t tag;
+ wmi_gpio_config_cmd_fixed_param *cmd;
+ int len = sizeof(*cmd);
+
+ if (!handle) {
+ WMA_LOGP(FL("Invalid handle."));
+ return VOS_STATUS_E_INVAL;
+ }
+
+ wma_handle = handle;
+ buf = wmi_buf_alloc(wma_handle->wmi_handle, len);
+ if (!buf) {
+ WMA_LOGP("%s: failed to allocate memory for WMI_GPIO_CONFIG_CMDID",
+ __func__);
+ return VOS_STATUS_E_NOMEM;
+ }
+
+ cmd = (wmi_gpio_config_cmd_fixed_param *)wmi_buf_data(buf);
+ tag = WMITLV_TAG_STRUC_wmi_gpio_config_cmd_fixed_param;
+ len = WMITLV_GET_STRUCT_TLVLEN(wmi_gpio_config_cmd_fixed_param);
+ WMITLV_SET_HDR(&cmd->tlv_header, tag, len);
+ cmd->gpio_num = gpio_cfg->gpio_num;
+ cmd->input = gpio_cfg->input;
+ cmd->intr_mode = gpio_cfg->intr_mode;
+ cmd->mux_config_val = gpio_cfg->mux_config_val;
+ status = wmi_unified_cmd_send(wma_handle->wmi_handle, buf,
+ sizeof(*cmd),
+ WMI_GPIO_CONFIG_CMDID);
+ if (status) {
+ WMA_LOGE("Failed to send WMI_GPIO_CONFIG_CMDID");
+ wmi_buf_free(buf);
+ return VOS_STATUS_E_FAILURE;
+ }
+ return VOS_STATUS_SUCCESS;
+}
+
+/**
+ * wma_set_gpio_cfg() - Set GPIO config
+ * @handle: pointer to wma handle
+ * @output: parameters for GPIO output
+ *
+ * Return: VOS_STATUS_SUCCESS for success.
+ */
+VOS_STATUS wma_set_gpio_output(void *handle, struct hal_gpio_output *output)
+{
+ tp_wma_handle wma_handle;
+ wmi_buf_t buf;
+ int status;
+ uint32_t tag;
+ wmi_gpio_output_cmd_fixed_param *cmd;
+ int len = sizeof(*cmd);
+
+ if (!handle) {
+ WMA_LOGP(FL("Invalid handle."));
+ return VOS_STATUS_E_INVAL;
+ }
+
+ wma_handle = handle;
+ buf = wmi_buf_alloc(wma_handle->wmi_handle, len);
+ if (!buf) {
+ WMA_LOGP("%s: failed to allocate memory for WMI_GPIO_OUTPUT_CMDID",
+ __func__);
+ return VOS_STATUS_E_NOMEM;
+ }
+
+ cmd = (wmi_gpio_output_cmd_fixed_param *)wmi_buf_data(buf);
+ tag = WMITLV_TAG_STRUC_wmi_gpio_output_cmd_fixed_param;
+ len = WMITLV_GET_STRUCT_TLVLEN(wmi_gpio_output_cmd_fixed_param);
+ WMITLV_SET_HDR(&cmd->tlv_header, tag, len);
+ cmd->gpio_num = output->gpio_num;
+ cmd->set = output->set;
+ status = wmi_unified_cmd_send(wma_handle->wmi_handle, buf,
+ sizeof(*cmd),
+ WMI_GPIO_OUTPUT_CMDID);
+ if (status) {
+ WMA_LOGE("Failed to send WMI_GPIO_OUTPUT_CMDID");
+ wmi_buf_free(buf);
+ return VOS_STATUS_E_FAILURE;
+ }
+ return VOS_STATUS_SUCCESS;
+}
diff --git a/CORE/SME/inc/sme_Api.h b/CORE/SME/inc/sme_Api.h
index b0d7801d23e6..4351669b4277 100644
--- a/CORE/SME/inc/sme_Api.h
+++ b/CORE/SME/inc/sme_Api.h
@@ -5047,4 +5047,12 @@ static inline eHalStatus sme_set_rx_antenna(tHalHandle hal,
}
#endif
+eHalStatus sme_set_gpio_cfg(tHalHandle hal, uint32_t gpio_num,
+ uint32_t input, uint32_t pull_type,
+ uint32_t intr_mode, uint32_t mux_config_val);
+
+
+eHalStatus sme_set_gpio_output(tHalHandle hal,
+ uint32_t gpio_num,
+ uint32_t set);
#endif //#if !defined( __SME_API_H )
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index 42d9d52c80fd..4b5d6aa17465 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -21287,3 +21287,102 @@ eHalStatus sme_set_rx_antenna(tHalHandle hal,
return hal_status;
}
#endif
+
+/**
+ * sme_set_gpio_cfg() - Set GPIO config
+ * @gpio_num: GPIO number to be setup
+ * @input: 0 - Output/ 1 - Input
+ * @pull_type: Pull type
+ * @intr_mode: Interrupt mode
+ * @mux_config_val: mux_config_val
+ *
+ * Return: HAL_STATUS
+ */
+eHalStatus sme_set_gpio_cfg(tHalHandle hal, uint32_t gpio_num,
+ uint32_t input, uint32_t pull_type,
+ uint32_t intr_mode, uint32_t mux_config_val)
+{
+ vos_msg_t vos_message;
+ tpAniSirGlobal mac = PMAC_STRUCT(hal);
+ eHalStatus hal_status = eHAL_STATUS_SUCCESS;
+ VOS_STATUS vos_status;
+ struct hal_gpio_cfg *gpio_cfg;
+
+ hal_status = sme_AcquireGlobalLock(&mac->sme);
+ if (HAL_STATUS_SUCCESS(hal_status)) {
+ gpio_cfg = vos_mem_malloc(sizeof(*gpio_cfg));
+ if (!gpio_cfg) {
+ hal_status = eHAL_STATUS_FAILED_ALLOC;
+ VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+ "SAE: memory allocation failed");
+ } else {
+ gpio_cfg->gpio_num = gpio_num;
+ gpio_cfg->input = input;
+ gpio_cfg->pull_type = pull_type;
+ gpio_cfg->intr_mode = intr_mode;
+ gpio_cfg->mux_config_val = mux_config_val;
+ vos_message.type = WDA_SET_GPIO_CFG;
+ vos_message.bodyptr = gpio_cfg;
+ VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
+ "Post GPIO config message. gpio_num=%d, input=%d, pull_type=%d, intr_mode=%d, mux_config_val=%d",
+ gpio_num, input, pull_type,
+ intr_mode, mux_config_val);
+
+ vos_status = vos_mq_post_message(VOS_MQ_ID_WDA,
+ &vos_message);
+ if (!VOS_IS_STATUS_SUCCESS(vos_status)) {
+ hal_status = eHAL_STATUS_FAILURE;
+ vos_mem_free(gpio_cfg);
+ }
+ }
+ sme_ReleaseGlobalLock(&mac->sme);
+ }
+
+ return hal_status;
+}
+
+/**
+ * sme_set_gpio_output() - Set GPIO ouput
+ * @gpio_num: GPIO number to be setup
+ * @set: Set the GPIO pin
+ *
+ * Return: HAL_STATUS
+ */
+eHalStatus sme_set_gpio_output(tHalHandle hal,
+ uint32_t gpio_num,
+ uint32_t set)
+{
+ vos_msg_t vos_message;
+ tpAniSirGlobal mac = PMAC_STRUCT(hal);
+ eHalStatus hal_status = eHAL_STATUS_SUCCESS;
+ VOS_STATUS vos_status;
+ struct hal_gpio_output *gpio_output;
+
+ hal_status = sme_AcquireGlobalLock(&mac->sme);
+ if (HAL_STATUS_SUCCESS(hal_status)) {
+ gpio_output = vos_mem_malloc(sizeof(*gpio_output));
+ if (!gpio_output) {
+ hal_status = eHAL_STATUS_FAILED_ALLOC;
+ VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
+ "SAE: memory allocation failed");
+ } else {
+ gpio_output->gpio_num = gpio_num;
+ gpio_output->set = set;
+ vos_message.type = WDA_SET_GPIO_OUTPUT;
+ vos_message.bodyptr = gpio_output;
+ VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
+ "Post GPIO output messagee. gpio_num=%d, set=%d",
+ gpio_num, set);
+
+ vos_status = vos_mq_post_message(VOS_MQ_ID_WDA,
+ &vos_message);
+ if (!VOS_IS_STATUS_SUCCESS(vos_status)) {
+ hal_status = eHAL_STATUS_FAILURE;
+ vos_mem_free(gpio_output);
+ }
+ }
+ sme_ReleaseGlobalLock(&mac->sme);
+ }
+
+ return hal_status;
+}
diff --git a/CORE/WDA/inc/legacy/halMsgApi.h b/CORE/WDA/inc/legacy/halMsgApi.h
index 823033fe7a61..605e63514b4a 100644
--- a/CORE/WDA/inc/legacy/halMsgApi.h
+++ b/CORE/WDA/inc/legacy/halMsgApi.h
@@ -1576,4 +1576,30 @@ struct hal_primary_params {
uint8_t session_id;
tSirMacAddr bssid;
};
+
+/**
+ * struct hal_gpio_cfg - GPIO config paramters
+ * @gpio_num: GPIO number to be setup
+ * @input: 0 - Output/ 1 - Input
+ * @pull_type: Pull type
+ * @intr_mode: Interrupt mode
+ * @mux_config_val: mux_config_val
+ */
+struct hal_gpio_cfg {
+ uint32_t gpio_num;
+ uint32_t input;
+ uint32_t pull_type;
+ uint32_t intr_mode;
+ uint32_t mux_config_val;
+};
+
+/**
+ * struct hal_gpio_output - GPIO output parameters
+ * @gpio_num: GPIO number to be setup
+ * @set: Set the GPIO pin
+ */
+struct hal_gpio_output {
+ uint32_t gpio_num;
+ uint32_t set;
+};
#endif /* _HALMSGAPI_H_ */
diff --git a/CORE/WDA/inc/wlan_qct_wda.h b/CORE/WDA/inc/wlan_qct_wda.h
index 98336cf75ee7..7706409821a3 100644
--- a/CORE/WDA/inc/wlan_qct_wda.h
+++ b/CORE/WDA/inc/wlan_qct_wda.h
@@ -1120,7 +1120,8 @@ tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
#define WDA_SET_HPCS_PULSE_PARAMS SIR_HAL_SET_HPCS_PULSE_PARMAS
#define WDA_SET_RX_ANTENNA SIR_HAL_SET_RX_SMART_ANTENNA
-
+#define WDA_SET_GPIO_CFG SIR_HAL_SET_GPIO_CFG
+#define WDA_SET_GPIO_OUTPUT SIR_HAL_SET_GPIO_OUTPUT
tSirRetStatus wdaPostCtrlMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg);
#define HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME 0x40 // Bit 6 will be used to control BD rate for Management frames