mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 16:46:15 -04:00
qcacld-3.0: Export antenna info to the userspace
qcacld-2.0 to qcacld-3.0 propagation Discard the original wmi interface: WMI_PEER_ANTDIV_INFO_REQ_CMDID/PEER_ANTDIV_INFO_EVENTID, replace with the new one: WMI_PDEV_DIV_GET_RSSI_ANTID_CMDID/WMI_PDEV_DIV_RSSI_ANTID_EVENTID to support chain value along with corresponding antenna info. Change-Id: Ie9ea9d160e1ac1e2e65de422c85989159fb5a556 CRs-Fixed: 2005820
This commit is contained in:
parent
fbaa02c909
commit
fe6c3e2283
5 changed files with 59 additions and 49 deletions
|
|
@ -13584,22 +13584,31 @@ static int hdd_post_get_chain_rssi_rsp(struct hdd_context *hdd_ctx,
|
|||
struct chain_rssi_result *result)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
int data_len = sizeof(result->chain_rssi);
|
||||
|
||||
skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
|
||||
data_len + NLA_HDRLEN + NLMSG_HDRLEN);
|
||||
(sizeof(result->chain_rssi) + NLA_HDRLEN) +
|
||||
(sizeof(result->ant_id) + NLA_HDRLEN) +
|
||||
NLMSG_HDRLEN);
|
||||
|
||||
if (!skb) {
|
||||
hdd_err("cfg80211_vendor_event_alloc failed");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_CHAIN_RSSI, data_len,
|
||||
if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_CHAIN_RSSI,
|
||||
sizeof(result->chain_rssi),
|
||||
result->chain_rssi)) {
|
||||
hdd_err("put fail");
|
||||
goto nla_put_failure;
|
||||
}
|
||||
|
||||
if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_ANTENNA_INFO,
|
||||
sizeof(result->ant_id),
|
||||
result->ant_id)) {
|
||||
hdd_err("put fail");
|
||||
goto nla_put_failure;
|
||||
}
|
||||
|
||||
cfg80211_vendor_cmd_reply(skb);
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -7476,11 +7476,15 @@ struct sir_rssi_disallow_lst {
|
|||
|
||||
/**
|
||||
* struct chain_rssi_result - chain rssi result
|
||||
* num_chains_valid: vaild chain num
|
||||
* @chain_rssi: chain rssi result as dBm unit
|
||||
* @ant_id: antenna id
|
||||
*/
|
||||
#define CHAIN_RSSI_NUM 8
|
||||
#define CHAIN_MAX_NUM 8
|
||||
struct chain_rssi_result {
|
||||
int32_t chain_rssi[CHAIN_RSSI_NUM];
|
||||
uint32_t num_chains_valid;
|
||||
uint32_t chain_rssi[CHAIN_MAX_NUM];
|
||||
uint32_t ant_id[CHAIN_MAX_NUM];
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1279,9 +1279,9 @@ int wma_wlan_bt_activity_evt_handler(void *handle, uint8_t *event,
|
|||
uint32_t len);
|
||||
|
||||
/**
|
||||
* wma_peer_ant_info_evt_handler - event handler to handle antenna info
|
||||
* wma_pdev_div_info_evt_handler - event handler to handle antenna info
|
||||
* @handle: the wma handle
|
||||
* @event: buffer with event
|
||||
* @event_buf: buffer with event
|
||||
* @len: buffer length
|
||||
*
|
||||
* This function receives antenna info from firmware and passes the event
|
||||
|
|
@ -1289,7 +1289,7 @@ int wma_wlan_bt_activity_evt_handler(void *handle, uint8_t *event,
|
|||
*
|
||||
* Return: 0 on success
|
||||
*/
|
||||
int wma_peer_ant_info_evt_handler(void *handle, u_int8_t *event,
|
||||
int wma_pdev_div_info_evt_handler(void *handle, u_int8_t *event_buf,
|
||||
u_int32_t len);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5283,57 +5283,54 @@ int wma_wlan_bt_activity_evt_handler(void *handle, uint8_t *event, uint32_t len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int wma_peer_ant_info_evt_handler(void *handle, u_int8_t *event,
|
||||
int wma_pdev_div_info_evt_handler(void *handle, u_int8_t *event_buf,
|
||||
u_int32_t len)
|
||||
{
|
||||
wmi_peer_antdiv_info *peer_ant_info;
|
||||
WMI_PEER_ANTDIV_INFO_EVENTID_param_tlvs *param_buf;
|
||||
wmi_peer_antdiv_info_event_fixed_param *fix_param;
|
||||
struct chain_rssi_result *chain_rssi_result;
|
||||
u_int32_t chain_index;
|
||||
WMI_PDEV_DIV_RSSI_ANTID_EVENTID_param_tlvs *param_buf;
|
||||
wmi_pdev_div_rssi_antid_event_fixed_param *event;
|
||||
struct chain_rssi_result chain_rssi_result;
|
||||
u_int32_t i;
|
||||
u_int8_t macaddr[IEEE80211_ADDR_LEN];
|
||||
|
||||
tpAniSirGlobal pmac = (tpAniSirGlobal)cds_get_context(
|
||||
QDF_MODULE_ID_PE);
|
||||
if (!pmac) {
|
||||
WMA_LOGE("%s: Invalid pmac", __func__);
|
||||
WMA_LOGE(FL("Invalid pmac"));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
param_buf = (WMI_PEER_ANTDIV_INFO_EVENTID_param_tlvs *) event;
|
||||
param_buf = (WMI_PDEV_DIV_RSSI_ANTID_EVENTID_param_tlvs *) event_buf;
|
||||
if (!param_buf) {
|
||||
WMA_LOGE("Invalid peer_ant_info event buffer");
|
||||
return -EINVAL;
|
||||
}
|
||||
fix_param = param_buf->fixed_param;
|
||||
peer_ant_info = param_buf->peer_info;
|
||||
|
||||
WMA_LOGD("num_peers=%d\tvdev_id=%d",
|
||||
fix_param->num_peers, fix_param->vdev_id);
|
||||
WMA_LOGD("peer_ant_info: %pK", peer_ant_info);
|
||||
|
||||
if (!peer_ant_info) {
|
||||
WMA_LOGE("Invalid peer_ant_info ptr");
|
||||
WMA_LOGE(FL("Invalid rssi antid event buffer"));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
chain_rssi_result = qdf_mem_malloc(sizeof(*chain_rssi_result));
|
||||
if (!chain_rssi_result) {
|
||||
WMA_LOGE("%s: Failed to malloc", __func__);
|
||||
return -ENOMEM;
|
||||
event = param_buf->fixed_param;
|
||||
if (!event) {
|
||||
WMA_LOGE(FL("Invalid fixed param"));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (chain_index = 0; chain_index < CHAIN_RSSI_NUM; chain_index++)
|
||||
WMA_LOGD("chain%d rssi: %x", chain_index,
|
||||
peer_ant_info->chain_rssi[chain_index]);
|
||||
WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->macaddr, macaddr);
|
||||
WMA_LOGD(FL("macaddr: " MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macaddr));
|
||||
|
||||
qdf_mem_copy(chain_rssi_result->chain_rssi,
|
||||
peer_ant_info->chain_rssi,
|
||||
sizeof(peer_ant_info->chain_rssi));
|
||||
WMA_LOGD(FL("num_chains_valid: %d"), event->num_chains_valid);
|
||||
chain_rssi_result.num_chains_valid = event->num_chains_valid;
|
||||
|
||||
for (i = 0; i < CHAIN_MAX_NUM; i++)
|
||||
WMA_LOGD(FL("chain_rssi: %d, ant_id: %d"),
|
||||
event->chain_rssi[i], event->ant_id[i]);
|
||||
|
||||
qdf_mem_copy(chain_rssi_result.chain_rssi, event->chain_rssi,
|
||||
sizeof(event->chain_rssi));
|
||||
for (i = 0; i < event->num_chains_valid; i++)
|
||||
chain_rssi_result.chain_rssi[i] += WMA_TGT_NOISE_FLOOR_DBM;
|
||||
|
||||
qdf_mem_copy(chain_rssi_result.ant_id, event->ant_id,
|
||||
sizeof(event->ant_id));
|
||||
|
||||
pmac->sme.get_chain_rssi_cb(pmac->sme.get_chain_rssi_context,
|
||||
chain_rssi_result);
|
||||
|
||||
qdf_mem_free(chain_rssi_result);
|
||||
&chain_rssi_result);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3383,8 +3383,8 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
|
|||
}
|
||||
|
||||
wmi_unified_register_event_handler(wma_handle->wmi_handle,
|
||||
wmi_peer_antdiv_info_event_id,
|
||||
wma_peer_ant_info_evt_handler,
|
||||
wmi_pdev_div_rssi_antid_event_id,
|
||||
wma_pdev_div_info_evt_handler,
|
||||
WMA_RX_WORK_CTX);
|
||||
|
||||
|
||||
|
|
@ -7355,9 +7355,9 @@ QDF_STATUS wma_set_rx_blocksize(tp_wma_handle wma_handle,
|
|||
QDF_STATUS wma_get_chain_rssi(tp_wma_handle wma_handle,
|
||||
struct get_chain_rssi_req_params *req_params)
|
||||
{
|
||||
wmi_peer_antdiv_info_req_cmd_fixed_param *cmd;
|
||||
wmi_pdev_div_get_rssi_antid_fixed_param *cmd;
|
||||
wmi_buf_t wmi_buf;
|
||||
uint32_t len = sizeof(wmi_peer_antdiv_info_req_cmd_fixed_param);
|
||||
uint32_t len = sizeof(wmi_pdev_div_get_rssi_antid_fixed_param);
|
||||
u_int8_t *buf_ptr;
|
||||
|
||||
if (!wma_handle) {
|
||||
|
|
@ -7373,17 +7373,17 @@ QDF_STATUS wma_get_chain_rssi(tp_wma_handle wma_handle,
|
|||
|
||||
buf_ptr = (u_int8_t *)wmi_buf_data(wmi_buf);
|
||||
|
||||
cmd = (wmi_peer_antdiv_info_req_cmd_fixed_param *)buf_ptr;
|
||||
cmd = (wmi_pdev_div_get_rssi_antid_fixed_param *)buf_ptr;
|
||||
WMITLV_SET_HDR(&cmd->tlv_header,
|
||||
WMITLV_TAG_STRUC_wmi_peer_antdiv_info_req_cmd_fixed_param,
|
||||
WMITLV_TAG_STRUC_wmi_pdev_div_get_rssi_antid_fixed_param,
|
||||
WMITLV_GET_STRUCT_TLVLEN(
|
||||
wmi_peer_antdiv_info_req_cmd_fixed_param));
|
||||
cmd->vdev_id = req_params->session_id;
|
||||
wmi_pdev_div_get_rssi_antid_fixed_param));
|
||||
cmd->pdev_id = 0;
|
||||
WMI_CHAR_ARRAY_TO_MAC_ADDR(req_params->peer_macaddr.bytes,
|
||||
&cmd->peer_mac_address);
|
||||
&cmd->macaddr);
|
||||
|
||||
if (wmi_unified_cmd_send(wma_handle->wmi_handle, wmi_buf, len,
|
||||
WMI_PEER_ANTDIV_INFO_REQ_CMDID)) {
|
||||
WMI_PDEV_DIV_GET_RSSI_ANTID_CMDID)) {
|
||||
WMA_LOGE(FL("failed to send get chain rssi command"));
|
||||
wmi_buf_free(wmi_buf);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
|
|
|
|||
Loading…
Reference in a new issue