qcacld-3.0: Remove bus bw vote when bus bw timer is stopped

Currently the driver votes for IDLE case when no
interface is associated. If the bus bandwidth timer
is stopped when there is no interface, we are not reducing
our votes, thereby causing higher power usage.

Remove our voting for bus bandwidth when the bus
bandwidth timer is stopped.
Also in the wlan resume case, vote for MEDIUM bus
bandwidth only if any interface is associated, else
vote for NONE.

Change-Id: I6cbe7f32036219b3b8914fb096562f44559931ce
CRs-Fixed: 2688853
This commit is contained in:
Rakesh Pillai 2020-05-18 13:53:35 +05:30 committed by nshrivas
parent 17b2fc57d7
commit 523a702050
3 changed files with 33 additions and 6 deletions

View File

@ -2522,6 +2522,15 @@ bool wlan_hdd_validate_modules_state(struct hdd_context *hdd_ctx);
QDF_STATUS __wlan_hdd_validate_mac_address(struct qdf_mac_addr *mac_addr,
const char *func);
/**
* hdd_is_any_adapter_connected() - Check if any adapter is in connected state
* @hdd_ctx: the global hdd context
*
* Returns: true, if any of the adapters is in connected state,
* false, if none of the adapters is in connected state.
*/
bool hdd_is_any_adapter_connected(struct hdd_context *hdd_ctx);
#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
/**
* hdd_bus_bw_compute_prev_txrx_stats() - get tx and rx stats

View File

@ -1228,7 +1228,13 @@ int wlan_hdd_bus_resume(void)
* Add bus votes at the beginning, before making sure there are any
* bus transactions from WLAN SOC for TX/RX.
*/
pld_request_bus_bandwidth(hdd_ctx->parent_dev, PLD_BUS_WIDTH_MEDIUM);
if (hdd_is_any_adapter_connected(hdd_ctx)) {
pld_request_bus_bandwidth(hdd_ctx->parent_dev,
PLD_BUS_WIDTH_MEDIUM);
} else {
pld_request_bus_bandwidth(hdd_ctx->parent_dev,
PLD_BUS_WIDTH_NONE);
}
status = hif_bus_resume(hif_ctx);
if (status) {

View File

@ -14154,7 +14154,6 @@ hdd_get_con_sap_adapter(struct hdd_adapter *this_sap_adapter,
return con_sap_adapter;
}
#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
static inline bool hdd_adapter_is_sta(struct hdd_adapter *adapter)
{
return adapter->device_mode == QDF_STA_MODE ||
@ -14167,7 +14166,7 @@ static inline bool hdd_adapter_is_ap(struct hdd_adapter *adapter)
adapter->device_mode == QDF_P2P_GO_MODE;
}
static bool hdd_any_adapter_is_assoc(struct hdd_context *hdd_ctx)
bool hdd_is_any_adapter_connected(struct hdd_context *hdd_ctx)
{
struct hdd_adapter *adapter;
@ -14192,6 +14191,7 @@ static bool hdd_any_adapter_is_assoc(struct hdd_context *hdd_ctx)
return false;
}
#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
static void __hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx)
{
qdf_periodic_work_start(&hdd_ctx->bus_bw_work,
@ -14211,7 +14211,7 @@ void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx)
{
hdd_enter();
if (hdd_any_adapter_is_assoc(hdd_ctx))
if (hdd_is_any_adapter_connected(hdd_ctx))
__hdd_bus_bw_compute_timer_start(hdd_ctx);
hdd_exit();
@ -14220,7 +14220,7 @@ void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx)
static void __hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx)
{
if (!qdf_periodic_work_stop_sync(&hdd_ctx->bus_bw_work))
return;
goto exit;
ucfg_ipa_set_perf_level(hdd_ctx->pdev, 0, 0);
hdd_reset_tcp_delack(hdd_ctx);
@ -14228,6 +14228,18 @@ static void __hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx)
OL_TXRX_PDEV_ID);
cdp_pdev_reset_bundle_require_flag(cds_get_context(QDF_MODULE_ID_SOC),
OL_TXRX_PDEV_ID);
exit:
/**
* This check if for the case where the bus bw timer is forcibly
* stopped. We should remove the bus bw voting, if no adapter is
* connected
*/
if (!hdd_is_any_adapter_connected(hdd_ctx)) {
hdd_ctx->cur_vote_level = PLD_BUS_WIDTH_NONE;
pld_request_bus_bandwidth(hdd_ctx->parent_dev,
PLD_BUS_WIDTH_NONE);
}
}
void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx)
@ -14243,7 +14255,7 @@ void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx)
{
hdd_enter();
if (!hdd_any_adapter_is_assoc(hdd_ctx))
if (!hdd_is_any_adapter_connected(hdd_ctx))
__hdd_bus_bw_compute_timer_stop(hdd_ctx);
hdd_exit();