Skip to contentSkip to conversation

iwlwifi: add power management support -v2

PATCH In review Miguel Botón 3 participants 5 messages Nov 16, 2007 – Nov 26, 2007 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

This patch adds power management support in iwl3945 and iwl4965 drivers= =2E

drivers/net/= renamed from drivers/net/wireless/iwlwifi/iwl3945-base.c +0 -0

wireless/iwlwifi/iwl3945-base.c
index 9baf8de..5c7b422 100644

drivers/net/wireless/iwlwifi/iwl3945-base.c +1 -0
@@ -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) {

drivers/net/= renamed from drivers/net/wireless/iwlwifi/iwl4965-base.c +0 -0

wireless/iwlwifi/iwl4965-base.c
index df011ea..8d303c5 100644

drivers/net/wireless/iwlwifi/iwl4965-base.c +1 -0
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 1 line · 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

Quoted 1 line

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 3 lines · On Nov 26, 2007 6:18 PM, Miguel Bot=F3n <[email protected]> wrote:
Quoted 1 line · 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

Quoted 2 lines
Quoted 1 line

ioctls is quite unclear.

I

Quoted 1 line

IWL_POWER_AC and IWL_POWER_BATTERY are just two power modes. IWL_POWE=

R_AC

Quoted 1 line

would be the default power mode when we're in AC (no power saving) an=

d

Quoted 1 line

IWL_POWER_BATTERY would be the default power mode when we're in batte=

ry

Quoted 2 lines

(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

Quoted 4 lines

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

Quoted 1 line

mode we should use, Then, it checks if we're already using this mode =

or not.

Quoted 1 line

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

Quoted 3 lines

--
Miguel Bot=F3n

-
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 1 line · Tomas Winkler

On Nov 26, 2007 6:18 PM, Miguel Bot=C3=B3n <[email protected]> wr=

ote:

Quoted 3 lines
Quoted 3 lines · On Saturday 17 November 2007 07:15:05 Tomas Winkler wrote:
Quoted 1 line

Why power management shouldn't be enabled while in AC? The semant=

ic of this

Quoted 4 lines
Quoted 2 lines
Quoted 1 line

ioctls is quite unclear.

I

Quoted 1 line

IWL_POWER_AC and IWL_POWER_BATTERY are just two power modes. IWL_PO=

WER_AC

Quoted 1 line
Quoted 1 line

would be the default power mode when we're in AC (no power saving) =

and

Quoted 1 line
Quoted 1 line

IWL_POWER_BATTERY would be the default power mode when we're in bat=

tery

Quoted 2 lines
Quoted 2 lines

(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.

Quoted 4 lines
Quoted 4 lines

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

Quoted 1 line
Quoted 1 line

mode we should use, Then, it checks if we're already using this mod=

e or not.

Quoted 5 lines
Quoted 1 line

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

Quoted 1 line

are translated into appropriate (maybe configurable) power levels. W=

e

Quoted 1 line

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

Quoted 7 lines

Tomas
=20

Quoted 3 lines

--
Miguel Bot=C3=B3n

-
To unsubscribe from this list: send the line "unsubscribe linux-wirel=

ess" in

Quoted 2 lines

the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
Quoted 3 lines

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

Quoted 1 line

in the driver. Otherwise, we get into a situation where broadcom pow=

er

Quoted 1 line

levels don't map the same way iwl powerlevels do, and then we can't e=

ver

Quoted 2 lines

do the right thing.

Agree, these are just misleading names IMHO.

Quoted 10 lines

dan

Quoted 8 lines

Tomas

Quoted 3 lines

--
Miguel Bot=F3n

-
To unsubscribe from this list: send the line "unsubscribe linux-wir=

eless" in

Quoted 4 lines
Quoted 2 lines

the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html