mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-26 06:33:19 -04:00
qcacld-3.0: Prevent Runtime PM when connection in progress
Add logic to prevent runtime pm when connect and DHCP in progress. CRs-Fixed: 1072520 Change-Id: I3f44bb32aabe2d119c4bf3888f49891b44fc2c7b
This commit is contained in:
parent
d18de2eb67
commit
a89be8d2b5
4 changed files with 87 additions and 15 deletions
|
|
@ -854,8 +854,17 @@ struct hdd_chan_change_params {
|
|||
struct ch_params_s chan_params;
|
||||
};
|
||||
|
||||
#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */
|
||||
/**
|
||||
* struct hdd_connect_pm_context - Runtime PM connect context per adapter
|
||||
* @connect: Runtime Connect Context
|
||||
*
|
||||
* Structure to hold runtime pm connect context for each adapter.
|
||||
*/
|
||||
struct hdd_connect_pm_context {
|
||||
qdf_runtime_lock_t connect;
|
||||
};
|
||||
|
||||
#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */
|
||||
|
||||
struct hdd_adapter_s {
|
||||
/* Magic cookie for adapter sanity verification. Note that this
|
||||
|
|
@ -1086,6 +1095,7 @@ struct hdd_adapter_s {
|
|||
* channel needs to be moved from the existing 2.4GHz channel.
|
||||
*/
|
||||
uint8_t pre_cac_chan;
|
||||
struct hdd_connect_pm_context connect_rpm_ctx;
|
||||
};
|
||||
|
||||
#define WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.station)
|
||||
|
|
|
|||
|
|
@ -11436,6 +11436,8 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter,
|
|||
hdd_conn_set_connection_state(pAdapter,
|
||||
eConnectionState_Connecting);
|
||||
|
||||
qdf_runtime_pm_prevent_suspend(pAdapter->connect_rpm_ctx.
|
||||
connect);
|
||||
status = sme_roam_connect(WLAN_HDD_GET_HAL_CTX(pAdapter),
|
||||
pAdapter->sessionId, pRoamProfile,
|
||||
&roamId);
|
||||
|
|
@ -11449,6 +11451,8 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter,
|
|||
/* change back to NotAssociated */
|
||||
hdd_conn_set_connection_state(pAdapter,
|
||||
eConnectionState_NotConnected);
|
||||
qdf_runtime_pm_allow_suspend(pAdapter->connect_rpm_ctx.
|
||||
connect);
|
||||
}
|
||||
|
||||
pRoamProfile->ChannelInfo.ChannelList = NULL;
|
||||
|
|
|
|||
|
|
@ -2451,6 +2451,25 @@ void hdd_set_station_ops(struct net_device *pWlanDev)
|
|||
pWlanDev->netdev_ops = &wlan_drv_ops;
|
||||
}
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
static void hdd_adapter_runtime_suspend_init(hdd_adapter_t *adapter)
|
||||
{
|
||||
struct hdd_connect_pm_context *ctx = &adapter->connect_rpm_ctx;
|
||||
|
||||
ctx->connect = qdf_runtime_lock_init("connect");
|
||||
}
|
||||
|
||||
static void hdd_adapter_runtime_suspend_denit(hdd_adapter_t *adapter)
|
||||
{
|
||||
struct hdd_connect_pm_context *ctx = &adapter->connect_rpm_ctx;
|
||||
|
||||
qdf_runtime_lock_deinit(ctx->connect);
|
||||
ctx->connect = NULL;
|
||||
}
|
||||
#else /* FEATURE_RUNTIME_PM */
|
||||
static inline void hdd_adapter_runtime_suspend_init(hdd_adapter_t *adapter) {}
|
||||
static inline void hdd_adapter_runtime_suspend_denit(hdd_adapter_t *adapter) {}
|
||||
#endif /* FEATURE_RUNTIME_PM */
|
||||
/**
|
||||
* hdd_alloc_station_adapter() - allocate the station hdd adapter
|
||||
* @hdd_ctx: global hdd context
|
||||
|
|
@ -2542,6 +2561,7 @@ static hdd_adapter_t *hdd_alloc_station_adapter(hdd_context_t *hdd_ctx,
|
|||
/* set pWlanDev's parent to underlying device */
|
||||
SET_NETDEV_DEV(pWlanDev, hdd_ctx->parent_dev);
|
||||
hdd_wmm_init(adapter);
|
||||
hdd_adapter_runtime_suspend_init(adapter);
|
||||
spin_lock_init(&adapter->pause_map_lock);
|
||||
adapter->start_time = adapter->last_time = qdf_system_ticks();
|
||||
}
|
||||
|
|
@ -2916,6 +2936,8 @@ static void hdd_cleanup_adapter(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
|
|||
adapter->scan_info.default_scan_ies = NULL;
|
||||
}
|
||||
|
||||
hdd_adapter_runtime_suspend_denit(adapter);
|
||||
|
||||
/*
|
||||
* The adapter is marked as closed. When hdd_wlan_exit() call returns,
|
||||
* the driver is almost closed and cannot handle either control
|
||||
|
|
@ -3943,9 +3965,12 @@ void hdd_connect_result(struct net_device *dev, const u8 *bssid,
|
|||
roam_info->u.pConnectedProfile->SSID.ssId,
|
||||
roam_info->u.pConnectedProfile->SSID.length);
|
||||
}
|
||||
|
||||
hdd_connect_bss(dev, bssid, bss, req_ie,
|
||||
req_ie_len, resp_ie, resp_ie_len,
|
||||
status, gfp, connect_timeout);
|
||||
|
||||
qdf_runtime_pm_allow_suspend(padapter->connect_rpm_ctx.connect);
|
||||
}
|
||||
#else
|
||||
void hdd_connect_result(struct net_device *dev, const u8 *bssid,
|
||||
|
|
@ -3954,8 +3979,11 @@ void hdd_connect_result(struct net_device *dev, const u8 *bssid,
|
|||
size_t resp_ie_len, u16 status, gfp_t gfp,
|
||||
bool connect_timeout)
|
||||
{
|
||||
hdd_adapter_t *padapter = (hdd_adapter_t *) netdev_priv(dev);
|
||||
|
||||
cfg80211_connect_result(dev, bssid, req_ie, req_ie_len,
|
||||
resp_ie, resp_ie_len, status, gfp);
|
||||
qdf_runtime_pm_allow_suspend(padapter->connect_rpm_ctx.connect);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -2051,6 +2051,48 @@ int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_stop_dhcp_ind() - API to stop DHCP sequence
|
||||
* @adapter: Adapter on which DHCP needs to be stopped
|
||||
*
|
||||
* Release the wakelock held for DHCP process and allow
|
||||
* the runtime pm to continue
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static void hdd_stop_dhcp_ind(hdd_adapter_t *adapter)
|
||||
{
|
||||
hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
|
||||
hdd_warn("DHCP stop indicated through power save");
|
||||
sme_dhcp_stop_ind(hdd_ctx->hHal, adapter->device_mode,
|
||||
adapter->macAddressCurrent.bytes,
|
||||
adapter->sessionId);
|
||||
hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DHCP);
|
||||
qdf_runtime_pm_allow_suspend(adapter->connect_rpm_ctx.connect);
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_start_dhcp_ind() - API to start DHCP sequence
|
||||
* @adapter: Adapter on which DHCP needs to be stopped
|
||||
*
|
||||
* Prevent APPS suspend and the runtime suspend during
|
||||
* DHCP sequence
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static void hdd_start_dhcp_ind(hdd_adapter_t *adapter)
|
||||
{
|
||||
hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
|
||||
hdd_err("DHCP start indicated through power save");
|
||||
qdf_runtime_pm_prevent_suspend(adapter->connect_rpm_ctx.connect);
|
||||
hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_DHCP);
|
||||
sme_dhcp_start_ind(hdd_ctx->hHal, adapter->device_mode,
|
||||
adapter->macAddressCurrent.bytes,
|
||||
adapter->sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* __wlan_hdd_cfg80211_set_power_mgmt() - set cfg80211 power management config
|
||||
* @wiphy: Pointer to wiphy
|
||||
|
|
@ -2117,20 +2159,8 @@ static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy,
|
|||
|
||||
status = wlan_hdd_set_powersave(pAdapter, allow_power_save, timeout);
|
||||
|
||||
if (allow_power_save) {
|
||||
hdd_warn("DHCP stop indicated through power save");
|
||||
sme_dhcp_stop_ind(pHddCtx->hHal, pAdapter->device_mode,
|
||||
pAdapter->macAddressCurrent.bytes,
|
||||
pAdapter->sessionId);
|
||||
hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DHCP);
|
||||
} else {
|
||||
hdd_err("DHCP start indicated through power save");
|
||||
hdd_prevent_suspend_timeout(1000,
|
||||
WIFI_POWER_EVENT_WAKELOCK_DHCP);
|
||||
sme_dhcp_start_ind(pHddCtx->hHal, pAdapter->device_mode,
|
||||
pAdapter->macAddressCurrent.bytes,
|
||||
pAdapter->sessionId);
|
||||
}
|
||||
allow_power_save ? hdd_stop_dhcp_ind(pAdapter) :
|
||||
hdd_start_dhcp_ind(pAdapter);
|
||||
|
||||
EXIT();
|
||||
return status;
|
||||
|
|
|
|||
Loading…
Reference in a new issue