* [PATCH] fix iwl3945 tx power setting in iwl3945_init_drv
@ 2011-04-10 11:06 Robin Dong
2011-04-11 18:25 ` Stanislaw Gruszka
0 siblings, 1 reply; 4+ messages in thread
From: Robin Dong @ 2011-04-10 11:06 UTC (permalink / raw)
To: linux-wireless; +Cc: Robin Dong
From: Robin Dong <sanbai@taobao.com>
When I build and run the kernel-2.6.39-rc2 on my laptop, my intel-3945-a/b/g wireless
card will not work and the dmesg is:
[ 58.597834] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
[ 58.597839] iwl3945 0000:03:00.0: Error setting Tx power (-22).
[ 58.598276] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
[ 58.598279] iwl3945 0000:03:00.0: Error setting Tx power (-22).
[ 94.064147] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
[ 94.064152] iwl3945 0000:03:00.0: Error setting Tx power (-22).
[ 94.064529] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
[ 94.064533] iwl3945 0000:03:00.0: Error setting Tx power (-22).
[ 133.892160] sky2 0000:02:00.0: eth1: disabling interface
[ 473.313935] sky2 0000:02:00.0: eth1: enabling interface
[ 473.314238] ADDRCONF(NETDEV_UP): eth1: link is not ready
[ 473.383740] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
[ 473.383748] iwl3945 0000:03:00.0: Error setting Tx power (-22).
[ 473.384146] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
[ 473.384153] iwl3945 0000:03:00.0: Error setting Tx power (-22).
[ 473.455655] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
[ 473.455663] iwl3945 0000:03:00.0: Error setting Tx power (-22).
[ 473.456128] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
[ 473.456134] iwl3945 0000:03:00.0: Error setting Tx power (-22).
It is weird the iwl3945 set txpower 15 above limit 14.
So I checked iwl4965 and iwl3945 driver and found out it will set
tx_power_next to 0 in "iwl4965_init_drv" but to 15 in "iwl3945_init_drv"
I change tx_power_next=0 in "iwl3945_init_drv", and my wireless card works.
Signed-off-by: Robin Dong <sanbai@taobao.com>
---
drivers/net/wireless/iwlegacy/iwl-3945-hw.h | 2 +-
drivers/net/wireless/iwlegacy/iwl3945-base.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h index 779d3cb..21438ee 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
@@ -74,7 +74,7 @@
/* RSSI to dBm */
#define IWL39_RSSI_OFFSET 95
-#define IWL_DEFAULT_TX_POWER 0x0F
+#define IWL3945_TX_POWER_TARGET_POWER_MIN (0)
/*
* EEPROM related constants, enums, and structures.
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 28eb3d8..91ed03b 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -3826,8 +3826,8 @@ static int iwl3945_init_drv(struct iwl_priv *priv)
IWL_DELAY_NEXT_FORCE_FW_RELOAD;
- priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER;
- priv->tx_power_next = IWL_DEFAULT_TX_POWER;
+ priv->tx_power_user_lmt = IWL3945_TX_POWER_TARGET_POWER_MIN;
+ priv->tx_power_next = IWL3945_TX_POWER_TARGET_POWER_MIN;
if (eeprom->version < EEPROM_3945_EEPROM_VERSION) {
IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n",
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fix iwl3945 tx power setting in iwl3945_init_drv
2011-04-10 11:06 [PATCH] fix iwl3945 tx power setting in iwl3945_init_drv Robin Dong
@ 2011-04-11 18:25 ` Stanislaw Gruszka
2011-04-12 14:26 ` Stanislaw Gruszka
0 siblings, 1 reply; 4+ messages in thread
From: Stanislaw Gruszka @ 2011-04-11 18:25 UTC (permalink / raw)
To: Robin Dong; +Cc: linux-wireless, Robin Dong
Hi Robin
> When I build and run the kernel-2.6.39-rc2 on my laptop, my intel-3945-a/b/g wireless
> card will not work and the dmesg is:
>
> [ 58.597834] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> [ 58.597839] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> [ 58.598276] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> [ 58.598279] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> [ 94.064147] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> [ 94.064152] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> [ 94.064529] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> [ 94.064533] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> [ 133.892160] sky2 0000:02:00.0: eth1: disabling interface
> [ 473.313935] sky2 0000:02:00.0: eth1: enabling interface
> [ 473.314238] ADDRCONF(NETDEV_UP): eth1: link is not ready
> [ 473.383740] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> [ 473.383748] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> [ 473.384146] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> [ 473.384153] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> [ 473.455655] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> [ 473.455663] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> [ 473.456128] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> [ 473.456134] iwl3945 0000:03:00.0: Error setting Tx power (-22).
>
> It is weird the iwl3945 set txpower 15 above limit 14.
> So I checked iwl4965 and iwl3945 driver and found out it will set
> tx_power_next to 0 in "iwl4965_init_drv" but to 15 in "iwl3945_init_drv"
> I change tx_power_next=0 in "iwl3945_init_drv", and my wireless card works.
Thanks for catching this. I wonder if this is a problem of bad
tx_power_device_lmt value instead of default setting, because on older
kernel default tx_power value 15 worked, right? I would like to avoid
changing default setting is possible.
Could you apply below simple patch and apply similar changes on older
kernel to compare if tx_power_device_lmt change on your system between
kernels and why?
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index 7007d61..78af49b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -235,6 +235,9 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
geo_ch->flags |= ch->ht40_extension_channel;
+ printk("ch->max_power_avg %u, priv->tx_power_device_lmt %u\n",
+ ch->max_power_avg, priv->tx_power_device_lmt);
+
if (ch->max_power_avg > priv->tx_power_device_lmt)
priv->tx_power_device_lmt = ch->max_power_avg;
} else {
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
index 04c5648..45f458b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
@@ -448,6 +448,7 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv)
/* Initialize regulatory-based run-time data */
ch_info->max_power_avg = ch_info->curr_txpow =
eeprom_ch_info[ch].max_power_avg;
+ printk("band %d ch %d max_power_avg %d\n", band, ch, ch_info->max_power_avg);
ch_info->scan_power = eeprom_ch_info[ch].max_power_avg;
ch_info->min_power = 0;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fix iwl3945 tx power setting in iwl3945_init_drv
2011-04-11 18:25 ` Stanislaw Gruszka
@ 2011-04-12 14:26 ` Stanislaw Gruszka
2011-04-13 6:06 ` Robin Dong
0 siblings, 1 reply; 4+ messages in thread
From: Stanislaw Gruszka @ 2011-04-12 14:26 UTC (permalink / raw)
To: Robin Dong; +Cc: linux-wireless, Robin Dong
On Mon, Apr 11, 2011 at 08:25:31PM +0200, Stanislaw Gruszka wrote:
> > When I build and run the kernel-2.6.39-rc2 on my laptop, my intel-3945-a/b/g wireless
> > card will not work and the dmesg is:
> >
> > [ 58.597834] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> > [ 58.597839] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> > [ 58.598276] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> > [ 58.598279] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> > [ 94.064147] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> > [ 94.064152] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> > [ 94.064529] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> > [ 94.064533] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> > [ 133.892160] sky2 0000:02:00.0: eth1: disabling interface
> > [ 473.313935] sky2 0000:02:00.0: eth1: enabling interface
> > [ 473.314238] ADDRCONF(NETDEV_UP): eth1: link is not ready
> > [ 473.383740] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> > [ 473.383748] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> > [ 473.384146] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> > [ 473.384153] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> > [ 473.455655] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> > [ 473.455663] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> > [ 473.456128] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> > [ 473.456134] iwl3945 0000:03:00.0: Error setting Tx power (-22).
> >
> > It is weird the iwl3945 set txpower 15 above limit 14.
> > So I checked iwl4965 and iwl3945 driver and found out it will set
> > tx_power_next to 0 in "iwl4965_init_drv" but to 15 in "iwl3945_init_drv"
> > I change tx_power_next=0 in "iwl3945_init_drv", and my wireless card works.
>
> Thanks for catching this. I wonder if this is a problem of bad
> tx_power_device_lmt value instead of default setting, because on older
> kernel default tx_power value 15 worked, right? I would like to avoid
> changing default setting is possible.
I think I found reason of the problem, that tx_power_next is not
initialized to max power (eg. tx_power_device_lmt) like tx_power_user_lmt is.
Please check below patch:
>From 0ab6465255442331cc9c214d7f26b11a7c61032a Mon Sep 17 00:00:00 2001
From: Stanislaw Gruszka <sgruszka@redhat.com>
Date: Tue, 12 Apr 2011 15:34:43 +0200
Subject: [PATCH] iwlegacy: fix tx_power initialization
priv->tx_power_next is not initialized to max supported power, but
instead default value 15 is used, what cause errors like
[ 58.597834] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
[ 58.597839] iwl3945 0000:03:00.0: Error setting Tx power (-22).
if maximum tx power read from eeprom is smaller than default.
Fix the problem and cleanup a bit tx power initialization.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
drivers/net/wireless/iwlegacy/iwl-3945-hw.h | 2 --
drivers/net/wireless/iwlegacy/iwl-4965-hw.h | 3 ---
drivers/net/wireless/iwlegacy/iwl-core.c | 17 +++++++++++------
drivers/net/wireless/iwlegacy/iwl-eeprom.c | 7 -------
drivers/net/wireless/iwlegacy/iwl3945-base.c | 4 ----
drivers/net/wireless/iwlegacy/iwl4965-base.c | 6 ------
6 files changed, 11 insertions(+), 28 deletions(-)
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
index 779d3cb..5c3a68d 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
@@ -74,8 +74,6 @@
/* RSSI to dBm */
#define IWL39_RSSI_OFFSET 95
-#define IWL_DEFAULT_TX_POWER 0x0F
-
/*
* EEPROM related constants, enums, and structures.
*/
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
index 08b189c..fc6fa28 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
@@ -804,9 +804,6 @@ struct iwl4965_scd_bc_tbl {
#define IWL4965_DEFAULT_TX_RETRY 15
-/* Limit range of txpower output target to be between these values */
-#define IWL4965_TX_POWER_TARGET_POWER_MIN (0) /* 0 dBm: 1 milliwatt */
-
/* EEPROM */
#define IWL4965_FIRST_AMPDU_QUEUE 10
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index 7007d61..c1511b1 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -160,6 +160,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
struct ieee80211_channel *geo_ch;
struct ieee80211_rate *rates;
int i = 0;
+ s8 max_tx_power = 0;
if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
@@ -235,8 +236,8 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
geo_ch->flags |= ch->ht40_extension_channel;
- if (ch->max_power_avg > priv->tx_power_device_lmt)
- priv->tx_power_device_lmt = ch->max_power_avg;
+ if (ch->max_power_avg > max_tx_power)
+ max_tx_power = ch->max_power_avg;
} else {
geo_ch->flags |= IEEE80211_CHAN_DISABLED;
}
@@ -249,6 +250,10 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
geo_ch->flags);
}
+ priv->tx_power_device_lmt = max_tx_power;
+ priv->tx_power_user_lmt = max_tx_power;
+ priv->tx_power_next = max_tx_power;
+
if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
priv->cfg->sku & IWL_SKU_A) {
IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
@@ -1124,11 +1129,11 @@ int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
if (!priv->cfg->ops->lib->send_tx_power)
return -EOPNOTSUPP;
- if (tx_power < IWL4965_TX_POWER_TARGET_POWER_MIN) {
+ /* 0 dBm mean 1 milliwatt */
+ if (tx_power < 0) {
IWL_WARN(priv,
- "Requested user TXPOWER %d below lower limit %d.\n",
- tx_power,
- IWL4965_TX_POWER_TARGET_POWER_MIN);
+ "Requested user TXPOWER %d below 1 mW.\n",
+ tx_power);
return -EINVAL;
}
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
index 04c5648..cb346d1 100644
--- a/drivers/net/wireless/iwlegacy/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
@@ -471,13 +471,6 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv)
flags & EEPROM_CHANNEL_RADAR))
? "" : "not ");
- /* Set the tx_power_user_lmt to the highest power
- * supported by any channel */
- if (eeprom_ch_info[ch].max_power_avg >
- priv->tx_power_user_lmt)
- priv->tx_power_user_lmt =
- eeprom_ch_info[ch].max_power_avg;
-
ch_info++;
}
}
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 28eb3d8..cc7ebce 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -3825,10 +3825,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv)
priv->force_reset[IWL_FW_RESET].reset_duration =
IWL_DELAY_NEXT_FORCE_FW_RELOAD;
-
- priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER;
- priv->tx_power_next = IWL_DEFAULT_TX_POWER;
-
if (eeprom->version < EEPROM_3945_EEPROM_VERSION) {
IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n",
eeprom->version);
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index 91b3d8b..d484c36 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -3140,12 +3140,6 @@ static int iwl4965_init_drv(struct iwl_priv *priv)
iwl_legacy_init_scan_params(priv);
- /* Set the tx_power_user_lmt to the lowest power level
- * this value will get overwritten by channel max power avg
- * from eeprom */
- priv->tx_power_user_lmt = IWL4965_TX_POWER_TARGET_POWER_MIN;
- priv->tx_power_next = IWL4965_TX_POWER_TARGET_POWER_MIN;
-
ret = iwl_legacy_init_channel_map(priv);
if (ret) {
IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fix iwl3945 tx power setting in iwl3945_init_drv
2011-04-12 14:26 ` Stanislaw Gruszka
@ 2011-04-13 6:06 ` Robin Dong
0 siblings, 0 replies; 4+ messages in thread
From: Robin Dong @ 2011-04-13 6:06 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: linux-wireless
2011/4/12 Stanislaw Gruszka <sgruszka@redhat.com>:
> On Mon, Apr 11, 2011 at 08:25:31PM +0200, Stanislaw Gruszka wrote:
>> > When I build and run the kernel-2.6.39-rc2 on my laptop, my intel-3945-a/b/g wireless
>> > card will not work and the dmesg is:
>> >
>> > [ 58.597834] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
>> > [ 58.597839] iwl3945 0000:03:00.0: Error setting Tx power (-22).
>> > [ 58.598276] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
>> > [ 58.598279] iwl3945 0000:03:00.0: Error setting Tx power (-22).
>> > [ 94.064147] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
>> > [ 94.064152] iwl3945 0000:03:00.0: Error setting Tx power (-22).
>> > [ 94.064529] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
>> > [ 94.064533] iwl3945 0000:03:00.0: Error setting Tx power (-22).
>> > [ 133.892160] sky2 0000:02:00.0: eth1: disabling interface
>> > [ 473.313935] sky2 0000:02:00.0: eth1: enabling interface
>> > [ 473.314238] ADDRCONF(NETDEV_UP): eth1: link is not ready
>> > [ 473.383740] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
>> > [ 473.383748] iwl3945 0000:03:00.0: Error setting Tx power (-22).
>> > [ 473.384146] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
>> > [ 473.384153] iwl3945 0000:03:00.0: Error setting Tx power (-22).
>> > [ 473.455655] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
>> > [ 473.455663] iwl3945 0000:03:00.0: Error setting Tx power (-22).
>> > [ 473.456128] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
>> > [ 473.456134] iwl3945 0000:03:00.0: Error setting Tx power (-22).
>> >
>> > It is weird the iwl3945 set txpower 15 above limit 14.
>> > So I checked iwl4965 and iwl3945 driver and found out it will set
>> > tx_power_next to 0 in "iwl4965_init_drv" but to 15 in "iwl3945_init_drv"
>> > I change tx_power_next=0 in "iwl3945_init_drv", and my wireless card works.
>>
>> Thanks for catching this. I wonder if this is a problem of bad
>> tx_power_device_lmt value instead of default setting, because on older
>> kernel default tx_power value 15 worked, right? I would like to avoid
>> changing default setting is possible.
>
> I think I found reason of the problem, that tx_power_next is not
> initialized to max power (eg. tx_power_device_lmt) like tx_power_user_lmt is.
> Please check below patch:
>
> From 0ab6465255442331cc9c214d7f26b11a7c61032a Mon Sep 17 00:00:00 2001
> From: Stanislaw Gruszka <sgruszka@redhat.com>
> Date: Tue, 12 Apr 2011 15:34:43 +0200
> Subject: [PATCH] iwlegacy: fix tx_power initialization
>
> priv->tx_power_next is not initialized to max supported power, but
> instead default value 15 is used, what cause errors like
>
> [ 58.597834] iwl3945 0000:03:00.0: Requested user TXPOWER 15 above upper limit 14.
> [ 58.597839] iwl3945 0000:03:00.0: Error setting Tx power (-22).
>
> if maximum tx power read from eeprom is smaller than default.
> Fix the problem and cleanup a bit tx power initialization.
>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
> drivers/net/wireless/iwlegacy/iwl-3945-hw.h | 2 --
> drivers/net/wireless/iwlegacy/iwl-4965-hw.h | 3 ---
> drivers/net/wireless/iwlegacy/iwl-core.c | 17 +++++++++++------
> drivers/net/wireless/iwlegacy/iwl-eeprom.c | 7 -------
> drivers/net/wireless/iwlegacy/iwl3945-base.c | 4 ----
> drivers/net/wireless/iwlegacy/iwl4965-base.c | 6 ------
> 6 files changed, 11 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
> index 779d3cb..5c3a68d 100644
> --- a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
> +++ b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
> @@ -74,8 +74,6 @@
> /* RSSI to dBm */
> #define IWL39_RSSI_OFFSET 95
>
> -#define IWL_DEFAULT_TX_POWER 0x0F
> -
> /*
> * EEPROM related constants, enums, and structures.
> */
> diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
> index 08b189c..fc6fa28 100644
> --- a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
> +++ b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
> @@ -804,9 +804,6 @@ struct iwl4965_scd_bc_tbl {
>
> #define IWL4965_DEFAULT_TX_RETRY 15
>
> -/* Limit range of txpower output target to be between these values */
> -#define IWL4965_TX_POWER_TARGET_POWER_MIN (0) /* 0 dBm: 1 milliwatt */
> -
> /* EEPROM */
> #define IWL4965_FIRST_AMPDU_QUEUE 10
>
> diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
> index 7007d61..c1511b1 100644
> --- a/drivers/net/wireless/iwlegacy/iwl-core.c
> +++ b/drivers/net/wireless/iwlegacy/iwl-core.c
> @@ -160,6 +160,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
> struct ieee80211_channel *geo_ch;
> struct ieee80211_rate *rates;
> int i = 0;
> + s8 max_tx_power = 0;
>
> if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
> priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
> @@ -235,8 +236,8 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
>
> geo_ch->flags |= ch->ht40_extension_channel;
>
> - if (ch->max_power_avg > priv->tx_power_device_lmt)
> - priv->tx_power_device_lmt = ch->max_power_avg;
> + if (ch->max_power_avg > max_tx_power)
> + max_tx_power = ch->max_power_avg;
> } else {
> geo_ch->flags |= IEEE80211_CHAN_DISABLED;
> }
> @@ -249,6 +250,10 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
> geo_ch->flags);
> }
>
> + priv->tx_power_device_lmt = max_tx_power;
> + priv->tx_power_user_lmt = max_tx_power;
> + priv->tx_power_next = max_tx_power;
> +
> if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
> priv->cfg->sku & IWL_SKU_A) {
> IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
> @@ -1124,11 +1129,11 @@ int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
> if (!priv->cfg->ops->lib->send_tx_power)
> return -EOPNOTSUPP;
>
> - if (tx_power < IWL4965_TX_POWER_TARGET_POWER_MIN) {
> + /* 0 dBm mean 1 milliwatt */
> + if (tx_power < 0) {
> IWL_WARN(priv,
> - "Requested user TXPOWER %d below lower limit %d.\n",
> - tx_power,
> - IWL4965_TX_POWER_TARGET_POWER_MIN);
> + "Requested user TXPOWER %d below 1 mW.\n",
> + tx_power);
> return -EINVAL;
> }
>
> diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
> index 04c5648..cb346d1 100644
> --- a/drivers/net/wireless/iwlegacy/iwl-eeprom.c
> +++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
> @@ -471,13 +471,6 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv)
> flags & EEPROM_CHANNEL_RADAR))
> ? "" : "not ");
>
> - /* Set the tx_power_user_lmt to the highest power
> - * supported by any channel */
> - if (eeprom_ch_info[ch].max_power_avg >
> - priv->tx_power_user_lmt)
> - priv->tx_power_user_lmt =
> - eeprom_ch_info[ch].max_power_avg;
> -
> ch_info++;
> }
> }
> diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
> index 28eb3d8..cc7ebce 100644
> --- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
> +++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
> @@ -3825,10 +3825,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv)
> priv->force_reset[IWL_FW_RESET].reset_duration =
> IWL_DELAY_NEXT_FORCE_FW_RELOAD;
>
> -
> - priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER;
> - priv->tx_power_next = IWL_DEFAULT_TX_POWER;
> -
> if (eeprom->version < EEPROM_3945_EEPROM_VERSION) {
> IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n",
> eeprom->version);
> diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
> index 91b3d8b..d484c36 100644
> --- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
> +++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
> @@ -3140,12 +3140,6 @@ static int iwl4965_init_drv(struct iwl_priv *priv)
>
> iwl_legacy_init_scan_params(priv);
>
> - /* Set the tx_power_user_lmt to the lowest power level
> - * this value will get overwritten by channel max power avg
> - * from eeprom */
> - priv->tx_power_user_lmt = IWL4965_TX_POWER_TARGET_POWER_MIN;
> - priv->tx_power_next = IWL4965_TX_POWER_TARGET_POWER_MIN;
> -
> ret = iwl_legacy_init_channel_map(priv);
> if (ret) {
> IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
> --
> 1.7.1
>
>
>
I use this patch on my laptop, and my wireless card works well now.
Thank you.
--
--
Best Regard
Robin Dong
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-13 6:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-10 11:06 [PATCH] fix iwl3945 tx power setting in iwl3945_init_drv Robin Dong
2011-04-11 18:25 ` Stanislaw Gruszka
2011-04-12 14:26 ` Stanislaw Gruszka
2011-04-13 6:06 ` Robin Dong
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).