[PATCH 2/2] iwlwifi: add power management support -v2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds power management support in iwl3945 and iwl4965 drivers.

Signed-off-by: Miguel Botón <[email protected]>

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 9baf8de..5c7b422 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6951,6 +7187,7 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
 	struct iwl3945_priv *priv = hw->priv;
 	const struct iwl3945_channel_info *ch_info;
 	unsigned long flags;
+	int power_mode;
 
 	mutex_lock(&priv->mutex);
 	IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel);
@@ -7001,6 +7238,23 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
 	}
 #endif
 
+	if (conf->power_management_enable)
+		power_mode = IWL_POWER_BATTERY | IWL_POWER_ENABLED;
+	else
+		power_mode = IWL_POWER_AC;
+
+	if (priv->power_mode != power_mode) {
+		int rc;
+
+		rc = iwl3945_send_power_mode(priv, power_mode);
+		if (rc) {
+			IWL_DEBUG_MAC80211("failed setting power mode.\n");
+			mutex_unlock(&priv->mutex);
+			return -EINVAL;
+		}
+		priv->power_mode = power_mode;
+	}
+
 	iwl3945_radio_kill_sw(priv, !conf->radio_enabled);
 
 	if (!conf->radio_enabled) {
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index df011ea..8d303c5 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -7352,6 +7352,7 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
 	struct iwl4965_priv *priv = hw->priv;
 	const struct iwl4965_channel_info *ch_info;
 	unsigned long flags;
+	int power_mode;
 
 	mutex_lock(&priv->mutex);
 	IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel);
@@ -7414,6 +7415,23 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
 	}
 #endif
 
+	if (conf->power_management_enable)
+		power_mode = IWL_POWER_BATTERY | IWL_POWER_ENABLED;
+	else
+		power_mode = IWL_POWER_AC;
+
+	if (priv->power_mode != power_mode) {
+		int rc;
+
+		rc = iwl4965_send_power_mode(priv, power_mode);
+		if (rc) {
+			IWL_DEBUG_MAC80211("failed setting power mode.\n");
+			mutex_unlock(&priv->mutex);
+			return -EINVAL;
+		}
+		priv->power_mode = power_mode;
+	}
+
 	iwl4965_radio_kill_sw(priv, !conf->radio_enabled);
 
 	if (!conf->radio_enabled) {


-- 
	Miguel Botón
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux