浏览代码

ath9k_htc: Add PS wrappers

The HW has to be awake when registers are accessed.
Ensure this is so by using the PS wrappers at
appropriate places.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Sujith 15 年之前
父节点
当前提交
cb551df202
共有 1 个文件被更改,包括 18 次插入5 次删除
  1. 18 5
      drivers/net/wireless/ath/ath9k/htc_drv_main.c

+ 18 - 5
drivers/net/wireless/ath/ath9k/htc_drv_main.c

@@ -1357,6 +1357,7 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw,
 out:
 out:
 	ath9k_htc_ps_restore(priv);
 	ath9k_htc_ps_restore(priv);
 	mutex_unlock(&priv->mutex);
 	mutex_unlock(&priv->mutex);
+
 	return ret;
 	return ret;
 }
 }
 
 
@@ -1373,6 +1374,7 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw,
 	ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n");
 	ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n");
 
 
 	mutex_lock(&priv->mutex);
 	mutex_lock(&priv->mutex);
+	ath9k_htc_ps_wakeup(priv);
 
 
 	memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
 	memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
 	memcpy(&hvif.myaddr, vif->addr, ETH_ALEN);
 	memcpy(&hvif.myaddr, vif->addr, ETH_ALEN);
@@ -1383,6 +1385,7 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw,
 	ath9k_htc_remove_station(priv, vif, NULL);
 	ath9k_htc_remove_station(priv, vif, NULL);
 	priv->vif = NULL;
 	priv->vif = NULL;
 
 
+	ath9k_htc_ps_restore(priv);
 	mutex_unlock(&priv->mutex);
 	mutex_unlock(&priv->mutex);
 }
 }
 
 
@@ -1479,8 +1482,8 @@ static void ath9k_htc_configure_filter(struct ieee80211_hw *hw,
 	u32 rfilt;
 	u32 rfilt;
 
 
 	mutex_lock(&priv->mutex);
 	mutex_lock(&priv->mutex);
-
 	ath9k_htc_ps_wakeup(priv);
 	ath9k_htc_ps_wakeup(priv);
+
 	changed_flags &= SUPPORTED_FILTERS;
 	changed_flags &= SUPPORTED_FILTERS;
 	*total_flags &= SUPPORTED_FILTERS;
 	*total_flags &= SUPPORTED_FILTERS;
 
 
@@ -1504,6 +1507,7 @@ static void ath9k_htc_sta_notify(struct ieee80211_hw *hw,
 	int ret;
 	int ret;
 
 
 	mutex_lock(&priv->mutex);
 	mutex_lock(&priv->mutex);
+	ath9k_htc_ps_wakeup(priv);
 
 
 	switch (cmd) {
 	switch (cmd) {
 	case STA_NOTIFY_ADD:
 	case STA_NOTIFY_ADD:
@@ -1518,6 +1522,7 @@ static void ath9k_htc_sta_notify(struct ieee80211_hw *hw,
 		break;
 		break;
 	}
 	}
 
 
+	ath9k_htc_ps_restore(priv);
 	mutex_unlock(&priv->mutex);
 	mutex_unlock(&priv->mutex);
 }
 }
 
 
@@ -1533,6 +1538,7 @@ static int ath9k_htc_conf_tx(struct ieee80211_hw *hw, u16 queue,
 		return 0;
 		return 0;
 
 
 	mutex_lock(&priv->mutex);
 	mutex_lock(&priv->mutex);
+	ath9k_htc_ps_wakeup(priv);
 
 
 	memset(&qi, 0, sizeof(struct ath9k_tx_queue_info));
 	memset(&qi, 0, sizeof(struct ath9k_tx_queue_info));
 
 
@@ -1553,6 +1559,7 @@ static int ath9k_htc_conf_tx(struct ieee80211_hw *hw, u16 queue,
 	if (ret)
 	if (ret)
 		ath_print(common, ATH_DBG_FATAL, "TXQ Update failed\n");
 		ath_print(common, ATH_DBG_FATAL, "TXQ Update failed\n");
 
 
+	ath9k_htc_ps_restore(priv);
 	mutex_unlock(&priv->mutex);
 	mutex_unlock(&priv->mutex);
 
 
 	return ret;
 	return ret;
@@ -1695,7 +1702,9 @@ static u64 ath9k_htc_get_tsf(struct ieee80211_hw *hw)
 	u64 tsf;
 	u64 tsf;
 
 
 	mutex_lock(&priv->mutex);
 	mutex_lock(&priv->mutex);
+	ath9k_htc_ps_wakeup(priv);
 	tsf = ath9k_hw_gettsf64(priv->ah);
 	tsf = ath9k_hw_gettsf64(priv->ah);
+	ath9k_htc_ps_restore(priv);
 	mutex_unlock(&priv->mutex);
 	mutex_unlock(&priv->mutex);
 
 
 	return tsf;
 	return tsf;
@@ -1706,7 +1715,9 @@ static void ath9k_htc_set_tsf(struct ieee80211_hw *hw, u64 tsf)
 	struct ath9k_htc_priv *priv = hw->priv;
 	struct ath9k_htc_priv *priv = hw->priv;
 
 
 	mutex_lock(&priv->mutex);
 	mutex_lock(&priv->mutex);
+	ath9k_htc_ps_wakeup(priv);
 	ath9k_hw_settsf64(priv->ah, tsf);
 	ath9k_hw_settsf64(priv->ah, tsf);
+	ath9k_htc_ps_restore(priv);
 	mutex_unlock(&priv->mutex);
 	mutex_unlock(&priv->mutex);
 }
 }
 
 
@@ -1714,11 +1725,11 @@ static void ath9k_htc_reset_tsf(struct ieee80211_hw *hw)
 {
 {
 	struct ath9k_htc_priv *priv = hw->priv;
 	struct ath9k_htc_priv *priv = hw->priv;
 
 
-	ath9k_htc_ps_wakeup(priv);
 	mutex_lock(&priv->mutex);
 	mutex_lock(&priv->mutex);
+	ath9k_htc_ps_wakeup(priv);
 	ath9k_hw_reset_tsf(priv->ah);
 	ath9k_hw_reset_tsf(priv->ah);
-	mutex_unlock(&priv->mutex);
 	ath9k_htc_ps_restore(priv);
 	ath9k_htc_ps_restore(priv);
+	mutex_unlock(&priv->mutex);
 }
 }
 
 
 static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw,
 static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw,
@@ -1776,8 +1787,8 @@ static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw)
 {
 {
 	struct ath9k_htc_priv *priv = hw->priv;
 	struct ath9k_htc_priv *priv = hw->priv;
 
 
-	ath9k_htc_ps_wakeup(priv);
 	mutex_lock(&priv->mutex);
 	mutex_lock(&priv->mutex);
+	ath9k_htc_ps_wakeup(priv);
 	spin_lock_bh(&priv->beacon_lock);
 	spin_lock_bh(&priv->beacon_lock);
 	priv->op_flags &= ~OP_SCANNING;
 	priv->op_flags &= ~OP_SCANNING;
 	spin_unlock_bh(&priv->beacon_lock);
 	spin_unlock_bh(&priv->beacon_lock);
@@ -1785,8 +1796,8 @@ static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw)
 	if (priv->op_flags & OP_ASSOCIATED)
 	if (priv->op_flags & OP_ASSOCIATED)
 		ath9k_htc_beacon_config(priv, priv->vif);
 		ath9k_htc_beacon_config(priv, priv->vif);
 	ath_start_ani(priv);
 	ath_start_ani(priv);
-	mutex_unlock(&priv->mutex);
 	ath9k_htc_ps_restore(priv);
 	ath9k_htc_ps_restore(priv);
+	mutex_unlock(&priv->mutex);
 }
 }
 
 
 static int ath9k_htc_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 static int ath9k_htc_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
@@ -1800,8 +1811,10 @@ static void ath9k_htc_set_coverage_class(struct ieee80211_hw *hw,
 	struct ath9k_htc_priv *priv = hw->priv;
 	struct ath9k_htc_priv *priv = hw->priv;
 
 
 	mutex_lock(&priv->mutex);
 	mutex_lock(&priv->mutex);
+	ath9k_htc_ps_wakeup(priv);
 	priv->ah->coverage_class = coverage_class;
 	priv->ah->coverage_class = coverage_class;
 	ath9k_hw_init_global_settings(priv->ah);
 	ath9k_hw_init_global_settings(priv->ah);
+	ath9k_htc_ps_restore(priv);
 	mutex_unlock(&priv->mutex);
 	mutex_unlock(&priv->mutex);
 }
 }