[<prev] [next>] [day] [month] [year] [list]
Message-Id: <200711170006.49654.mboton.lkml@gmail.com>
Date: Sat, 17 Nov 2007 00:06:49 +0100
From: Miguel Botón <mboton.lkml@...il.com>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc: linux-wireless@...r.kernel.org, linville@...driver.com,
yi.zhu@...el.com
Subject: [PATCH 2/2] iwlwifi: add power management support -v2
This patch adds power management support in iwl3945 and iwl4965 drivers.
Signed-off-by: Miguel Botón <mboton@...il.com>
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists