Return-path: Received: from mx1.redhat.com ([209.132.183.28]:45429 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752384AbaKFKaw (ORCPT ); Thu, 6 Nov 2014 05:30:52 -0500 Date: Thu, 6 Nov 2014 11:27:53 +0100 From: Stanislaw Gruszka To: Ronald Wahl Cc: users@rt2x00.serialmonkey.com, linux-wireless@vger.kernel.org, Mike Romberg Subject: Re: [PATCH] rt2800: fix RT5592 TX power settings regression Message-ID: <20141106102753.GA1891@redhat.com> (sfid-20141106_113059_128646_E44DDBD1) References: <1415207010-9622-1-git-send-email-ronald.wahl@raritan.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Qxx1br4bt0+wmkIi" In-Reply-To: <1415207010-9622-1-git-send-email-ronald.wahl@raritan.com> Sender: linux-wireless-owner@vger.kernel.org List-ID: --Qxx1br4bt0+wmkIi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --Qxx1br4bt0+wmkIi Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="rt2800.diff" 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; --Qxx1br4bt0+wmkIi--