aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSenthil Balasubramanian <senthilb@qca.qualcomm.com>2011-09-13 13:08:17 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-16 16:45:32 -0400
commit4d0707e66d82f46998d49be98adea0e705647be1 (patch)
tree18c44e67a8c4a95821f90d4801a913de626f3129 /drivers
parentce407afc1008a67969ae05717e86dcee9ce5de76 (diff)
ath9k_hw: Split tx/rx gain table initval handling
Split tx/rx gain table initval hanlding part so readability is better and easy to manage the code. Signed-off-by: Senthil Balasubramanian <senthilb@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_hw.c390
1 files changed, 210 insertions, 180 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
index b6839e69527..6b54700eff5 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
@@ -374,208 +374,238 @@ static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
374 } 374 }
375} 375}
376 376
377static void ar9003_tx_gain_table_mode0(struct ath_hw *ah)
378{
379 if (AR_SREV_9330_12(ah))
380 INIT_INI_ARRAY(&ah->iniModesTxGain,
381 ar9331_modes_lowest_ob_db_tx_gain_1p2,
382 ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p2),
383 5);
384 else if (AR_SREV_9330_11(ah))
385 INIT_INI_ARRAY(&ah->iniModesTxGain,
386 ar9331_modes_lowest_ob_db_tx_gain_1p1,
387 ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p1),
388 5);
389 else if (AR_SREV_9340(ah))
390 INIT_INI_ARRAY(&ah->iniModesTxGain,
391 ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
392 ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
393 5);
394 else if (AR_SREV_9485_11(ah))
395 INIT_INI_ARRAY(&ah->iniModesTxGain,
396 ar9485_modes_lowest_ob_db_tx_gain_1_1,
397 ARRAY_SIZE(ar9485_modes_lowest_ob_db_tx_gain_1_1),
398 5);
399 else if (AR_SREV_9580(ah))
400 INIT_INI_ARRAY(&ah->iniModesTxGain,
401 ar9580_1p0_lowest_ob_db_tx_gain_table,
402 ARRAY_SIZE(ar9580_1p0_lowest_ob_db_tx_gain_table),
403 5);
404 else
405 INIT_INI_ARRAY(&ah->iniModesTxGain,
406 ar9300Modes_lowest_ob_db_tx_gain_table_2p2,
407 ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2),
408 5);
409}
410
411static void ar9003_tx_gain_table_mode1(struct ath_hw *ah)
412{
413 if (AR_SREV_9330_12(ah))
414 INIT_INI_ARRAY(&ah->iniModesTxGain,
415 ar9331_modes_high_ob_db_tx_gain_1p2,
416 ARRAY_SIZE(ar9331_modes_high_ob_db_tx_gain_1p2),
417 5);
418 else if (AR_SREV_9330_11(ah))
419 INIT_INI_ARRAY(&ah->iniModesTxGain,
420 ar9331_modes_high_ob_db_tx_gain_1p1,
421 ARRAY_SIZE(ar9331_modes_high_ob_db_tx_gain_1p1),
422 5);
423 else if (AR_SREV_9340(ah))
424 INIT_INI_ARRAY(&ah->iniModesTxGain,
425 ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
426 ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
427 5);
428 else if (AR_SREV_9485_11(ah))
429 INIT_INI_ARRAY(&ah->iniModesTxGain,
430 ar9485Modes_high_ob_db_tx_gain_1_1,
431 ARRAY_SIZE(ar9485Modes_high_ob_db_tx_gain_1_1),
432 5);
433 else if (AR_SREV_9580(ah))
434 INIT_INI_ARRAY(&ah->iniModesTxGain,
435 ar9580_1p0_high_ob_db_tx_gain_table,
436 ARRAY_SIZE(ar9580_1p0_high_ob_db_tx_gain_table),
437 5);
438 else
439 INIT_INI_ARRAY(&ah->iniModesTxGain,
440 ar9300Modes_high_ob_db_tx_gain_table_2p2,
441 ARRAY_SIZE(ar9300Modes_high_ob_db_tx_gain_table_2p2),
442 5);
443}
444
445static void ar9003_tx_gain_table_mode2(struct ath_hw *ah)
446{
447 if (AR_SREV_9330_12(ah))
448 INIT_INI_ARRAY(&ah->iniModesTxGain,
449 ar9331_modes_low_ob_db_tx_gain_1p2,
450 ARRAY_SIZE(ar9331_modes_low_ob_db_tx_gain_1p2),
451 5);
452 else if (AR_SREV_9330_11(ah))
453 INIT_INI_ARRAY(&ah->iniModesTxGain,
454 ar9331_modes_low_ob_db_tx_gain_1p1,
455 ARRAY_SIZE(ar9331_modes_low_ob_db_tx_gain_1p1),
456 5);
457 else if (AR_SREV_9340(ah))
458 INIT_INI_ARRAY(&ah->iniModesTxGain,
459 ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
460 ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
461 5);
462 else if (AR_SREV_9485_11(ah))
463 INIT_INI_ARRAY(&ah->iniModesTxGain,
464 ar9485Modes_low_ob_db_tx_gain_1_1,
465 ARRAY_SIZE(ar9485Modes_low_ob_db_tx_gain_1_1),
466 5);
467 else if (AR_SREV_9580(ah))
468 INIT_INI_ARRAY(&ah->iniModesTxGain,
469 ar9580_1p0_low_ob_db_tx_gain_table,
470 ARRAY_SIZE(ar9580_1p0_low_ob_db_tx_gain_table),
471 5);
472 else
473 INIT_INI_ARRAY(&ah->iniModesTxGain,
474 ar9300Modes_low_ob_db_tx_gain_table_2p2,
475 ARRAY_SIZE(ar9300Modes_low_ob_db_tx_gain_table_2p2),
476 5);
477}
478
479static void ar9003_tx_gain_table_mode3(struct ath_hw *ah)
480{
481 if (AR_SREV_9330_12(ah))
482 INIT_INI_ARRAY(&ah->iniModesTxGain,
483 ar9331_modes_high_power_tx_gain_1p2,
484 ARRAY_SIZE(ar9331_modes_high_power_tx_gain_1p2),
485 5);
486 else if (AR_SREV_9330_11(ah))
487 INIT_INI_ARRAY(&ah->iniModesTxGain,
488 ar9331_modes_high_power_tx_gain_1p1,
489 ARRAY_SIZE(ar9331_modes_high_power_tx_gain_1p1),
490 5);
491 else if (AR_SREV_9340(ah))
492 INIT_INI_ARRAY(&ah->iniModesTxGain,
493 ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
494 ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
495 5);
496 else if (AR_SREV_9485_11(ah))
497 INIT_INI_ARRAY(&ah->iniModesTxGain,
498 ar9485Modes_high_power_tx_gain_1_1,
499 ARRAY_SIZE(ar9485Modes_high_power_tx_gain_1_1),
500 5);
501 else if (AR_SREV_9580(ah))
502 INIT_INI_ARRAY(&ah->iniModesTxGain,
503 ar9580_1p0_high_power_tx_gain_table,
504 ARRAY_SIZE(ar9580_1p0_high_power_tx_gain_table),
505 5);
506 else
507 INIT_INI_ARRAY(&ah->iniModesTxGain,
508 ar9300Modes_high_power_tx_gain_table_2p2,
509 ARRAY_SIZE(ar9300Modes_high_power_tx_gain_table_2p2),
510 5);
511}
512
377static void ar9003_tx_gain_table_apply(struct ath_hw *ah) 513static void ar9003_tx_gain_table_apply(struct ath_hw *ah)
378{ 514{
379 switch (ar9003_hw_get_tx_gain_idx(ah)) { 515 switch (ar9003_hw_get_tx_gain_idx(ah)) {
380 case 0: 516 case 0:
381 default: 517 default:
382 if (AR_SREV_9330_12(ah)) 518 ar9003_tx_gain_table_mode0(ah);
383 INIT_INI_ARRAY(&ah->iniModesTxGain,
384 ar9331_modes_lowest_ob_db_tx_gain_1p2,
385 ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p2),
386 5);
387 else if (AR_SREV_9330_11(ah))
388 INIT_INI_ARRAY(&ah->iniModesTxGain,
389 ar9331_modes_lowest_ob_db_tx_gain_1p1,
390 ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p1),
391 5);
392 else if (AR_SREV_9340(ah))
393 INIT_INI_ARRAY(&ah->iniModesTxGain,
394 ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
395 ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
396 5);
397 else if (AR_SREV_9485_11(ah))
398 INIT_INI_ARRAY(&ah->iniModesTxGain,
399 ar9485_modes_lowest_ob_db_tx_gain_1_1,
400 ARRAY_SIZE(ar9485_modes_lowest_ob_db_tx_gain_1_1),
401 5);
402 else if (AR_SREV_9580(ah))
403 INIT_INI_ARRAY(&ah->iniModesTxGain,
404 ar9580_1p0_lowest_ob_db_tx_gain_table,
405 ARRAY_SIZE(ar9580_1p0_lowest_ob_db_tx_gain_table),
406 5);
407 else
408 INIT_INI_ARRAY(&ah->iniModesTxGain,
409 ar9300Modes_lowest_ob_db_tx_gain_table_2p2,
410 ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2),
411 5);
412 break; 519 break;
413 case 1: 520 case 1:
414 if (AR_SREV_9330_12(ah)) 521 ar9003_tx_gain_table_mode1(ah);
415 INIT_INI_ARRAY(&ah->iniModesTxGain,
416 ar9331_modes_high_ob_db_tx_gain_1p2,
417 ARRAY_SIZE(ar9331_modes_high_ob_db_tx_gain_1p2),
418 5);
419 else if (AR_SREV_9330_11(ah))
420 INIT_INI_ARRAY(&ah->iniModesTxGain,
421 ar9331_modes_high_ob_db_tx_gain_1p1,
422 ARRAY_SIZE(ar9331_modes_high_ob_db_tx_gain_1p1),
423 5);
424 else if (AR_SREV_9340(ah))
425 INIT_INI_ARRAY(&ah->iniModesTxGain,
426 ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
427 ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
428 5);
429 else if (AR_SREV_9485_11(ah))
430 INIT_INI_ARRAY(&ah->iniModesTxGain,
431 ar9485Modes_high_ob_db_tx_gain_1_1,
432 ARRAY_SIZE(ar9485Modes_high_ob_db_tx_gain_1_1),
433 5);
434 else if (AR_SREV_9580(ah))
435 INIT_INI_ARRAY(&ah->iniModesTxGain,
436 ar9580_1p0_high_ob_db_tx_gain_table,
437 ARRAY_SIZE(ar9580_1p0_high_ob_db_tx_gain_table),
438 5);
439 else
440 INIT_INI_ARRAY(&ah->iniModesTxGain,
441 ar9300Modes_high_ob_db_tx_gain_table_2p2,
442 ARRAY_SIZE(ar9300Modes_high_ob_db_tx_gain_table_2p2),
443 5);
444 break; 522 break;
445 case 2: 523 case 2:
446 if (AR_SREV_9330_12(ah)) 524 ar9003_tx_gain_table_mode2(ah);
447 INIT_INI_ARRAY(&ah->iniModesTxGain,
448 ar9331_modes_low_ob_db_tx_gain_1p2,
449 ARRAY_SIZE(ar9331_modes_low_ob_db_tx_gain_1p2),
450 5);
451 else if (AR_SREV_9330_11(ah))
452 INIT_INI_ARRAY(&ah->iniModesTxGain,
453 ar9331_modes_low_ob_db_tx_gain_1p1,
454 ARRAY_SIZE(ar9331_modes_low_ob_db_tx_gain_1p1),
455 5);
456 else if (AR_SREV_9340(ah))
457 INIT_INI_ARRAY(&ah->iniModesTxGain,
458 ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
459 ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
460 5);
461 else if (AR_SREV_9485_11(ah))
462 INIT_INI_ARRAY(&ah->iniModesTxGain,
463 ar9485Modes_low_ob_db_tx_gain_1_1,
464 ARRAY_SIZE(ar9485Modes_low_ob_db_tx_gain_1_1),
465 5);
466 else if (AR_SREV_9580(ah))
467 INIT_INI_ARRAY(&ah->iniModesTxGain,
468 ar9580_1p0_low_ob_db_tx_gain_table,
469 ARRAY_SIZE(ar9580_1p0_low_ob_db_tx_gain_table),
470 5);
471 else
472 INIT_INI_ARRAY(&ah->iniModesTxGain,
473 ar9300Modes_low_ob_db_tx_gain_table_2p2,
474 ARRAY_SIZE(ar9300Modes_low_ob_db_tx_gain_table_2p2),
475 5);
476 break; 525 break;
477 case 3: 526 case 3:
478 if (AR_SREV_9330_12(ah)) 527 ar9003_tx_gain_table_mode3(ah);
479 INIT_INI_ARRAY(&ah->iniModesTxGain,
480 ar9331_modes_high_power_tx_gain_1p2,
481 ARRAY_SIZE(ar9331_modes_high_power_tx_gain_1p2),
482 5);
483 else if (AR_SREV_9330_11(ah))
484 INIT_INI_ARRAY(&ah->iniModesTxGain,
485 ar9331_modes_high_power_tx_gain_1p1,
486 ARRAY_SIZE(ar9331_modes_high_power_tx_gain_1p1),
487 5);
488 else if (AR_SREV_9340(ah))
489 INIT_INI_ARRAY(&ah->iniModesTxGain,
490 ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
491 ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
492 5);
493 else if (AR_SREV_9485_11(ah))
494 INIT_INI_ARRAY(&ah->iniModesTxGain,
495 ar9485Modes_high_power_tx_gain_1_1,
496 ARRAY_SIZE(ar9485Modes_high_power_tx_gain_1_1),
497 5);
498 else if (AR_SREV_9580(ah))
499 INIT_INI_ARRAY(&ah->iniModesTxGain,
500 ar9580_1p0_high_power_tx_gain_table,
501 ARRAY_SIZE(ar9580_1p0_high_power_tx_gain_table),
502 5);
503 else
504 INIT_INI_ARRAY(&ah->iniModesTxGain,
505 ar9300Modes_high_power_tx_gain_table_2p2,
506 ARRAY_SIZE(ar9300Modes_high_power_tx_gain_table_2p2),
507 5);
508 break; 528 break;
509 } 529 }
510} 530}
511 531
532static void ar9003_rx_gain_table_mode0(struct ath_hw *ah)
533{
534 if (AR_SREV_9330_12(ah))
535 INIT_INI_ARRAY(&ah->iniModesRxGain,
536 ar9331_common_rx_gain_1p2,
537 ARRAY_SIZE(ar9331_common_rx_gain_1p2),
538 2);
539 else if (AR_SREV_9330_11(ah))
540 INIT_INI_ARRAY(&ah->iniModesRxGain,
541 ar9331_common_rx_gain_1p1,
542 ARRAY_SIZE(ar9331_common_rx_gain_1p1),
543 2);
544 else if (AR_SREV_9340(ah))
545 INIT_INI_ARRAY(&ah->iniModesRxGain,
546 ar9340Common_rx_gain_table_1p0,
547 ARRAY_SIZE(ar9340Common_rx_gain_table_1p0),
548 2);
549 else if (AR_SREV_9485_11(ah))
550 INIT_INI_ARRAY(&ah->iniModesRxGain,
551 ar9485Common_wo_xlna_rx_gain_1_1,
552 ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1),
553 2);
554 else if (AR_SREV_9580(ah))
555 INIT_INI_ARRAY(&ah->iniModesRxGain,
556 ar9580_1p0_rx_gain_table,
557 ARRAY_SIZE(ar9580_1p0_rx_gain_table),
558 2);
559 else
560 INIT_INI_ARRAY(&ah->iniModesRxGain,
561 ar9300Common_rx_gain_table_2p2,
562 ARRAY_SIZE(ar9300Common_rx_gain_table_2p2),
563 2);
564}
565
566static void ar9003_rx_gain_table_mode1(struct ath_hw *ah)
567{
568 if (AR_SREV_9330_12(ah))
569 INIT_INI_ARRAY(&ah->iniModesRxGain,
570 ar9331_common_wo_xlna_rx_gain_1p2,
571 ARRAY_SIZE(ar9331_common_wo_xlna_rx_gain_1p2),
572 2);
573 else if (AR_SREV_9330_11(ah))
574 INIT_INI_ARRAY(&ah->iniModesRxGain,
575 ar9331_common_wo_xlna_rx_gain_1p1,
576 ARRAY_SIZE(ar9331_common_wo_xlna_rx_gain_1p1),
577 2);
578 else if (AR_SREV_9340(ah))
579 INIT_INI_ARRAY(&ah->iniModesRxGain,
580 ar9340Common_wo_xlna_rx_gain_table_1p0,
581 ARRAY_SIZE(ar9340Common_wo_xlna_rx_gain_table_1p0),
582 2);
583 else if (AR_SREV_9485_11(ah))
584 INIT_INI_ARRAY(&ah->iniModesRxGain,
585 ar9485Common_wo_xlna_rx_gain_1_1,
586 ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1),
587 2);
588 else if (AR_SREV_9580(ah))
589 INIT_INI_ARRAY(&ah->iniModesRxGain,
590 ar9580_1p0_wo_xlna_rx_gain_table,
591 ARRAY_SIZE(ar9580_1p0_wo_xlna_rx_gain_table),
592 2);
593 else
594 INIT_INI_ARRAY(&ah->iniModesRxGain,
595 ar9300Common_wo_xlna_rx_gain_table_2p2,
596 ARRAY_SIZE(ar9300Common_wo_xlna_rx_gain_table_2p2),
597 2);
598}
599
512static void ar9003_rx_gain_table_apply(struct ath_hw *ah) 600static void ar9003_rx_gain_table_apply(struct ath_hw *ah)
513{ 601{
514 switch (ar9003_hw_get_rx_gain_idx(ah)) { 602 switch (ar9003_hw_get_rx_gain_idx(ah)) {
515 case 0: 603 case 0:
516 default: 604 default:
517 if (AR_SREV_9330_12(ah)) 605 ar9003_rx_gain_table_mode0(ah);
518 INIT_INI_ARRAY(&ah->iniModesRxGain,
519 ar9331_common_rx_gain_1p2,
520 ARRAY_SIZE(ar9331_common_rx_gain_1p2),
521 2);
522 else if (AR_SREV_9330_11(ah))
523 INIT_INI_ARRAY(&ah->iniModesRxGain,
524 ar9331_common_rx_gain_1p1,
525 ARRAY_SIZE(ar9331_common_rx_gain_1p1),
526 2);
527 else if (AR_SREV_9340(ah))
528 INIT_INI_ARRAY(&ah->iniModesRxGain,
529 ar9340Common_rx_gain_table_1p0,
530 ARRAY_SIZE(ar9340Common_rx_gain_table_1p0),
531 2);
532 else if (AR_SREV_9485_11(ah))
533 INIT_INI_ARRAY(&ah->iniModesRxGain,
534 ar9485Common_wo_xlna_rx_gain_1_1,
535 ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1),
536 2);
537 else if (AR_SREV_9580(ah))
538 INIT_INI_ARRAY(&ah->iniModesRxGain,
539 ar9580_1p0_rx_gain_table,
540 ARRAY_SIZE(ar9580_1p0_rx_gain_table),
541 2);
542 else
543 INIT_INI_ARRAY(&ah->iniModesRxGain,
544 ar9300Common_rx_gain_table_2p2,
545 ARRAY_SIZE(ar9300Common_rx_gain_table_2p2),
546 2);
547 break; 606 break;
548 case 1: 607 case 1:
549 if (AR_SREV_9330_12(ah)) 608 ar9003_rx_gain_table_mode1(ah);
550 INIT_INI_ARRAY(&ah->iniModesRxGain,
551 ar9331_common_wo_xlna_rx_gain_1p2,
552 ARRAY_SIZE(ar9331_common_wo_xlna_rx_gain_1p2),
553 2);
554 else if (AR_SREV_9330_11(ah))
555 INIT_INI_ARRAY(&ah->iniModesRxGain,
556 ar9331_common_wo_xlna_rx_gain_1p1,
557 ARRAY_SIZE(ar9331_common_wo_xlna_rx_gain_1p1),
558 2);
559 else if (AR_SREV_9340(ah))
560 INIT_INI_ARRAY(&ah->iniModesRxGain,
561 ar9340Common_wo_xlna_rx_gain_table_1p0,
562 ARRAY_SIZE(ar9340Common_wo_xlna_rx_gain_table_1p0),
563 2);
564 else if (AR_SREV_9485_11(ah))
565 INIT_INI_ARRAY(&ah->iniModesRxGain,
566 ar9485Common_wo_xlna_rx_gain_1_1,
567 ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1),
568 2);
569 else if (AR_SREV_9580(ah))
570 INIT_INI_ARRAY(&ah->iniModesRxGain,
571 ar9580_1p0_wo_xlna_rx_gain_table,
572 ARRAY_SIZE(ar9580_1p0_wo_xlna_rx_gain_table),
573 2);
574 else
575 INIT_INI_ARRAY(&ah->iniModesRxGain,
576 ar9300Common_wo_xlna_rx_gain_table_2p2,
577 ARRAY_SIZE(ar9300Common_wo_xlna_rx_gain_table_2p2),
578 2);
579 break; 609 break;
580 } 610 }
581} 611}