aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2011-11-01 02:44:21 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2011-11-11 05:59:00 -0500
commit52d81a6883fb36c4304fb5619bfa5f61eb7986ef (patch)
treef3a53b18f841bb10499965051f69791439cfc71e /drivers
parent1f40525512ba8c68902b3c2f5c09692364cc6b6a (diff)
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: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c46
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.h8
-rw-r--r--drivers/net/wireless/ath/ath6kl/core.h1
-rw-r--r--drivers/net/wireless/ath/ath6kl/main.c12
-rw-r--r--drivers/net/wireless/ath/ath6kl/sdio.c9
5 files changed, 52 insertions, 24 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 96b5e9a6850d..c62ebf1c2b66 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -1653,8 +1653,46 @@ static int ath6kl_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
1653 return 0; 1653 return 0;
1654} 1654}
1655 1655
1656int ath6kl_cfg80211_suspend(struct ath6kl *ar,
1657 enum ath6kl_cfg_suspend_mode mode)
1658{
1659 int ret;
1660
1661 ath6kl_cfg80211_stop(ar);
1662
1663 switch (mode) {
1664 case ATH6KL_CFG_SUSPEND_DEEPSLEEP:
1665 /* save the current power mode before enabling power save */
1666 ar->wmi->saved_pwr_mode = ar->wmi->pwr_mode;
1667
1668 ret = ath6kl_wmi_powermode_cmd(ar->wmi, 0, REC_POWER);
1669 if (ret) {
1670 ath6kl_warn("wmi powermode command failed during suspend: %d\n",
1671 ret);
1672 }
1673
1674 break;
1675 }
1676
1677 return 0;
1678}
1679
1680int ath6kl_cfg80211_resume(struct ath6kl *ar)
1681{
1682 if (ar->wmi->pwr_mode != ar->wmi->saved_pwr_mode) {
1683 if (ath6kl_wmi_powermode_cmd(ar->wmi, 0,
1684 ar->wmi->saved_pwr_mode) != 0)
1685 ath6kl_warn("ath6kl_sdio_resume: "
1686 "wmi_powermode_cmd failed\n");
1687 }
1688
1689 return 0;
1690}
1691
1656#ifdef CONFIG_PM 1692#ifdef CONFIG_PM
1657static int ar6k_cfg80211_suspend(struct wiphy *wiphy, 1693
1694/* hif layer decides what suspend mode to use */
1695static int __ath6kl_cfg80211_suspend(struct wiphy *wiphy,
1658 struct cfg80211_wowlan *wow) 1696 struct cfg80211_wowlan *wow)
1659{ 1697{
1660 struct ath6kl *ar = wiphy_priv(wiphy); 1698 struct ath6kl *ar = wiphy_priv(wiphy);
@@ -1662,7 +1700,7 @@ static int ar6k_cfg80211_suspend(struct wiphy *wiphy,
1662 return ath6kl_hif_suspend(ar); 1700 return ath6kl_hif_suspend(ar);
1663} 1701}
1664 1702
1665static int ar6k_cfg80211_resume(struct wiphy *wiphy) 1703static int __ath6kl_cfg80211_resume(struct wiphy *wiphy)
1666{ 1704{
1667 struct ath6kl *ar = wiphy_priv(wiphy); 1705 struct ath6kl *ar = wiphy_priv(wiphy);
1668 1706
@@ -2099,8 +2137,8 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = {
2099 .flush_pmksa = ath6kl_flush_pmksa, 2137 .flush_pmksa = ath6kl_flush_pmksa,
2100 CFG80211_TESTMODE_CMD(ath6kl_tm_cmd) 2138 CFG80211_TESTMODE_CMD(ath6kl_tm_cmd)
2101#ifdef CONFIG_PM 2139#ifdef CONFIG_PM
2102 .suspend = ar6k_cfg80211_suspend, 2140 .suspend = __ath6kl_cfg80211_suspend,
2103 .resume = ar6k_cfg80211_resume, 2141 .resume = __ath6kl_cfg80211_resume,
2104#endif 2142#endif
2105 .set_channel = ath6kl_set_channel, 2143 .set_channel = ath6kl_set_channel,
2106 .add_beacon = ath6kl_add_beacon, 2144 .add_beacon = ath6kl_add_beacon,
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.h b/drivers/net/wireless/ath/ath6kl/cfg80211.h
index bb0ac22dfa5b..3630c5e62b5f 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.h
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.h
@@ -17,6 +17,10 @@
17#ifndef ATH6KL_CFG80211_H 17#ifndef ATH6KL_CFG80211_H
18#define ATH6KL_CFG80211_H 18#define ATH6KL_CFG80211_H
19 19
20enum ath6kl_cfg_suspend_mode {
21 ATH6KL_CFG_SUSPEND_DEEPSLEEP,
22};
23
20struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, 24struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
21 enum nl80211_iftype type, 25 enum nl80211_iftype type,
22 u8 fw_vif_idx, u8 nw_type); 26 u8 fw_vif_idx, u8 nw_type);
@@ -40,6 +44,10 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason,
40void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid, 44void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid,
41 bool ismcast); 45 bool ismcast);
42 46
47int ath6kl_cfg80211_suspend(struct ath6kl *ar,
48 enum ath6kl_cfg_suspend_mode mode);
49int ath6kl_cfg80211_resume(struct ath6kl *ar);
50
43void ath6kl_cfg80211_stop(struct ath6kl *ar); 51void ath6kl_cfg80211_stop(struct ath6kl *ar);
44 52
45#endif /* ATH6KL_CFG80211_H */ 53#endif /* ATH6KL_CFG80211_H */
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index 95aed7d0fab5..00cc1db7cbc1 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -649,7 +649,6 @@ void ath6kl_pspoll_event(struct ath6kl_vif *vif, u8 aid);
649 649
650void ath6kl_dtimexpiry_event(struct ath6kl_vif *vif); 650void ath6kl_dtimexpiry_event(struct ath6kl_vif *vif);
651void ath6kl_disconnect(struct ath6kl_vif *vif); 651void ath6kl_disconnect(struct ath6kl_vif *vif);
652void ath6kl_deep_sleep_enable(struct ath6kl *ar);
653void aggr_recv_delba_req_evt(struct ath6kl_vif *vif, u8 tid); 652void aggr_recv_delba_req_evt(struct ath6kl_vif *vif, u8 tid);
654void aggr_recv_addba_req_evt(struct ath6kl_vif *vif, u8 tid, u16 seq_no, 653void aggr_recv_addba_req_evt(struct ath6kl_vif *vif, u8 tid, u16 seq_no,
655 u8 win_sz); 654 u8 win_sz);
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c
index 378dc8d0277d..23da82e148ea 100644
--- a/drivers/net/wireless/ath/ath6kl/main.c
+++ b/drivers/net/wireless/ath/ath6kl/main.c
@@ -578,18 +578,6 @@ void ath6kl_disconnect(struct ath6kl_vif *vif)
578 } 578 }
579} 579}
580 580
581void ath6kl_deep_sleep_enable(struct ath6kl *ar)
582{
583 ath6kl_cfg80211_stop(ar);
584
585 /* save the current power mode before enabling power save */
586 ar->wmi->saved_pwr_mode = ar->wmi->pwr_mode;
587
588 if (ath6kl_wmi_powermode_cmd(ar->wmi, 0, REC_POWER) != 0)
589 ath6kl_warn("ath6kl_deep_sleep_enable: "
590 "wmi_powermode_cmd failed\n");
591}
592
593/* WMI Event handlers */ 581/* WMI Event handlers */
594 582
595static const char *get_hw_id_string(u32 id) 583static const char *get_hw_id_string(u32 id)
diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index 2d155570bb5c..75b1eaa65e15 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -757,19 +757,14 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar)
757 return ret; 757 return ret;
758 } 758 }
759 759
760 ath6kl_deep_sleep_enable(ar); 760 ath6kl_cfg80211_suspend(ar, ATH6KL_CFG_SUSPEND_DEEPSLEEP);
761 761
762 return 0; 762 return 0;
763} 763}
764 764
765static int ath6kl_sdio_resume(struct ath6kl *ar) 765static int ath6kl_sdio_resume(struct ath6kl *ar)
766{ 766{
767 if (ar->wmi->pwr_mode != ar->wmi->saved_pwr_mode) { 767 ath6kl_cfg80211_resume(ar);
768 if (ath6kl_wmi_powermode_cmd(ar->wmi, 0,
769 ar->wmi->saved_pwr_mode) != 0)
770 ath6kl_warn("ath6kl_sdio_resume: "
771 "wmi_powermode_cmd failed\n");
772 }
773 768
774 return 0; 769 return 0;
775} 770}