cnss2: Use unified API to get RDDM and recovery timeouts

Get RDDM and recovery timeouts from unified cnss_get_timeout() API
for better readability.

Change-Id: I3e869aa46fb5d36335ce7fe215e5483a56093880
Signed-off-by: Yue Ma <yuem@codeaurora.org>
This commit is contained in:
Yue Ma 2021-02-15 10:58:52 -08:00 • committed by Gerrit - the friendly Code Review server
commit 87bf73007e
3 changed files with 22 additions and 11 deletions

View file

@ -739,6 +739,10 @@ unsigned int cnss_get_timeout(struct cnss_plat_data *plat_priv,
return (qmi_timeout + WLAN_COLD_BOOT_CAL_TIMEOUT);
case CNSS_TIMEOUT_WLAN_WATCHDOG:
return ((qmi_timeout << 1) + WLAN_WD_TIMEOUT_MS);
case CNSS_TIMEOUT_RDDM:
return CNSS_RDDM_TIMEOUT_MS;
case CNSS_TIMEOUT_RECOVERY:
return RECOVERY_TIMEOUT;
default:
return qmi_timeout;
}
@ -894,6 +898,7 @@ EXPORT_SYMBOL(cnss_idle_restart);
int cnss_idle_shutdown(struct device *dev)
{
struct cnss_plat_data *plat_priv = cnss_bus_dev_to_plat_priv(dev);
unsigned int timeout;
int ret;
if (!plat_priv) {
@ -913,11 +918,12 @@ int cnss_idle_shutdown(struct device *dev)
goto skip_wait;
reinit_completion(&plat_priv->recovery_complete);
timeout = cnss_get_timeout(plat_priv, CNSS_TIMEOUT_RECOVERY);
ret = wait_for_completion_timeout(&plat_priv->recovery_complete,
msecs_to_jiffies(RECOVERY_TIMEOUT));
msecs_to_jiffies(timeout));
if (!ret) {
cnss_pr_err("Timeout (%ums) waiting for recovery to complete\n",
RECOVERY_TIMEOUT);
timeout);
CNSS_ASSERT(0);
}
@ -1255,10 +1261,11 @@ static int cnss_do_recovery(struct cnss_plat_data *plat_priv,
/* FW recovery sequence has multiple steps and firmware load requires
* linux PM in awake state. Thus hold the cnss wake source until
* WLAN MISSION enabled.
* WLAN MISSION enabled. CNSS_TIMEOUT_RECOVERY option should cover all
* time taken in this process.
*/
pm_wakeup_ws_event(plat_priv->recovery_ws, RECOVERY_TIMEOUT +
cnss_get_boot_timeout(NULL),
pm_wakeup_ws_event(plat_priv->recovery_ws,
cnss_get_timeout(plat_priv, CNSS_TIMEOUT_RECOVERY),
true);
switch (reason) {
@ -1445,6 +1452,7 @@ EXPORT_SYMBOL(cnss_force_fw_assert);
int cnss_force_collect_rddm(struct device *dev)
{
struct cnss_plat_data *plat_priv = cnss_bus_dev_to_plat_priv(dev);
unsigned int timeout;
int ret = 0;
if (!plat_priv) {
@ -1481,12 +1489,12 @@ int cnss_force_collect_rddm(struct device *dev)
wait_rddm:
reinit_completion(&plat_priv->rddm_complete);
ret = wait_for_completion_timeout
(&plat_priv->rddm_complete,
msecs_to_jiffies(CNSS_RDDM_TIMEOUT_MS));
timeout = cnss_get_timeout(plat_priv, CNSS_TIMEOUT_RDDM);
ret = wait_for_completion_timeout(&plat_priv->rddm_complete,
msecs_to_jiffies(timeout));
if (!ret) {
cnss_pr_err("Timeout (%ums) waiting for RDDM to complete\n",
CNSS_RDDM_TIMEOUT_MS);
timeout);
ret = -ETIMEDOUT;
} else if (ret > 0) {
ret = 0;

View file

@ -403,6 +403,8 @@ enum cnss_timeout_type {
CNSS_TIMEOUT_IDLE_RESTART,
CNSS_TIMEOUT_CALIBRATION,
CNSS_TIMEOUT_WLAN_WATCHDOG,
CNSS_TIMEOUT_RDDM,
CNSS_TIMEOUT_RECOVERY,
};
struct cnss_plat_data {

View file

@ -2822,11 +2822,12 @@ skip_wait_power_up:
goto skip_wait_recovery;
reinit_completion(&plat_priv->recovery_complete);
timeout = cnss_get_timeout(plat_priv, CNSS_TIMEOUT_RECOVERY);
ret = wait_for_completion_timeout(&plat_priv->recovery_complete,
msecs_to_jiffies(RECOVERY_TIMEOUT));
msecs_to_jiffies(timeout));
if (!ret) {
cnss_pr_err("Timeout (%ums) waiting for recovery to complete\n",
RECOVERY_TIMEOUT);
timeout);
CNSS_ASSERT(0);
}