linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rt2800: fix RT5592 TX power settings regression
@ 2014-11-05 17:03 Ronald Wahl
  2014-11-06 10:27 ` Stanislaw Gruszka
  0 siblings, 1 reply; 6+ messages in thread
From: Ronald Wahl @ 2014-11-05 17:03 UTC (permalink / raw)
  To: users; +Cc: linux-wireless

Commit cee2c7315f60beeff6137ee59e99acc77d636eeb (rt2800: fix RT5390 &
RT3290 TX power settings regression) needs to be extended for the RT5592
chipset as well. But at least for the RT5592 the existing regression fix is
not right because the value returned from rt2800_get_gain_calibration_delta()
is bogus as it is generated by an unappropriate algorithm. This can cause
severe connection issues with sticks that have external ALC enabled like the
Netis WF2150 because of too low TX power at least during the scan process.

So the fix for now is not to call rt2800_get_gain_calibration_delta()
for the RT5592 chipset. I do not touch the existing regression fix for
RT5390 & RT3290 but I think they may need a rework as well.

Signed-off-by: Ronald Wahl <ronald.wahl@raritan.com>
---
 drivers/net/wireless/rt2x00/rt2800lib.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 9f57a2d..66f3546 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4118,8 +4118,12 @@ static void rt2800_config_txpower_rt28xx(struct rt2x00_dev *rt2x00dev,
 	 * to temperature or maybe other factors) is smaller or bigger than
 	 * expected. We adjust it, based on TSSI reference and boundaries values
 	 * provided in EEPROM.
+	 *
+	 * TODO: add different temperature compensation code for RT5592
 	 */
-	delta += rt2800_get_gain_calibration_delta(rt2x00dev);
+	if (!rt2x00_rt(rt2x00dev, RT5592)) {
+	    delta += rt2800_get_gain_calibration_delta(rt2x00dev);
+	}
 
 	/*
 	 * Decrease power according to user settings, on devices with unknown
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] rt2800: fix RT5592 TX power settings regression
  2014-11-05 17:03 [PATCH] rt2800: fix RT5592 TX power settings regression Ronald Wahl
@ 2014-11-06 10:27 ` Stanislaw Gruszka
  2014-11-20 21:09   ` [rt2x00-users] " John W. Linville
  0 siblings, 1 reply; 6+ messages in thread
From: Stanislaw Gruszka @ 2014-11-06 10:27 UTC (permalink / raw)
  To: Ronald Wahl; +Cc: users, linux-wireless, Mike Romberg

[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]

On Wed, Nov 05, 2014 at 06:03:30PM +0100, Ronald Wahl wrote:
> Commit cee2c7315f60beeff6137ee59e99acc77d636eeb (rt2800: fix RT5390 &
> RT3290 TX power settings regression) needs to be extended for the RT5592
> chipset as well. But at least for the RT5592 the existing regression fix is
> not right because the value returned from rt2800_get_gain_calibration_delta()
> is bogus as it is generated by an unappropriate algorithm. This can cause
> severe connection issues with sticks that have external ALC enabled like the
> Netis WF2150 because of too low TX power at least during the scan process.
> 
> So the fix for now is not to call rt2800_get_gain_calibration_delta()
> for the RT5592 chipset. I do not touch the existing regression fix for
> RT5390 & RT3290 but I think they may need a rework as well.

Thanks for the patch, but I prefer to call rt2800_get_gain_calibration_delta()
on chips that we know it is needed for them, something like in attached
patch

Mike, since you are cee2c7315f reporter, could you test the attached patch
does not break driver functioning on your H/W.

Thanks
Stanislaw



[-- Attachment #2: rt2800.diff --]
[-- Type: text/plain, Size: 1941 bytes --]

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 9f57a2d..81ee481 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4119,7 +4119,20 @@ static void rt2800_config_txpower_rt28xx(struct rt2x00_dev *rt2x00dev,
 	 * expected. We adjust it, based on TSSI reference and boundaries values
 	 * provided in EEPROM.
 	 */
-	delta += rt2800_get_gain_calibration_delta(rt2x00dev);
+	switch (rt2x00dev->chip.rt) {
+	case RT2860:
+	case RT2872:
+	case RT2883:
+	case RT3070:
+	case RT3071:
+	case RT3090:
+	case RT3572:
+		delta += rt2800_get_gain_calibration_delta(rt2x00dev);
+		break;
+	default:
+		/* TODO: temperature compensation code for other chips. */
+		break;
+	}
 
 	/*
 	 * Decrease power according to user settings, on devices with unknown
@@ -4136,25 +4149,19 @@ static void rt2800_config_txpower_rt28xx(struct rt2x00_dev *rt2x00dev,
 	 * TODO: we do not use +6 dBm option to do not increase power beyond
 	 * regulatory limit, however this could be utilized for devices with
 	 * CAPABILITY_POWER_LIMIT.
-	 *
-	 * TODO: add different temperature compensation code for RT3290 & RT5390
-	 * to allow to use BBP_R1 for those chips.
-	 */
-	if (!rt2x00_rt(rt2x00dev, RT3290) &&
-	    !rt2x00_rt(rt2x00dev, RT5390)) {
-		rt2800_bbp_read(rt2x00dev, 1, &r1);
-		if (delta <= -12) {
-			power_ctrl = 2;
-			delta += 12;
-		} else if (delta <= -6) {
-			power_ctrl = 1;
-			delta += 6;
-		} else {
-			power_ctrl = 0;
-		}
-		rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
-		rt2800_bbp_write(rt2x00dev, 1, r1);
+	 */
+	if (delta <= -12) {
+		power_ctrl = 2;
+		delta += 12;
+	} else if (delta <= -6) {
+		power_ctrl = 1;
+		delta += 6;
+	} else {
+		power_ctrl = 0;
 	}
+	rt2800_bbp_read(rt2x00dev, 1, &r1);
+	rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
+	rt2800_bbp_write(rt2x00dev, 1, r1);
 
 	offset = TX_PWR_CFG_0;
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [rt2x00-users] [PATCH] rt2800: fix RT5592 TX power settings regression
  2014-11-06 10:27 ` Stanislaw Gruszka
