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 -v2
Date: Sat, 17 Nov 2007 00:06:49 +0100 [thread overview]
Message-ID: <200711170006.49654.mboton.lkml@gmail.com> (raw)
This patch adds power management support in iwl3945 and iwl4965 drivers=
=2E
Signed-off-by: Miguel Bot=C3=B3n <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 =3D hw->priv;
const struct iwl3945_channel_info *ch_info;
unsigned long flags;
+ int power_mode;
=20
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_h=
w *hw, struct ieee80211_conf *co
}
#endif
=20
+ if (conf->power_management_enable)
+ power_mode =3D IWL_POWER_BATTERY | IWL_POWER_ENABLED;
+ else
+ power_mode =3D IWL_POWER_AC;
+
+ if (priv->power_mode !=3D power_mode) {
+ int rc;
+
+ rc =3D 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 =3D power_mode;
+ }
+
iwl3945_radio_kill_sw(priv, !conf->radio_enabled);
=20
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 =3D hw->priv;
const struct iwl4965_channel_info *ch_info;
unsigned long flags;
+ int power_mode;
=20
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_h=
w *hw, struct ieee80211_conf *co
}
#endif
=20
+ if (conf->power_management_enable)
+ power_mode =3D IWL_POWER_BATTERY | IWL_POWER_ENABLED;
+ else
+ power_mode =3D IWL_POWER_AC;
+
+ if (priv->power_mode !=3D power_mode) {
+ int rc;
+
+ rc =3D 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 =3D power_mode;
+ }
+
iwl4965_radio_kill_sw(priv, !conf->radio_enabled);
=20
if (!conf->radio_enabled) {
--=20
Miguel Bot=C3=B3n
-
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2007-11-16 23:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-16 23:06 Miguel Botón [this message]
[not found] ` <1ba2fa240711162215p30b8bc7fj9f36020378ff596a@mail.gmail.com>
2007-11-26 16:18 ` [PATCH 2/2] iwlwifi: add power management support -v2 Miguel Botón
2007-11-26 17:11 ` Tomas Winkler
2007-11-26 17:14 ` Dan Williams
2007-11-26 17:33 ` Tomas Winkler
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=200711170006.49654.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;
as well as URLs for NNTP newsgroup(s).