* [PATCH 2/2] iwlwifi: add power management support -v2
@ 2007-11-16 23:06 Miguel Botón
[not found] ` <1ba2fa240711162215p30b8bc7fj9f36020378ff596a@mail.gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Miguel Botón @ 2007-11-16 23:06 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: linux-wireless, linville, yi.zhu
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
^ permalink raw reply related [flat|nested] 5+ messages in thread[parent not found: <1ba2fa240711162215p30b8bc7fj9f36020378ff596a@mail.gmail.com>]
* Re: [PATCH 2/2] iwlwifi: add power management support -v2 [not found] ` <1ba2fa240711162215p30b8bc7fj9f36020378ff596a@mail.gmail.com> @ 2007-11-26 16:18 ` Miguel Botón 2007-11-26 17:11 ` Tomas Winkler 0 siblings, 1 reply; 5+ messages in thread From: Miguel Botón @ 2007-11-26 16:18 UTC (permalink / raw) To: Tomas Winkler Cc: Miguel Botón, Linux Kernel Mailing List, linux-wireless, linville, yi.zhu On Saturday 17 November 2007 07:15:05 Tomas Winkler wrote: > Why power management shouldn't be enabled while in AC? The semantic o= f this > ioctls is quite unclear. IWL_POWER_AC and IWL_POWER_BATTERY are just two power modes. IWL_POWER_= AC=20 would be the default power mode when we're in AC (no power saving) and=20 IWL_POWER_BATTERY would be the default power mode when we're in battery= =20 (power saving mode). That's why we set IWL_POWER_ENABLED flag with=20 IWL_POWER_BATTERY, because it is the only power mode that saves power. We can change to IWL_POWER_BATTERY or IWL_POWER_AC in any moment. This patch, depending if power management is enabled or not, sets which= power=20 mode we should use, Then, it checks if we're already using this mode or= not. --=20 Miguel Bot=F3n - 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] iwlwifi: add power management support -v2 2007-11-26 16:18 ` Miguel Botón @ 2007-11-26 17:11 ` Tomas Winkler 2007-11-26 17:14 ` Dan Williams 0 siblings, 1 reply; 5+ messages in thread From: Tomas Winkler @ 2007-11-26 17:11 UTC (permalink / raw) To: Miguel Botón Cc: Linux Kernel Mailing List, linux-wireless, linville, yi.zhu On Nov 26, 2007 6:18 PM, Miguel Bot=F3n <mboton.lkml@gmail.com> wrote: > > On Saturday 17 November 2007 07:15:05 Tomas Winkler wrote: > > Why power management shouldn't be enabled while in AC? The semantic= of this > > ioctls is quite unclear. > I > IWL_POWER_AC and IWL_POWER_BATTERY are just two power modes. IWL_POWE= R_AC > would be the default power mode when we're in AC (no power saving) an= d > IWL_POWER_BATTERY would be the default power mode when we're in batte= ry > (power saving mode). That's why we set IWL_POWER_ENABLED flag with > IWL_POWER_BATTERY, because it is the only power mode that saves power= =2E > > We can change to IWL_POWER_BATTERY or IWL_POWER_AC in any moment. > > This patch, depending if power management is enabled or not, sets whi= ch power > mode we should use, Then, it checks if we're already using this mode = or not. > I'm not sure who introduced this names (lazy to look to history) but that's very misleading. Nothing says that while in AC we cannot do power saving and vice versa. This naming is scattered all over the code, there should be only one place where AC and BATTERY are translated into appropriate (maybe configurable) power levels. We have 5 power levels defined for iwlwifi. Tomas > -- > Miguel Bot=F3n > - 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] iwlwifi: add power management support -v2 2007-11-26 17:11 ` Tomas Winkler @ 2007-11-26 17:14 ` Dan Williams 2007-11-26 17:33 ` Tomas Winkler 0 siblings, 1 reply; 5+ messages in thread From: Dan Williams @ 2007-11-26 17:14 UTC (permalink / raw) To: Tomas Winkler Cc: Miguel Botón, Linux Kernel Mailing List, linux-wireless, linville, yi.zhu On Mon, 2007-11-26 at 19:11 +0200, Tomas Winkler wrote: > On Nov 26, 2007 6:18 PM, Miguel Bot=C3=B3n <mboton.lkml@gmail.com> wr= ote: > > > > On Saturday 17 November 2007 07:15:05 Tomas Winkler wrote: > > > Why power management shouldn't be enabled while in AC? The semant= ic of this > > > ioctls is quite unclear. > > > I > > IWL_POWER_AC and IWL_POWER_BATTERY are just two power modes. IWL_PO= WER_AC > > would be the default power mode when we're in AC (no power saving) = and > > IWL_POWER_BATTERY would be the default power mode when we're in bat= tery > > (power saving mode). That's why we set IWL_POWER_ENABLED flag with > > IWL_POWER_BATTERY, because it is the only power mode that saves pow= er. > > > > We can change to IWL_POWER_BATTERY or IWL_POWER_AC in any moment. > > > > This patch, depending if power management is enabled or not, sets w= hich power > > mode we should use, Then, it checks if we're already using this mod= e or not. > > > I'm not sure who introduced this names (lazy to look to history) but > that's very misleading. Nothing says that while in > AC we cannot do power saving and vice versa. This naming is scattered > all over the code, there should be only one place where AC and BATTER= Y > are translated into appropriate (maybe configurable) power levels. W= e > have 5 power levels defined for iwlwifi. At some point everyone needs to standardize on power levels so that userland has a hope of mapping the right state to the right power level in the driver. Otherwise, we get into a situation where broadcom power levels don't map the same way iwl powerlevels do, and then we can't eve= r do the right thing. dan > Tomas >=20 > > -- > > Miguel Bot=C3=B3n > > > - > To unsubscribe from this list: send the line "unsubscribe linux-wirel= ess" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html - 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] iwlwifi: add power management support -v2 2007-11-26 17:14 ` Dan Williams @ 2007-11-26 17:33 ` Tomas Winkler 0 siblings, 0 replies; 5+ messages in thread From: Tomas Winkler @ 2007-11-26 17:33 UTC (permalink / raw) To: Dan Williams Cc: Miguel Botón, Linux Kernel Mailing List, linux-wireless, linville, yi.zhu > > At some point everyone needs to standardize on power levels so that > userland has a hope of mapping the right state to the right power lev= el > in the driver. Otherwise, we get into a situation where broadcom pow= er > levels don't map the same way iwl powerlevels do, and then we can't e= ver > do the right thing. > Agree, these are just misleading names IMHO. > dan > > > Tomas > > > > > > -- > > > Miguel Bot=F3n > > > > > - > > To unsubscribe from this list: send the line "unsubscribe linux-wir= eless" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > - 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-11-26 17:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-16 23:06 [PATCH 2/2] iwlwifi: add power management support -v2 Miguel Botón
[not found] ` <1ba2fa240711162215p30b8bc7fj9f36020378ff596a@mail.gmail.com>
2007-11-26 16:18 ` Miguel Botón
2007-11-26 17:11 ` Tomas Winkler
2007-11-26 17:14 ` Dan Williams
2007-11-26 17:33 ` Tomas Winkler
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).