diff options
author | Mohammed Shafi Shajakhan <mshajakhan@atheros.com> | 2011-05-13 11:01:23 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-05-16 14:10:47 -0400 |
commit | 3e9a212a9e21266115bad2982016950fb2bf29c2 (patch) | |
tree | 51fc37e96001d0512dcea7717a1f40973ec5b817 /drivers/net/wireless/ath | |
parent | b85c5734f00886ee0f33ef4d0038ed9a278eefce (diff) |
ath9k: configure fast_div_bias based on diversity group
configure fast diversity bias based on the antenna diversity group and
based on main/alt LNA configurations. also configure main antenna and
alternate antenna to gain-table 0 for diversity group 2(AR9485)
Cc: Gabriel Tseng <Gabriel.Tseng@Atheros.com>
Cc: Senthilkumar Balasubramanian <Senthilkumar.Balasubramanian@Atheros.com>
Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/recv.c | 174 |
1 files changed, 131 insertions, 43 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 47e0fc1aaba3..2fecfcb78106 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -1317,49 +1317,138 @@ static void ath_select_ant_div_from_quick_scan(struct ath_ant_comb *antcomb, | |||
1317 | } | 1317 | } |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | static void ath_ant_div_conf_fast_divbias(struct ath_hw_antcomb_conf *ant_conf) | 1320 | static void ath_ant_div_conf_fast_divbias(struct ath_hw_antcomb_conf *ant_conf, |
1321 | struct ath_ant_comb *antcomb, int alt_ratio) | ||
1321 | { | 1322 | { |
1322 | /* Adjust the fast_div_bias based on main and alt lna conf */ | 1323 | if (ant_conf->div_group == 0) { |
1323 | switch ((ant_conf->main_lna_conf << 4) | ant_conf->alt_lna_conf) { | 1324 | /* Adjust the fast_div_bias based on main and alt lna conf */ |
1324 | case (0x01): /* A-B LNA2 */ | 1325 | switch ((ant_conf->main_lna_conf << 4) | |
1325 | ant_conf->fast_div_bias = 0x3b; | 1326 | ant_conf->alt_lna_conf) { |
1326 | break; | 1327 | case (0x01): /* A-B LNA2 */ |
1327 | case (0x02): /* A-B LNA1 */ | 1328 | ant_conf->fast_div_bias = 0x3b; |
1328 | ant_conf->fast_div_bias = 0x3d; | 1329 | break; |
1329 | break; | 1330 | case (0x02): /* A-B LNA1 */ |
1330 | case (0x03): /* A-B A+B */ | 1331 | ant_conf->fast_div_bias = 0x3d; |
1331 | ant_conf->fast_div_bias = 0x1; | 1332 | break; |
1332 | break; | 1333 | case (0x03): /* A-B A+B */ |
1333 | case (0x10): /* LNA2 A-B */ | 1334 | ant_conf->fast_div_bias = 0x1; |
1334 | ant_conf->fast_div_bias = 0x7; | 1335 | break; |
1335 | break; | 1336 | case (0x10): /* LNA2 A-B */ |
1336 | case (0x12): /* LNA2 LNA1 */ | 1337 | ant_conf->fast_div_bias = 0x7; |
1337 | ant_conf->fast_div_bias = 0x2; | 1338 | break; |
1338 | break; | 1339 | case (0x12): /* LNA2 LNA1 */ |
1339 | case (0x13): /* LNA2 A+B */ | 1340 | ant_conf->fast_div_bias = 0x2; |
1340 | ant_conf->fast_div_bias = 0x7; | 1341 | break; |
1341 | break; | 1342 | case (0x13): /* LNA2 A+B */ |
1342 | case (0x20): /* LNA1 A-B */ | 1343 | ant_conf->fast_div_bias = 0x7; |
1343 | ant_conf->fast_div_bias = 0x6; | 1344 | break; |
1344 | break; | 1345 | case (0x20): /* LNA1 A-B */ |
1345 | case (0x21): /* LNA1 LNA2 */ | 1346 | ant_conf->fast_div_bias = 0x6; |
1346 | ant_conf->fast_div_bias = 0x0; | 1347 | break; |
1347 | break; | 1348 | case (0x21): /* LNA1 LNA2 */ |
1348 | case (0x23): /* LNA1 A+B */ | 1349 | ant_conf->fast_div_bias = 0x0; |
1349 | ant_conf->fast_div_bias = 0x6; | 1350 | break; |
1350 | break; | 1351 | case (0x23): /* LNA1 A+B */ |
1351 | case (0x30): /* A+B A-B */ | 1352 | ant_conf->fast_div_bias = 0x6; |
1352 | ant_conf->fast_div_bias = 0x1; | 1353 | break; |
1353 | break; | 1354 | case (0x30): /* A+B A-B */ |
1354 | case (0x31): /* A+B LNA2 */ | 1355 | ant_conf->fast_div_bias = 0x1; |
1355 | ant_conf->fast_div_bias = 0x3b; | 1356 | break; |
1356 | break; | 1357 | case (0x31): /* A+B LNA2 */ |
1357 | case (0x32): /* A+B LNA1 */ | 1358 | ant_conf->fast_div_bias = 0x3b; |
1358 | ant_conf->fast_div_bias = 0x3d; | 1359 | break; |
1359 | break; | 1360 | case (0x32): /* A+B LNA1 */ |
1360 | default: | 1361 | ant_conf->fast_div_bias = 0x3d; |
1361 | break; | 1362 | break; |
1363 | default: | ||
1364 | break; | ||
1365 | } | ||
1366 | } else if (ant_conf->div_group == 2) { | ||
1367 | /* Adjust the fast_div_bias based on main and alt_lna_conf */ | ||
1368 | switch ((ant_conf->main_lna_conf << 4) | | ||
1369 | ant_conf->alt_lna_conf) { | ||
1370 | case (0x01): /* A-B LNA2 */ | ||
1371 | ant_conf->fast_div_bias = 0x1; | ||
1372 | ant_conf->main_gaintb = 0; | ||
1373 | ant_conf->alt_gaintb = 0; | ||
1374 | break; | ||
1375 | case (0x02): /* A-B LNA1 */ | ||
1376 | ant_conf->fast_div_bias = 0x1; | ||
1377 | ant_conf->main_gaintb = 0; | ||
1378 | ant_conf->alt_gaintb = 0; | ||
1379 | break; | ||
1380 | case (0x03): /* A-B A+B */ | ||
1381 | ant_conf->fast_div_bias = 0x1; | ||
1382 | ant_conf->main_gaintb = 0; | ||
1383 | ant_conf->alt_gaintb = 0; | ||
1384 | break; | ||
1385 | case (0x10): /* LNA2 A-B */ | ||
1386 | if (!(antcomb->scan) && | ||
1387 | (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) | ||
1388 | ant_conf->fast_div_bias = 0x1; | ||
1389 | else | ||
1390 | ant_conf->fast_div_bias = 0x2; | ||
1391 | ant_conf->main_gaintb = 0; | ||
1392 | ant_conf->alt_gaintb = 0; | ||
1393 | break; | ||
1394 | case (0x12): /* LNA2 LNA1 */ | ||
1395 | ant_conf->fast_div_bias = 0x1; | ||
1396 | ant_conf->main_gaintb = 0; | ||
1397 | ant_conf->alt_gaintb = 0; | ||
1398 | break; | ||
1399 | case (0x13): /* LNA2 A+B */ | ||
1400 | if (!(antcomb->scan) && | ||
1401 | (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) | ||
1402 | ant_conf->fast_div_bias = 0x1; | ||
1403 | else | ||
1404 | ant_conf->fast_div_bias = 0x2; | ||
1405 | ant_conf->main_gaintb = 0; | ||
1406 | ant_conf->alt_gaintb = 0; | ||
1407 | break; | ||
1408 | case (0x20): /* LNA1 A-B */ | ||
1409 | if (!(antcomb->scan) && | ||
1410 | (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) | ||
1411 | ant_conf->fast_div_bias = 0x1; | ||
1412 | else | ||
1413 | ant_conf->fast_div_bias = 0x2; | ||
1414 | ant_conf->main_gaintb = 0; | ||
1415 | ant_conf->alt_gaintb = 0; | ||
1416 | break; | ||
1417 | case (0x21): /* LNA1 LNA2 */ | ||
1418 | ant_conf->fast_div_bias = 0x1; | ||
1419 | ant_conf->main_gaintb = 0; | ||
1420 | ant_conf->alt_gaintb = 0; | ||
1421 | break; | ||
1422 | case (0x23): /* LNA1 A+B */ | ||
1423 | if (!(antcomb->scan) && | ||
1424 | (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) | ||
1425 | ant_conf->fast_div_bias = 0x1; | ||
1426 | else | ||
1427 | ant_conf->fast_div_bias = 0x2; | ||
1428 | ant_conf->main_gaintb = 0; | ||
1429 | ant_conf->alt_gaintb = 0; | ||
1430 | break; | ||
1431 | case (0x30): /* A+B A-B */ | ||
1432 | ant_conf->fast_div_bias = 0x1; | ||
1433 | ant_conf->main_gaintb = 0; | ||
1434 | ant_conf->alt_gaintb = 0; | ||
1435 | break; | ||
1436 | case (0x31): /* A+B LNA2 */ | ||
1437 | ant_conf->fast_div_bias = 0x1; | ||
1438 | ant_conf->main_gaintb = 0; | ||
1439 | ant_conf->alt_gaintb = 0; | ||
1440 | break; | ||
1441 | case (0x32): /* A+B LNA1 */ | ||
1442 | ant_conf->fast_div_bias = 0x1; | ||
1443 | ant_conf->main_gaintb = 0; | ||
1444 | ant_conf->alt_gaintb = 0; | ||
1445 | break; | ||
1446 | default: | ||
1447 | break; | ||
1448 | } | ||
1449 | |||
1362 | } | 1450 | } |
1451 | |||
1363 | } | 1452 | } |
1364 | 1453 | ||
1365 | /* Antenna diversity and combining */ | 1454 | /* Antenna diversity and combining */ |
@@ -1585,8 +1674,7 @@ static void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs) | |||
1585 | antcomb->quick_scan_cnt++; | 1674 | antcomb->quick_scan_cnt++; |
1586 | 1675 | ||
1587 | div_comb_done: | 1676 | div_comb_done: |
1588 | ath_ant_div_conf_fast_divbias(&div_ant_conf); | 1677 | ath_ant_div_conf_fast_divbias(&div_ant_conf, antcomb, alt_ratio); |
1589 | |||
1590 | ath9k_hw_antdiv_comb_conf_set(sc->sc_ah, &div_ant_conf); | 1678 | ath9k_hw_antdiv_comb_conf_set(sc->sc_ah, &div_ant_conf); |
1591 | 1679 | ||
1592 | antcomb->scan_start_time = jiffies; | 1680 | antcomb->scan_start_time = jiffies; |