@ 2014-11-20 21:09   ` John W. Linville
  2014-11-21  9:39     ` Ronald Wahl
  0 siblings, 1 reply; 6+ messages in thread
From: John W. Linville @ 2014-11-20 21:09 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: Ronald Wahl, Mike Romberg, linux-wireless, users

Any comments on this patch?  Ron, does it work for you?

On Thu, Nov 06, 2014 at 11:27:53AM +0100, Stanislaw Gruszka wrote:
> On Wed, Nov 05, 2014 at 06:03:30PM +0100, Ronald Wahl wrote:
> > Commit cee2c7315f60beeff6137ee59e99acc77d636eeb (rt2800: fix RT5390 &
> > RT3290 TX power settings regression) needs to be extended for the RT5592
> > chipset as well. But at least for the RT5592 the existing regression fix is
> > not right because the value returned from rt2800_get_gain_calibration_delta()
> > is bogus as it is generated by an unappropriate algorithm. This can cause
> > severe connection issues with sticks that have external ALC enabled like the
> > Netis WF2150 because of too low TX power at least during the scan process.
> > 
> > So the fix for now is not to call rt2800_get_gain_calibration_delta()
> > for the RT5592 chipset. I do not touch the existing regression fix for
> > RT5390 & RT3290 but I think they may need a rework as well.
> 
> Thanks for the patch, but I prefer to call rt2800_get_gain_calibration_delta()
> on chips that we know it is needed for them, something like in attached
> patch
> 
> Mike, since you are cee2c7315f reporter, could you test the attached patch
> does not break driver functioning on your H/W.
> 
> Thanks
> Stanislaw
> 
> 

> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
> index 9f57a2d..81ee481 100644
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -4119,7 +4119,20 @@ static void rt2800_config_txpower_rt28xx(struct rt2x00_dev *rt2x00dev,
>  	 * expected. We adjust it, based on TSSI reference and boundaries values
>  	 * provided in EEPROM.
>  	 */
> -	delta += rt2800_get_gain_calibration_delta(rt2x00dev);
> +	switch (rt2x00dev->chip.rt) {
> +	case RT2860:
> +	case RT2872:
> +	case RT2883:
> +	case RT3070:
> +	case RT3071:
> +	case RT3090:
> +	case RT3572:
> +		delta += rt2800_get_gain_calibration_delta(rt2x00dev);
> +		break;
> +	default:
> +		/* TODO: temperature compensation code for other chips. */
> +		break;
> +	}
>  
>  	/*
>  	 * Decrease power according to user settings, on devices with unknown
> @@ -4136,25 +4149,19 @@ static void rt2800_config_txpower_rt28xx(struct rt2x00_dev *rt2x00dev,
>  	 * TODO: we do not use +6 dBm option to do not increase power beyond
>  	 * regulatory limit, however this could be utilized for devices with
>  	 * CAPABILITY_POWER_LIMIT.
> -	 *
> -	 * TODO: add different temperature compensation code for RT3290 & RT5390
> -	 * to allow to use BBP_R1 for those chips.
> -	 */
> -	if (!rt2x00_rt(rt2x00dev, RT3290) &&
> -	    !rt2x00_rt(rt2x00dev, RT5390)) {
> -		rt2800_bbp_read(rt2x00dev, 1, &r1);
> -		if (delta <= -12) {
> -			power_ctrl = 2;
> -			delta += 12;
> -		} else if (delta <= -6) {
> -			power_ctrl = 1;
> -			delta += 6;
> -		} else {
> -			power_ctrl = 0;
> -		}
> -		rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
> -		rt2800_bbp_write(rt2x00dev, 1, r1);
> +	 */
> +	if (delta <= -12) {
> +		power_ctrl = 2;
> +		delta += 12;
> +	} else if (delta <= -6) {
> +		power_ctrl = 1;
> +		delta += 6;
> +	} else {
> +		power_ctrl = 0;
>  	}
> +	rt2800_bbp_read(rt2x00dev, 1, &r1);
> +	rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
> +	rt2800_bbp_write(rt2x00dev, 1, r1);
>  
>  	offset = TX_PWR_CFG_0;
>  

> _______________________________________________
> users mailing list
> users@rt2x00.serialmonkey.com
> http://rt2x00.serialmonkey.com/mailman/listinfo/users_rt2x00.serialmonkey.com


-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [rt2x00-users] [PATCH] rt2800: fix RT5592 TX power settings regression
  2014-11-20 21:09   ` [rt2x00-users] " John W. Linville
@ 2014-11-21  9:39     ` Ronald Wahl
  2014-11-25 13:57       ` Stanislaw Gruszka
  0 siblings, 1 reply; 6+ messages in thread
From: Ronald Wahl @ 2014-11-21  9:39 UTC (permalink / raw)
  To: John W. Linville, Stanislaw Gruszka; +Cc: Mike Romberg, linux-wireless, users

For me the patch will work but there is a change for RT3290 and RT5390. 
On both chipsets BBP 1 was not written before but with this patch it is 
going to be written now and the value depends on the return of 
rt2800_get_txpower_bw_comp(). It should be checked that the function 
does the correct things for these chips.

- ron

On 20.11.2014 22:09, John W. Linville wrote:
> Any comments on this patch?  Ron, does it work for you?
>
> On Thu, Nov 06, 2014 at 11:27:53AM +0100, Stanislaw Gruszka wrote:
>> On Wed, Nov 05, 2014 at 06:03:30PM +0100, Ronald Wahl wrote:
>>> Commit cee2c7315f60beeff6137ee59e99acc77d636eeb (rt2800: fix RT5390 &
>>> RT3290 TX power settings regression) needs to be extended for the RT5592
>>> chipset as well. But at least for the RT5592 the existing regression fix is
>>> not right because the value returned from rt2800_get_gain_calibration_delta()
>>> is bogus as it is generated by an unappropriate algorithm. This can cause
>>> severe connection issues with sticks that have external ALC enabled like the
>>> Netis WF2150 because of too low TX power at least during the scan process.
>>>
>>> So the fix for now is not to call rt2800_get_gain_calibration_delta()
>>> for the RT5592 chipset. I do not touch the existing regression fix for
>>> RT5390 & RT3290 but I think they may need a rework as well.
>>
>> Thanks for the patch, but I prefer to call rt2800_get_gain_calibration_delta()
>> on chips that we know it is needed for them, something like in attached
>> patch
>>
>> Mike, since you are cee2c7315f reporter, could you test the attached patch
>> does not break driver functioning on your H/W.
>>
>> Thanks
>> Stanislaw
>>
>>
>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index 9f57a2d..81ee481 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -4119,7 +4119,20 @@ static void rt2800_config_txpower_rt28xx(struct rt2x00_dev *rt2x00dev,
>>   	 * expected. We adjust it, based on TSSI reference and boundaries values
>>   	 * provided in EEPROM.
>>   	 */
>> -	delta += rt2800_get_gain_calibration_delta(rt2x00dev);
>> +	switch (rt2x00dev->chip.rt) {
>> +	case RT2860:
>> +	case RT2872:
>> +	case RT2883:
>> +	case RT3070:
>> +	case RT3071:
>> +	case RT3090:
>> +	case RT3572:
>> +		delta += rt2800_get_gain_calibration_delta(rt2x00dev);
>> +		break;
>> +	default:
>> +		/* TODO: temperature compensation code for other chips. */
>> +		break;
>> +	}
>>
>>   	/*
>>   	 * Decrease power according to user settings, on devices with unknown
>> @@ -4136,25 +4149,19 @@ static void rt2800_config_txpower_rt28xx(struct rt2x00_dev *rt2x00dev,
>>   	 * TODO: we do not use +6 dBm option to do not increase power beyond
>>   	 * regulatory limit, however this could be utilized for devices with
>>   	 * CAPABILITY_POWER_LIMIT.
>> -	 *
>> -	 * TODO: add different temperature compensation code for RT3290 & RT5390
>> -	 * to allow to use BBP_R1 for those chips.
>> -	 */
>> -	if (!rt2x00_rt(rt2x00dev, RT3290) &&
>> -	    !rt2x00_rt(rt2x00dev, RT5390)) {
>> -		rt2800_bbp_read(rt2x00dev, 1, &r1);
>> -		if (delta <= -12) {
>> -			power_ctrl = 2;
>> -			delta += 12;
>> -		} else if (delta <= -6) {
>> -			power_ctrl = 1;
>> -			delta += 6;
>> -		} else {
>> -			power_ctrl = 0;
>> -		}
>> -		rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
>> -		rt2800_bbp_write(rt2x00dev, 1, r1);
>> +	 */
>> +	if (delta <= -12) {
>> +		power_ctrl = 2;
>> +		delta += 12;
>> +	} else if (delta <= -6) {
>> +		power_ctrl = 1;
>> +		delta += 6;
>> +	} else {
>> +		power_ctrl = 0;
>>   	}
>> +	rt2800_bbp_read(rt2x00dev, 1, &r1);
>> +	rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
>> +	rt2800_bbp_write(rt2x00dev, 1, r1);
>>
>>   	offset = TX_PWR_CFG_0;
>>
>
>> _______________________________________________
>> users mailing list
>> users@rt2x00.serialmonkey.com
>> http://rt2x00.serialmonkey.com/mailman/listinfo/users_rt2x00.serialmonkey.com
>
>

-- 
Ronald Wahl - ronald.wahl@raritan.com - Phone +49 375271349-0 Fax -99
Raritan Deutschland GmbH, Kornmarkt 7, 08056 Zwickau, Germany
USt-IdNr. DE813094160, Steuer-Nr. 227/117/01749
Amtsgericht Chemnitz HRB 23605
Geschäftsführung: Stuart Hopper, Ralf Ploenes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [rt2x00-users] [PATCH] rt2800: fix RT5592 TX power settings regression
  2014-11-21  9:39     ` Ronald Wahl
@ 2014-11-25 13:57       ` Stanislaw Gruszka
  2014-11-25 14:17         ` [PATCH] rt2800: calculate tx power temperature compensation on selected chips Stanislaw Gruszka
  0 siblings, 1 reply; 6+ messages in thread
From: Stanislaw Gruszka @ 2014-11-25 13:57 UTC (permalink / raw)
  To: Ronald Wahl; +Cc: John W. Linville, Mike Romberg, linux-wireless, users

On Fri, Nov 21, 2014 at 10:39:39AM +0100, Ronald Wahl wrote:
> For me the patch will work but there is a change for RT3290 and RT5390. On
> both chipsets BBP 1 was not written before but with this patch it is going
> to be written now and the value depends on the return of
> rt2800_get_txpower_bw_comp(). It should be checked that the function does
> the correct things for these chips.

I tested the patch on RT5390, it does not make troubles. Going to post
it ...

Stanislaw


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] rt2800: calculate tx power temperature compensation on selected chips
  2014-11-25 13:57       ` Stanislaw Gruszka
@ 2014-11-25 14:17         ` Stanislaw Gruszka
  0 siblings, 0 replies; 6+ messages in thread
From: Stanislaw Gruszka @ 2014-11-25 14:17 UTC (permalink / raw)
  To: Ronald Wahl, linux-wireless; +Cc: John W. Linville, Mike Romberg, users

Currently implemented temperature compensation is only valid on some of
supported chips. Other chips do not need temperature compensation or
need different way to do this (not yet implemented in the rt2800
driver). Trying to do run rt2800_get_gain_calibration_delta() when this
is not appropriate on particular chip gives bogus result of TX power
and can make connection unstable.

This is follow up to commit 8c8d2017ba25c510ddf093419048460db1109bc4
"rt2800: fix RT5390 & RT3290 TX power settings regression". On that
commit we avoid setting BBP_R1 register, but the real problem is wrong
temperature compensation calculation.

Reported-and-tested-by: Ronald Wahl <ronald.wahl@raritan.com>
Debugged-by: Ronald Wahl <ronald.wahl@raritan.com>
Cc: Mike Romberg <mike-romberg@comcast.net>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/rt2x00/rt2800lib.c | 45 +++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 9f57a2d..81ee481 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4119,7 +4119,20 @@ static void rt2800_config_txpower_rt28xx(struct rt2x00_dev *rt2x00dev,
 	 * expected. We adjust it, based on TSSI reference and boundaries values
 	 * provided in EEPROM.
 	 */
-	delta += rt2800_get_gain_calibration_delta(rt2x00dev);
+	switch (rt2x00dev->chip.rt) {
+	case RT2860:
+	case RT2872:
+	case RT2883:
+	case RT3070:
+	case RT3071:
+	case RT3090:
+	case RT3572:
+		delta += rt2800_get_gain_calibration_delta(rt2x00dev);
+		break;
+	default:
+		/* TODO: temperature compensation code for other chips. */
+		break;
+	}
 
 	/*
 	 * Decrease power according to user settings, on devices with unknown
@@ -4136,25 +4149,19 @@ static void rt2800_config_txpower_rt28xx(struct rt2x00_dev *rt2x00dev,
 	 * TODO: we do not use +6 dBm option to do not increase power beyond
 	 * regulatory limit, however this could be utilized for devices with
 	 * CAPABILITY_POWER_LIMIT.
-	 *
-	 * TODO: add different temperature compensation code for RT3290 & RT5390
-	 * to allow to use BBP_R1 for those chips.
-	 */
-	if (!rt2x00_rt(rt2x00dev, RT3290) &&
-	    !rt2x00_rt(rt2x00dev, RT5390)) {
-		rt2800_bbp_read(rt2x00dev, 1, &r1);
-		if (delta <= -12) {
-			power_ctrl = 2;
-			delta += 12;
-		} else if (delta <= -6) {
-			power_ctrl = 1;
-			delta += 6;
-		} else {
-			power_ctrl = 0;
-		}
-		rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
-		rt2800_bbp_write(rt2x00dev, 1, r1);
+	 */
+	if (delta <= -12) {
+		power_ctrl = 2;
+		delta += 12;
+	} else if (delta <= -6) {
+		power_ctrl = 1;
+		delta += 6;
+	} else {
+		power_ctrl = 0;
 	}
+	rt2800_bbp_read(rt2x00dev, 1, &r1);
+	rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
+	rt2800_bbp_write(rt2x00dev, 1, r1);
 
 	offset = TX_PWR_CFG_0;
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-11-25 14:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-05 17:03 [PATCH] rt2800: fix RT5592 TX power settings regression Ronald Wahl
2014-11-06 10:27 ` Stanislaw Gruszka
2014-11-20 21:09   ` [rt2x00-users] " John W. Linville
2014-11-21  9:39     ` Ronald Wahl
2014-11-25 13:57       ` Stanislaw Gruszka
2014-11-25 14:17         ` [PATCH] rt2800: calculate tx power temperature compensation on selected chips Stanislaw Gruszka

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