aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2014-11-25 09:17:29 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-12-01 15:57:20 -0500
commit87dd2d76a94b310c173943a7de9a8b6598af0c78 (patch)
treedb2aab20e227cb641a1576320b5f1f5f876f7e4c
parent8e09b7d2dbb86eb3e9a714d6622f4da24e988029 (diff)
rt2800: calculate tx power temperature compensation on selected chips
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> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 9f57a2db791c..81ee481487cf 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,
4119 * expected. We adjust it, based on TSSI reference and boundaries values 4119 * expected. We adjust it, based on TSSI reference and boundaries values
4120 * provided in EEPROM. 4120 * provided in EEPROM.
4121 */ 4121 */
4122 delta += rt2800_get_gain_calibration_delta(rt2x00dev); 4122 switch (rt2x00dev->chip.rt) {
4123 case RT2860:
4124 case RT2872:
4125 case RT2883:
4126 case RT3070:
4127 case RT3071:
4128 case RT3090:
4129 case RT3572:
4130 delta += rt2800_get_gain_calibration_delta(rt2x00dev);
4131 break;
4132 default:
4133 /* TODO: temperature compensation code for other chips. */
4134 break;
4135 }
4123 4136
4124 /* 4137 /*
4125 * Decrease power according to user settings, on devices with unknown 4138 * Decrease power according to user settings, on devices with unknown
@@ -4136,25 +4149,19 @@ static void rt2800_config_txpower_rt28xx(struct rt2x00_dev *rt2x00dev,
4136 * TODO: we do not use +6 dBm option to do not increase power beyond 4149 * TODO: we do not use +6 dBm option to do not increase power beyond
4137 * regulatory limit, however this could be utilized for devices with 4150 * regulatory limit, however this could be utilized for devices with
4138 * CAPABILITY_POWER_LIMIT. 4151 * CAPABILITY_POWER_LIMIT.
4139 * 4152 */
4140 * TODO: add different temperature compensation code for RT3290 & RT5390 4153 if (delta <= -12) {
4141 * to allow to use BBP_R1 for those chips. 4154 power_ctrl = 2;
4142 */ 4155 delta += 12;
4143 if (!rt2x00_rt(rt2x00dev, RT3290) && 4156 } else if (delta <= -6) {
4144 !rt2x00_rt(rt2x00dev, RT5390)) { 4157 power_ctrl = 1;
4145 rt2800_bbp_read(rt2x00dev, 1, &r1); 4158 delta += 6;
4146 if (delta <= -12) { 4159 } else {
4147 power_ctrl = 2; 4160 power_ctrl = 0;
4148 delta += 12;
4149 } else if (delta <= -6) {
4150 power_ctrl = 1;
4151 delta += 6;
4152 } else {
4153 power_ctrl = 0;
4154 }
4155 rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
4156 rt2800_bbp_write(rt2x00dev, 1, r1);
4157 } 4161 }
4162 rt2800_bbp_read(rt2x00dev, 1, &r1);
4163 rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl);
4164 rt2800_bbp_write(rt2x00dev, 1, r1);
4158 4165
4159 offset = TX_PWR_CFG_0; 4166 offset = TX_PWR_CFG_0;
4160 4167