mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 14:19:09 -04:00
qcacmn: Modify H/w DBS cap check and fetch NSS
Modify API policy_mgr_is_hw_dbs_2x2_capable() to check H/w DBS capability and check if downgrading needed while entering DBS. Define a new API policy_mgr_get_hw_dbs_nss() to get NSS information of both MAC0 and MAC1. Change-Id: If24817017f675e45197d060cd75317aa381256de CRs-Fixed: 2037487
This commit is contained in:
parent
b4ebf34ea2
commit
ceae5caddb
4 changed files with 92 additions and 53 deletions
|
|
@ -1485,7 +1485,7 @@ bool policy_mgr_is_current_hwmode_dbs(struct wlan_objmgr_psoc *psoc);
|
|||
* policy_mgr_is_hw_dbs_2x2_capable() - if hardware is capable of dbs 2x2
|
||||
* @psoc: PSOC object information
|
||||
* This function checks if hw_modes supported are always capable of
|
||||
* DBS 2x2.
|
||||
* DBS and there is no need for downgrading while entering DBS.
|
||||
* true: DBS 2x2 can always be supported
|
||||
* false: hw_modes support DBS 1x1 as well
|
||||
*
|
||||
|
|
@ -1859,4 +1859,16 @@ void policy_mgr_update_new_hw_mode_index(struct wlan_objmgr_psoc *psoc,
|
|||
QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t channel, bool *ok);
|
||||
|
||||
/**
|
||||
* policy_mgr_get_hw_dbs_nss() - Computes DBS NSS
|
||||
* @psoc: PSOC object information
|
||||
* @nss_dbs: NSS info of both MAC0 and MAC1
|
||||
* This function computes NSS info of both MAC0 and MAC1
|
||||
* True: DBS capable
|
||||
* False: not DBS capable
|
||||
*
|
||||
* Return: True or False
|
||||
*/
|
||||
bool policy_mgr_get_hw_dbs_nss(struct wlan_objmgr_psoc *psoc,
|
||||
struct dbs_nss *nss_dbs);
|
||||
#endif /* __WLAN_POLICY_MGR_API_H */
|
||||
|
|
|
|||
|
|
@ -992,4 +992,14 @@ struct policy_mgr_user_cfg {
|
|||
uint32_t mcc_to_scc_switch_mode;
|
||||
bool sub_20_mhz_enabled;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dbs_nss - Number of spatial streams in DBS mode
|
||||
* @mac0_ss: Number of spatial streams on MAC0
|
||||
* @mac1_ss: Number of spatial streams on MAC1
|
||||
*/
|
||||
struct dbs_nss {
|
||||
enum hw_mode_ss_config mac0_ss;
|
||||
enum hw_mode_ss_config mac1_ss;
|
||||
};
|
||||
#endif /* __WLAN_POLICY_MGR_PUBLIC_STRUCT_H */
|
||||
|
|
|
|||
|
|
@ -422,6 +422,7 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc,
|
|||
{
|
||||
QDF_STATUS status = QDF_STATUS_E_FAILURE;
|
||||
struct policy_mgr_hw_mode_params hw_mode;
|
||||
struct dbs_nss nss_dbs;
|
||||
|
||||
if (policy_mgr_is_hw_dbs_capable(psoc) == false) {
|
||||
policy_mgr_err("driver isn't dbs capable, no further action needed");
|
||||
|
|
@ -469,24 +470,17 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc,
|
|||
PM_DBS, reason, session_id);
|
||||
break;
|
||||
case PM_DBS:
|
||||
if (policy_mgr_is_hw_dbs_2x2_capable(psoc))
|
||||
status = policy_mgr_pdev_set_hw_mode(psoc, session_id,
|
||||
HW_MODE_SS_2x2,
|
||||
HW_MODE_80_MHZ,
|
||||
HW_MODE_SS_2x2, HW_MODE_40_MHZ,
|
||||
HW_MODE_DBS,
|
||||
HW_MODE_AGILE_DFS_NONE,
|
||||
HW_MODE_SBS_NONE,
|
||||
reason);
|
||||
else
|
||||
status = policy_mgr_pdev_set_hw_mode(psoc, session_id,
|
||||
HW_MODE_SS_1x1,
|
||||
HW_MODE_80_MHZ,
|
||||
HW_MODE_SS_1x1, HW_MODE_40_MHZ,
|
||||
HW_MODE_DBS,
|
||||
HW_MODE_AGILE_DFS_NONE,
|
||||
HW_MODE_SBS_NONE,
|
||||
reason);
|
||||
(void)policy_mgr_get_hw_dbs_nss(psoc, &nss_dbs);
|
||||
|
||||
status = policy_mgr_pdev_set_hw_mode(psoc, session_id,
|
||||
nss_dbs.mac0_ss,
|
||||
HW_MODE_80_MHZ,
|
||||
nss_dbs.mac1_ss,
|
||||
HW_MODE_40_MHZ,
|
||||
HW_MODE_DBS,
|
||||
HW_MODE_AGILE_DFS_NONE,
|
||||
HW_MODE_SBS_NONE,
|
||||
reason);
|
||||
break;
|
||||
case PM_SINGLE_MAC_UPGRADE:
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -752,43 +752,18 @@ bool policy_mgr_is_dbs_enable(struct wlan_objmgr_psoc *psoc)
|
|||
|
||||
bool policy_mgr_is_hw_dbs_2x2_capable(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
int i, param;
|
||||
uint32_t dbs, tx_chain0, rx_chain0, tx_chain1, rx_chain1;
|
||||
uint32_t final_min_rf_chains = 2;
|
||||
uint32_t min_rf_chains, min_mac0_rf_chains, min_mac1_rf_chains;
|
||||
bool is_dbs_found = false;
|
||||
struct policy_mgr_psoc_priv_obj *pm_ctx;
|
||||
uint32_t max_rf_chains, final_min_rf_chains = HW_MODE_SS_2x2;
|
||||
struct dbs_nss nss_dbs;
|
||||
|
||||
pm_ctx = policy_mgr_get_context(psoc);
|
||||
if (!pm_ctx) {
|
||||
policy_mgr_err("Invalid Context");
|
||||
return false;
|
||||
if (policy_mgr_get_hw_dbs_nss(psoc, &nss_dbs)) {
|
||||
max_rf_chains = QDF_MAX(nss_dbs.mac0_ss, nss_dbs.mac1_ss);
|
||||
final_min_rf_chains
|
||||
= QDF_MIN(final_min_rf_chains, max_rf_chains);
|
||||
} else {
|
||||
final_min_rf_chains = HW_MODE_SS_0x0;
|
||||
}
|
||||
|
||||
for (i = 0; i < pm_ctx->num_dbs_hw_modes; i++) {
|
||||
param = pm_ctx->hw_mode.hw_mode_list[i];
|
||||
tx_chain0 = POLICY_MGR_HW_MODE_MAC0_TX_STREAMS_GET(param);
|
||||
rx_chain0 = POLICY_MGR_HW_MODE_MAC0_RX_STREAMS_GET(param);
|
||||
dbs = POLICY_MGR_HW_MODE_DBS_MODE_GET(param);
|
||||
tx_chain1 = POLICY_MGR_HW_MODE_MAC1_TX_STREAMS_GET(param);
|
||||
rx_chain1 = POLICY_MGR_HW_MODE_MAC1_RX_STREAMS_GET(param);
|
||||
|
||||
if (dbs) {
|
||||
min_mac0_rf_chains = QDF_MIN(tx_chain0, rx_chain0);
|
||||
min_mac1_rf_chains = QDF_MIN(tx_chain1, rx_chain1);
|
||||
min_rf_chains = QDF_MIN(min_mac0_rf_chains,
|
||||
min_mac1_rf_chains);
|
||||
is_dbs_found = true;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
final_min_rf_chains = QDF_MIN(final_min_rf_chains,
|
||||
min_rf_chains);
|
||||
}
|
||||
if (false == is_dbs_found)
|
||||
final_min_rf_chains = 0;
|
||||
|
||||
return (final_min_rf_chains == 2) ? true : false;
|
||||
return (final_min_rf_chains == HW_MODE_SS_2x2) ? true : false;
|
||||
}
|
||||
|
||||
uint32_t policy_mgr_get_connection_count(struct wlan_objmgr_psoc *psoc)
|
||||
|
|
@ -2435,3 +2410,51 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc,
|
|||
wlan_objmgr_vdev_release_ref(vdev, WLAN_POLICY_MGR_ID);
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
bool policy_mgr_get_hw_dbs_nss(struct wlan_objmgr_psoc *psoc,
|
||||
struct dbs_nss *nss_dbs)
|
||||
{
|
||||
int i, param;
|
||||
uint32_t dbs, tx_chain0, rx_chain0, tx_chain1, rx_chain1;
|
||||
uint32_t min_mac0_rf_chains, min_mac1_rf_chains;
|
||||
bool is_dbs_found = false;
|
||||
struct policy_mgr_psoc_priv_obj *pm_ctx;
|
||||
|
||||
pm_ctx = policy_mgr_get_context(psoc);
|
||||
if (!pm_ctx)
|
||||
policy_mgr_err("Invalid Context");
|
||||
|
||||
for (i = 0; i < pm_ctx->num_dbs_hw_modes; i++) {
|
||||
param = pm_ctx->hw_mode.hw_mode_list[i];
|
||||
dbs = POLICY_MGR_HW_MODE_DBS_MODE_GET(param);
|
||||
|
||||
if (dbs) {
|
||||
tx_chain0
|
||||
= POLICY_MGR_HW_MODE_MAC0_TX_STREAMS_GET(param);
|
||||
rx_chain0
|
||||
= POLICY_MGR_HW_MODE_MAC0_RX_STREAMS_GET(param);
|
||||
|
||||
tx_chain1
|
||||
= POLICY_MGR_HW_MODE_MAC1_TX_STREAMS_GET(param);
|
||||
rx_chain1
|
||||
= POLICY_MGR_HW_MODE_MAC1_RX_STREAMS_GET(param);
|
||||
|
||||
min_mac0_rf_chains = QDF_MIN(tx_chain0, rx_chain0);
|
||||
min_mac1_rf_chains = QDF_MIN(tx_chain1, rx_chain1);
|
||||
|
||||
nss_dbs->mac0_ss
|
||||
= (min_mac0_rf_chains == 2)
|
||||
? HW_MODE_SS_2x2 : HW_MODE_SS_1x1;
|
||||
|
||||
nss_dbs->mac1_ss
|
||||
= (min_mac1_rf_chains == 2)
|
||||
? HW_MODE_SS_2x2 : HW_MODE_SS_1x1;
|
||||
|
||||
is_dbs_found = true;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return is_dbs_found;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue