Commit 52d81a68 authored by Kalle Valo's avatar Kalle Valo

ath6kl: implement ath6kl_cfg80211_suspend()

This is in preparation for cutpower suspend feature. HIF layer makes
the decision based on information provided by cfg80211 and what hardware
actually supports. Then it calls ath6kl_cfg80211_suspend() to enable
the chosen mode.

Functionality should be the same, this is just preparation for
more suspend modes (cutpower and wow).
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 1f405255
...@@ -1653,8 +1653,46 @@ static int ath6kl_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) ...@@ -1653,8 +1653,46 @@ static int ath6kl_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
return 0; return 0;
} }
int ath6kl_cfg80211_suspend(struct ath6kl *ar,
enum ath6kl_cfg_suspend_mode mode)
{
int ret;
ath6kl_cfg80211_stop(ar);
switch (mode) {
case ATH6KL_CFG_SUSPEND_DEEPSLEEP:
/* save the current power mode before enabling power save */
ar->wmi->saved_pwr_mode = ar->wmi->pwr_mode;
ret = ath6kl_wmi_powermode_cmd(ar->wmi, 0, REC_POWER);
if (ret) {
ath6kl_warn("wmi powermode command failed during suspend: %d\n",
ret);
}
break;
}
return 0;
}
int ath6kl_cfg80211_resume(struct ath6kl *ar)
{
if (ar->wmi->pwr_mode != ar->wmi->saved_pwr_mode) {
if (ath6kl_wmi_powermode_cmd(ar->wmi, 0,
ar->wmi->saved_pwr_mode) != 0)
ath6kl_warn("ath6kl_sdio_resume: "
"wmi_powermode_cmd failed\n");
}
return 0;
}
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int ar6k_cfg80211_suspend(struct wiphy *wiphy,
/* hif layer decides what suspend mode to use */
static int __ath6kl_cfg80211_suspend(struct wiphy *wiphy,
struct cfg80211_wowlan *wow) struct cfg80211_wowlan *wow)
{ {
struct ath6kl *ar = wiphy_priv(wiphy); struct ath6kl *ar = wiphy_priv(wiphy);
...@@ -1662,7 +1700,7 @@ static int ar6k_cfg80211_suspend(struct wiphy *wiphy, ...@@ -1662,7 +1700,7 @@ static int ar6k_cfg80211_suspend(struct wiphy *wiphy,
return ath6kl_hif_suspend(ar); return ath6kl_hif_suspend(ar);
} }
static int ar6k_cfg80211_resume(struct wiphy *wiphy) static int __ath6kl_cfg80211_resume(struct wiphy *wiphy)
{ {
struct ath6kl *ar = wiphy_priv(wiphy); struct ath6kl *ar = wiphy_priv(wiphy);
...@@ -2099,8 +2137,8 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = { ...@@ -2099,8 +2137,8 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = {
.flush_pmksa = ath6kl_flush_pmksa, .flush_pmksa = ath6kl_flush_pmksa,
CFG80211_TESTMODE_CMD(ath6kl_tm_cmd) CFG80211_TESTMODE_CMD(ath6kl_tm_cmd)
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = ar6k_cfg80211_suspend, .suspend = __ath6kl_cfg80211_suspend,
.resume = ar6k_cfg80211_resume, .resume = __ath6kl_cfg80211_resume,
#endif #endif
.set_channel = ath6kl_set_channel, .set_channel = ath6kl_set_channel,
.add_beacon = ath6kl_add_beacon, .add_beacon = ath6kl_add_beacon,
......
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
#ifndef ATH6KL_CFG80211_H #ifndef ATH6KL_CFG80211_H
#define ATH6KL_CFG80211_H #define ATH6KL_CFG80211_H
enum ath6kl_cfg_suspend_mode {
ATH6KL_CFG_SUSPEND_DEEPSLEEP,
};
struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
enum nl80211_iftype type, enum nl80211_iftype type,
u8 fw_vif_idx, u8 nw_type); u8 fw_vif_idx, u8 nw_type);
...@@ -40,6 +44,10 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason, ...@@ -40,6 +44,10 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason,
void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid, void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid,
bool ismcast); bool ismcast);
int ath6kl_cfg80211_suspend(struct ath6kl *ar,
enum ath6kl_cfg_suspend_mode mode);
int ath6kl_cfg80211_resume(struct ath6kl *ar);
void ath6kl_cfg80211_stop(struct ath6kl *ar); void ath6kl_cfg80211_stop(struct ath6kl *ar);
#endif /* ATH6KL_CFG80211_H */ #endif /* ATH6KL_CFG80211_H */
...@@ -649,7 +649,6 @@ void ath6kl_pspoll_event(struct ath6kl_vif *vif, u8 aid); ...@@ -649,7 +649,6 @@ void ath6kl_pspoll_event(struct ath6kl_vif *vif, u8 aid);
void ath6kl_dtimexpiry_event(struct ath6kl_vif *vif); void ath6kl_dtimexpiry_event(struct ath6kl_vif *vif);
void ath6kl_disconnect(struct ath6kl_vif *vif); void ath6kl_disconnect(struct ath6kl_vif *vif);
void ath6kl_deep_sleep_enable(struct ath6kl *ar);
void aggr_recv_delba_req_evt(struct ath6kl_vif *vif, u8 tid); void aggr_recv_delba_req_evt(struct ath6kl_vif *vif, u8 tid);
void aggr_recv_addba_req_evt(struct ath6kl_vif *vif, u8 tid, u16 seq_no, void aggr_recv_addba_req_evt(struct ath6kl_vif *vif, u8 tid, u16 seq_no,
u8 win_sz); u8 win_sz);
......
...@@ -578,18 +578,6 @@ void ath6kl_disconnect(struct ath6kl_vif *vif) ...@@ -578,18 +578,6 @@ void ath6kl_disconnect(struct ath6kl_vif *vif)
} }
} }
void ath6kl_deep_sleep_enable(struct ath6kl *ar)
{
ath6kl_cfg80211_stop(ar);
/* save the current power mode before enabling power save */
ar->wmi->saved_pwr_mode = ar->wmi->pwr_mode;
if (ath6kl_wmi_powermode_cmd(ar->wmi, 0, REC_POWER) != 0)
ath6kl_warn("ath6kl_deep_sleep_enable: "
"wmi_powermode_cmd failed\n");
}
/* WMI Event handlers */ /* WMI Event handlers */
static const char *get_hw_id_string(u32 id) static const char *get_hw_id_string(u32 id)
......
...@@ -757,19 +757,14 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar) ...@@ -757,19 +757,14 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar)
return ret; return ret;
} }
ath6kl_deep_sleep_enable(ar); ath6kl_cfg80211_suspend(ar, ATH6KL_CFG_SUSPEND_DEEPSLEEP);
return 0; return 0;
} }
static int ath6kl_sdio_resume(struct ath6kl *ar) static int ath6kl_sdio_resume(struct ath6kl *ar)
{ {
if (ar->wmi->pwr_mode != ar->wmi->saved_pwr_mode) { ath6kl_cfg80211_resume(ar);
if (ath6kl_wmi_powermode_cmd(ar->wmi, 0,
ar->wmi->saved_pwr_mode) != 0)
ath6kl_warn("ath6kl_sdio_resume: "
"wmi_powermode_cmd failed\n");
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment