public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Miguel Botón" <mboton.lkml@gmail.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: linux-wireless@vger.kernel.org, linville@tuxdriver.com, yi.zhu@intel.com
Subject: [PATCH 2/2] iwlwifi: add power management support
Date: Fri, 16 Nov 2007 19:32:22 +0100	[thread overview]
Message-ID: <200711161932.22807.mboton.lkml@gmail.com> (raw)

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

Signed-off-by: Miguel Botón <mboton@gmail.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,21 @@ 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");
+		else
+			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,21 @@ 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");
+		else
+			priv->power_mode = power_mode;
+	}
+
 	iwl4965_radio_kill_sw(priv, !conf->radio_enabled);
 
 	if (!conf->radio_enabled) {


-- 
	Miguel Botón

                 reply	other threads:[~2007-11-16 18:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200711161932.22807.mboton.lkml@gmail.com \
    --to=mboton.lkml@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=yi.zhu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox