qcacmn: Populate spectral capability and send via cfg80211

Populate Spectral capability structure with scaling parameters
from extended service ready event parameters. Send the spectral caps
via cf80211 interface.

CRs-Fixed: 2379652
Change-Id: Id0372bdd40843c2101df32d2e71920027a24909f
This commit is contained in:
Edayilliam Jayadev
2018-08-09 13:50:18 +05:30
committed by nshrivas
parent ac0ddecb36
commit d4b7e3b572
7 changed files with 133 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -550,7 +550,7 @@ int wlan_cfg80211_spectral_scan_get_cap(struct wiphy *wiphy,
wlan_spectral_get_cap(pdev, &spectral_cap);
skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 5 * sizeof(u32) +
skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 10 * sizeof(u32) +
NLA_HDRLEN + NLMSG_HDRLEN);
if (!skb) {
qdf_print(" reply skb alloc failed");
@@ -585,6 +585,38 @@ int wlan_cfg80211_spectral_scan_get_cap(struct wiphy *wiphy,
spectral_cap.hw_gen))
goto fail;
if (spectral_cap.is_scaling_params_populated) {
if (nla_put_u16(
skb,
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_FORMULA_ID,
spectral_cap.formula_id))
goto fail;
if (nla_put_u16(
skb,
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_LOW_LEVEL_OFFSET,
spectral_cap.low_level_offset))
goto fail;
if (nla_put_u16(
skb,
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_HIGH_LEVEL_OFFSET,
spectral_cap.high_level_offset))
goto fail;
if (nla_put_u16(
skb,
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_RSSI_THR,
spectral_cap.rssi_thr))
goto fail;
if (nla_put_u8(
skb,
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_DEFAULT_AGC_MAX_GAIN,
spectral_cap.default_agc_max_gain))
goto fail;
}
qal_devcfg_send_response((qdf_nbuf_t)skb);
return 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2017-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2011, 2017-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -105,6 +105,12 @@ enum spectral_cap_hw_gen {
* @spectral_cap: Spectral capability
* @advncd_spectral_cap: Advanced spectral capability
* @hw_gen: Spectral hw generation as defined in spectral_cap_hw_gen
* @is_scaling_params_populated: indicates whether scaling params is populated
* @formula_id: formula_id
* @low_level_offset: low_level_offset
* @high_level_offset: high_level_offset
* @rssi_thr: rssi_thr
* @default_agc_max_gain: default_agc_max_gain
*/
struct spectral_caps {
uint8_t phydiag_cap;
@@ -112,6 +118,12 @@ struct spectral_caps {
uint8_t spectral_cap;
uint8_t advncd_spectral_cap;
uint32_t hw_gen;
bool is_scaling_params_populated;
uint16_t formula_id;
int16_t low_level_offset;
int16_t high_level_offset;
int16_t rssi_thr;
uint8_t default_agc_max_gain;
};
#define SPECTRAL_IOCTL_PARAM_NOVAL (65535)

View File

@@ -1286,6 +1286,25 @@ static inline struct wlan_psoc_host_dbr_ring_caps
return psoc_info->info.dbr_ring_cap;
}
/**
* target_psoc_get_spectral_scaling_params() - get Spectral scaling params
* @psoc_info: pointer to structure target_psoc_info
*
* API to get Spectral scaling params
*
* Return: structure pointer to wlan_psoc_host_spectral_scaling_params
*/
static inline struct wlan_psoc_host_spectral_scaling_params
*target_psoc_get_spectral_scaling_params(
struct target_psoc_info *psoc_info)
{
if (!psoc_info)
return NULL;
return psoc_info->info.scaling_params;
}
/**
* target_psoc_get_mem_chunks() - get mem_chunks
* @psoc_info: pointer to structure target_psoc_info

View File

@@ -1267,13 +1267,37 @@ target_if_spectral_get_macaddr(void *arg, char *addr)
*
* This is a workaround.
*
* Return: None
* Return: QDF_STATUS
*/
void
QDF_STATUS
target_if_init_spectral_capability(struct target_if_spectral *spectral)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_objmgr_pdev *pdev;
struct wlan_psoc_host_spectral_scaling_params *scaling_params;
uint8_t num_bin_scaling_params, param_idx, pdev_id;
struct target_psoc_info *tgt_psoc_info;
struct wlan_psoc_host_service_ext_param *ext_svc_param;
struct spectral_caps *pcap = &spectral->capability;
pdev = spectral->pdev_obj;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc) {
spectral_err("psoc is null");
return QDF_STATUS_E_FAILURE;
}
tgt_psoc_info = wlan_psoc_get_tgt_if_handle(psoc);
if (!tgt_psoc_info) {
spectral_err("target_psoc_info is null");
return QDF_STATUS_E_FAILURE;
}
ext_svc_param = target_psoc_get_service_ext_param(tgt_psoc_info);
num_bin_scaling_params = ext_svc_param->num_bin_scaling_params;
scaling_params = target_psoc_get_spectral_scaling_params(tgt_psoc_info);
pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
/* XXX : Workaround: Set Spectral capability */
pcap = &spectral->capability;
pcap->phydiag_cap = 1;
@@ -1281,6 +1305,23 @@ target_if_init_spectral_capability(struct target_if_spectral *spectral)
pcap->spectral_cap = 1;
pcap->advncd_spectral_cap = 1;
pcap->hw_gen = spectral->spectral_gen;
for (param_idx = 0; param_idx < num_bin_scaling_params; param_idx++) {
if (scaling_params[param_idx].pdev_id == pdev_id) {
pcap->is_scaling_params_populated = true;
pcap->formula_id = scaling_params[param_idx].formula_id;
pcap->low_level_offset =
scaling_params[param_idx].low_level_offset;
pcap->high_level_offset =
scaling_params[param_idx].high_level_offset;
pcap->rssi_thr = scaling_params[param_idx].rssi_thr;
pcap->default_agc_max_gain =
scaling_params[param_idx].default_agc_max_gain;
break;
}
}
return QDF_STATUS_SUCCESS;
}
#ifdef QCA_SUPPORT_SPECTRAL_SIMULATION
@@ -1925,7 +1966,11 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev)
spectral->params_valid = false;
/* Init spectral capability */
target_if_init_spectral_capability(spectral);
if (target_if_init_spectral_capability(spectral) !=
QDF_STATUS_SUCCESS) {
qdf_mem_free(spectral);
return NULL;
}
if (target_if_spectral_attach_simulation(spectral) < 0)
return NULL;

View File

@@ -1762,9 +1762,10 @@ uint32_t target_if_spectral_sops_get_params(
*
* This is a workaround.
*
* Return: None
* Return: QDF_STATUS
*/
void target_if_init_spectral_capability(struct target_if_spectral *spectral);
QDF_STATUS
target_if_init_spectral_capability(struct target_if_spectral *spectral);
/**
* target_if_start_spectral_scan() - Start spectral scan

View File

@@ -1303,6 +1303,22 @@ QDF_STATUS wmi_extract_dbr_ring_cap_service_ready_ext(
uint8_t *evt_buf, uint8_t idx,
struct wlan_psoc_host_dbr_ring_caps *param);
/**
* wmi_extract_spectral_scaling_params_service_ready_ext: Extract Spectral
* scaling params received through
* extended service ready event
* @wmi_hdl: WMI handle
* @evt_buf: Event buffer
* @idx: Index
* @param: Pointer to Spectral scaling params
*
* Return: QDF status of operation
*/
QDF_STATUS wmi_extract_spectral_scaling_params_service_ready_ext(
void *wmi_hdl,
uint8_t *evt_buf, uint8_t idx,
struct wlan_psoc_host_spectral_scaling_params *param);
QDF_STATUS wmi_extract_pdev_utf_event(void *wmi_hdl,
uint8_t *evt_buf,
struct wmi_host_pdev_utf_event *param);

View File

@@ -38,22 +38,6 @@ typedef struct wmi_unified *wmi_unified_t;
QDF_STATUS wmi_unified_dbr_ring_cfg(void *wmi_hdl,
struct direct_buf_rx_cfg_req *cfg);
/**
* wmi_extract_spectral_scaling_params_service_ready_ext: Extract Spectral
* scaling params received through
* extended service ready event
* @wmi_hdl: WMI handle
* @evt_buf: Event buffer
* @idx: Index
* @param: Pointer to Spectral scaling params
*
* Return: QDF status of operation
*/
QDF_STATUS wmi_extract_spectral_scaling_params_service_ready_ext(
void *wmi_hdl,
uint8_t *evt_buf, uint8_t idx,
struct wlan_psoc_host_spectral_scaling_params *param);
/**
* wmi_extract_dbr_buf_release_fixed : Extract direct buffer rx fixed param
* from buffer release event