提交 76a9fbe2 编写于 作者: K Kalle Valo

ath6kl: add state variable depicting hw/fw state

This way it's easier to track state changes and in the future add
more warnings about using hardware in wrong states. Currently there
are few random flags for trying to do the same, those will be cleaned
and removed in the future.
Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
上级 52d81a68
...@@ -1671,6 +1671,8 @@ int ath6kl_cfg80211_suspend(struct ath6kl *ar, ...@@ -1671,6 +1671,8 @@ int ath6kl_cfg80211_suspend(struct ath6kl *ar,
ret); ret);
} }
ar->state = ATH6KL_STATE_DEEPSLEEP;
break; break;
} }
...@@ -1679,11 +1681,25 @@ int ath6kl_cfg80211_suspend(struct ath6kl *ar, ...@@ -1679,11 +1681,25 @@ int ath6kl_cfg80211_suspend(struct ath6kl *ar,
int ath6kl_cfg80211_resume(struct ath6kl *ar) int ath6kl_cfg80211_resume(struct ath6kl *ar)
{ {
if (ar->wmi->pwr_mode != ar->wmi->saved_pwr_mode) { int ret;
if (ath6kl_wmi_powermode_cmd(ar->wmi, 0,
ar->wmi->saved_pwr_mode) != 0) switch (ar->state) {
ath6kl_warn("ath6kl_sdio_resume: " case ATH6KL_STATE_DEEPSLEEP:
"wmi_powermode_cmd failed\n"); if (ar->wmi->pwr_mode != ar->wmi->saved_pwr_mode) {
ret = ath6kl_wmi_powermode_cmd(ar->wmi, 0,
ar->wmi->saved_pwr_mode);
if (ret) {
ath6kl_warn("wmi powermode command failed during resume: %d\n",
ret);
}
}
ar->state = ATH6KL_STATE_ON;
break;
default:
break;
} }
return 0; return 0;
...@@ -2254,6 +2270,8 @@ struct ath6kl *ath6kl_core_alloc(struct device *dev) ...@@ -2254,6 +2270,8 @@ struct ath6kl *ath6kl_core_alloc(struct device *dev)
ar->sc_params.scan_ctrl_flags = DEFAULT_SCAN_CTRL_FLAGS; ar->sc_params.scan_ctrl_flags = DEFAULT_SCAN_CTRL_FLAGS;
ar->lrssi_roam_threshold = DEF_LRSSI_ROAM_THRESHOLD; ar->lrssi_roam_threshold = DEF_LRSSI_ROAM_THRESHOLD;
ar->state = ATH6KL_STATE_OFF;
memset((u8 *)ar->sta_list, 0, memset((u8 *)ar->sta_list, 0,
AP_MAX_NUM_STA * sizeof(struct ath6kl_sta)); AP_MAX_NUM_STA * sizeof(struct ath6kl_sta));
......
...@@ -450,9 +450,18 @@ enum ath6kl_dev_state { ...@@ -450,9 +450,18 @@ enum ath6kl_dev_state {
FIRST_BOOT, FIRST_BOOT,
}; };
enum ath6kl_state {
ATH6KL_STATE_OFF,
ATH6KL_STATE_ON,
ATH6KL_STATE_DEEPSLEEP,
};
struct ath6kl { struct ath6kl {
struct device *dev; struct device *dev;
struct wiphy *wiphy; struct wiphy *wiphy;
enum ath6kl_state state;
struct ath6kl_bmi bmi; struct ath6kl_bmi bmi;
const struct ath6kl_hif_ops *hif_ops; const struct ath6kl_hif_ops *hif_ops;
struct wmi *wmi; struct wmi *wmi;
......
...@@ -1452,6 +1452,8 @@ int ath6kl_init_hw_start(struct ath6kl *ar) ...@@ -1452,6 +1452,8 @@ int ath6kl_init_hw_start(struct ath6kl *ar)
goto err_htc_stop; goto err_htc_stop;
} }
ar->state = ATH6KL_STATE_ON;
return 0; return 0;
err_htc_stop: err_htc_stop:
...@@ -1480,6 +1482,8 @@ int ath6kl_init_hw_stop(struct ath6kl *ar) ...@@ -1480,6 +1482,8 @@ int ath6kl_init_hw_stop(struct ath6kl *ar)
if (ret) if (ret)
ath6kl_warn("failed to power off hif: %d\n", ret); ath6kl_warn("failed to power off hif: %d\n", ret);
ar->state = ATH6KL_STATE_OFF;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册