diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2011-02-11 15:27:58 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-02-11 16:16:38 -0500 |
commit | a3dc5e881a8a5199bf371fdd4530cfa18280ca83 (patch) | |
tree | 438320663f6dfc593a61af69c9b14afc4416813d /drivers/net/wireless/rtlwifi | |
parent | 25b2bc30865e3ca1a9a2116788bb2e82be5b1a99 (diff) |
rtlwifi: rtl8192ce: Rework rtl8192ce/phy.c
Make the phy.c codes for rtl8192ce and rtl8192cu be as alike as possible.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi')
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192ce/phy.c | 99 |
1 files changed, 35 insertions, 64 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c index 45044117139a..05f7a45b30e1 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c | |||
@@ -37,6 +37,9 @@ | |||
37 | #include "dm.h" | 37 | #include "dm.h" |
38 | #include "table.h" | 38 | #include "table.h" |
39 | 39 | ||
40 | /* Define macro to shorten lines */ | ||
41 | #define MCS_TXPWR mcs_txpwrlevel_origoffset | ||
42 | |||
40 | static u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, | 43 | static u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, |
41 | enum radio_path rfpath, u32 offset); | 44 | enum radio_path rfpath, u32 offset); |
42 | static void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, | 45 | static void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, |
@@ -480,161 +483,129 @@ static void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, | |||
480 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 483 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
481 | 484 | ||
482 | if (regaddr == RTXAGC_A_RATE18_06) { | 485 | if (regaddr == RTXAGC_A_RATE18_06) { |
483 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][0] = | 486 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][0] = data; |
484 | data; | ||
485 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 487 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
486 | ("MCSTxPowerLevelOriginalOffset[%d][0] = 0x%x\n", | 488 | ("MCSTxPowerLevelOriginalOffset[%d][0] = 0x%x\n", |
487 | rtlphy->pwrgroup_cnt, | 489 | rtlphy->pwrgroup_cnt, |
488 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 490 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][0])); |
489 | pwrgroup_cnt][0])); | ||
490 | } | 491 | } |
491 | if (regaddr == RTXAGC_A_RATE54_24) { | 492 | if (regaddr == RTXAGC_A_RATE54_24) { |
492 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][1] = | 493 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][1] = data; |
493 | data; | ||
494 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 494 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
495 | ("MCSTxPowerLevelOriginalOffset[%d][1] = 0x%x\n", | 495 | ("MCSTxPowerLevelOriginalOffset[%d][1] = 0x%x\n", |
496 | rtlphy->pwrgroup_cnt, | 496 | rtlphy->pwrgroup_cnt, |
497 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 497 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][1])); |
498 | pwrgroup_cnt][1])); | ||
499 | } | 498 | } |
500 | if (regaddr == RTXAGC_A_CCK1_MCS32) { | 499 | if (regaddr == RTXAGC_A_CCK1_MCS32) { |
501 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][6] = | 500 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][6] = data; |
502 | data; | ||
503 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 501 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
504 | ("MCSTxPowerLevelOriginalOffset[%d][6] = 0x%x\n", | 502 | ("MCSTxPowerLevelOriginalOffset[%d][6] = 0x%x\n", |
505 | rtlphy->pwrgroup_cnt, | 503 | rtlphy->pwrgroup_cnt, |
506 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 504 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][6])); |
507 | pwrgroup_cnt][6])); | ||
508 | } | 505 | } |
509 | if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00) { | 506 | if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00) { |
510 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][7] = | 507 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][7] = data; |
511 | data; | ||
512 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 508 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
513 | ("MCSTxPowerLevelOriginalOffset[%d][7] = 0x%x\n", | 509 | ("MCSTxPowerLevelOriginalOffset[%d][7] = 0x%x\n", |
514 | rtlphy->pwrgroup_cnt, | 510 | rtlphy->pwrgroup_cnt, |
515 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 511 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][7])); |
516 | pwrgroup_cnt][7])); | ||
517 | } | 512 | } |
518 | if (regaddr == RTXAGC_A_MCS03_MCS00) { | 513 | if (regaddr == RTXAGC_A_MCS03_MCS00) { |
519 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][2] = | 514 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][2] = data; |
520 | data; | ||
521 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 515 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
522 | ("MCSTxPowerLevelOriginalOffset[%d][2] = 0x%x\n", | 516 | ("MCSTxPowerLevelOriginalOffset[%d][2] = 0x%x\n", |
523 | rtlphy->pwrgroup_cnt, | 517 | rtlphy->pwrgroup_cnt, |
524 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 518 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][2])); |
525 | pwrgroup_cnt][2])); | ||
526 | } | 519 | } |
527 | if (regaddr == RTXAGC_A_MCS07_MCS04) { | 520 | if (regaddr == RTXAGC_A_MCS07_MCS04) { |
528 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][3] = | 521 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][3] = data; |
529 | data; | ||
530 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 522 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
531 | ("MCSTxPowerLevelOriginalOffset[%d][3] = 0x%x\n", | 523 | ("MCSTxPowerLevelOriginalOffset[%d][3] = 0x%x\n", |
532 | rtlphy->pwrgroup_cnt, | 524 | rtlphy->pwrgroup_cnt, |
533 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 525 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][3])); |
534 | pwrgroup_cnt][3])); | ||
535 | } | 526 | } |
536 | if (regaddr == RTXAGC_A_MCS11_MCS08) { | 527 | if (regaddr == RTXAGC_A_MCS11_MCS08) { |
537 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][4] = | 528 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][4] = data; |
538 | data; | ||
539 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 529 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
540 | ("MCSTxPowerLevelOriginalOffset[%d][4] = 0x%x\n", | 530 | ("MCSTxPowerLevelOriginalOffset[%d][4] = 0x%x\n", |
541 | rtlphy->pwrgroup_cnt, | 531 | rtlphy->pwrgroup_cnt, |
542 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 532 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][4])); |
543 | pwrgroup_cnt][4])); | ||
544 | } | 533 | } |
545 | if (regaddr == RTXAGC_A_MCS15_MCS12) { | 534 | if (regaddr == RTXAGC_A_MCS15_MCS12) { |
546 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][5] = | 535 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][5] = data; |
547 | data; | ||
548 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 536 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
549 | ("MCSTxPowerLevelOriginalOffset[%d][5] = 0x%x\n", | 537 | ("MCSTxPowerLevelOriginalOffset[%d][5] = 0x%x\n", |
550 | rtlphy->pwrgroup_cnt, | 538 | rtlphy->pwrgroup_cnt, |
551 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 539 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][5])); |
552 | pwrgroup_cnt][5])); | ||
553 | } | 540 | } |
554 | if (regaddr == RTXAGC_B_RATE18_06) { | 541 | if (regaddr == RTXAGC_B_RATE18_06) { |
555 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][8] = | 542 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][8] = data; |
556 | data; | ||
557 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 543 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
558 | ("MCSTxPowerLevelOriginalOffset[%d][8] = 0x%x\n", | 544 | ("MCSTxPowerLevelOriginalOffset[%d][8] = 0x%x\n", |
559 | rtlphy->pwrgroup_cnt, | 545 | rtlphy->pwrgroup_cnt, |
560 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 546 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][8])); |
561 | pwrgroup_cnt][8])); | ||
562 | } | 547 | } |
563 | if (regaddr == RTXAGC_B_RATE54_24) { | 548 | if (regaddr == RTXAGC_B_RATE54_24) { |
564 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][9] = | 549 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][9] = data; |
565 | data; | ||
566 | 550 | ||
567 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 551 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
568 | ("MCSTxPowerLevelOriginalOffset[%d][9] = 0x%x\n", | 552 | ("MCSTxPowerLevelOriginalOffset[%d][9] = 0x%x\n", |
569 | rtlphy->pwrgroup_cnt, | 553 | rtlphy->pwrgroup_cnt, |
570 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 554 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][9])); |
571 | pwrgroup_cnt][9])); | ||
572 | } | 555 | } |
573 | 556 | ||
574 | if (regaddr == RTXAGC_B_CCK1_55_MCS32) { | 557 | if (regaddr == RTXAGC_B_CCK1_55_MCS32) { |
575 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][14] = | 558 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][14] = data; |
576 | data; | ||
577 | 559 | ||
578 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 560 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
579 | ("MCSTxPowerLevelOriginalOffset[%d][14] = 0x%x\n", | 561 | ("MCSTxPowerLevelOriginalOffset[%d][14] = 0x%x\n", |
580 | rtlphy->pwrgroup_cnt, | 562 | rtlphy->pwrgroup_cnt, |
581 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 563 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][14])); |
582 | pwrgroup_cnt][14])); | ||
583 | } | 564 | } |
584 | 565 | ||
585 | if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) { | 566 | if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) { |
586 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][15] = | 567 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][15] = data; |
587 | data; | ||
588 | 568 | ||
589 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 569 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
590 | ("MCSTxPowerLevelOriginalOffset[%d][15] = 0x%x\n", | 570 | ("MCSTxPowerLevelOriginalOffset[%d][15] = 0x%x\n", |
591 | rtlphy->pwrgroup_cnt, | 571 | rtlphy->pwrgroup_cnt, |
592 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 572 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][15])); |
593 | pwrgroup_cnt][15])); | ||
594 | } | 573 | } |
595 | 574 | ||
596 | if (regaddr == RTXAGC_B_MCS03_MCS00) { | 575 | if (regaddr == RTXAGC_B_MCS03_MCS00) { |
597 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][10] = | 576 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][10] = data; |
598 | data; | ||
599 | 577 | ||
600 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 578 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
601 | ("MCSTxPowerLevelOriginalOffset[%d][10] = 0x%x\n", | 579 | ("MCSTxPowerLevelOriginalOffset[%d][10] = 0x%x\n", |
602 | rtlphy->pwrgroup_cnt, | 580 | rtlphy->pwrgroup_cnt, |
603 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 581 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][10])); |
604 | pwrgroup_cnt][10])); | ||
605 | } | 582 | } |
606 | 583 | ||
607 | if (regaddr == RTXAGC_B_MCS07_MCS04) { | 584 | if (regaddr == RTXAGC_B_MCS07_MCS04) { |
608 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][11] = | 585 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][11] = data; |
609 | data; | ||
610 | 586 | ||
611 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 587 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
612 | ("MCSTxPowerLevelOriginalOffset[%d][11] = 0x%x\n", | 588 | ("MCSTxPowerLevelOriginalOffset[%d][11] = 0x%x\n", |
613 | rtlphy->pwrgroup_cnt, | 589 | rtlphy->pwrgroup_cnt, |
614 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 590 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][11])); |
615 | pwrgroup_cnt][11])); | ||
616 | } | 591 | } |
617 | 592 | ||
618 | if (regaddr == RTXAGC_B_MCS11_MCS08) { | 593 | if (regaddr == RTXAGC_B_MCS11_MCS08) { |
619 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][12] = | 594 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][12] = data; |
620 | data; | ||
621 | 595 | ||
622 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 596 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
623 | ("MCSTxPowerLevelOriginalOffset[%d][12] = 0x%x\n", | 597 | ("MCSTxPowerLevelOriginalOffset[%d][12] = 0x%x\n", |
624 | rtlphy->pwrgroup_cnt, | 598 | rtlphy->pwrgroup_cnt, |
625 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 599 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][12])); |
626 | pwrgroup_cnt][12])); | ||
627 | } | 600 | } |
628 | 601 | ||
629 | if (regaddr == RTXAGC_B_MCS15_MCS12) { | 602 | if (regaddr == RTXAGC_B_MCS15_MCS12) { |
630 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][13] = | 603 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][13] = data; |
631 | data; | ||
632 | 604 | ||
633 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 605 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
634 | ("MCSTxPowerLevelOriginalOffset[%d][13] = 0x%x\n", | 606 | ("MCSTxPowerLevelOriginalOffset[%d][13] = 0x%x\n", |
635 | rtlphy->pwrgroup_cnt, | 607 | rtlphy->pwrgroup_cnt, |
636 | rtlphy->mcs_txpwrlevel_origoffset[rtlphy-> | 608 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][13])); |
637 | pwrgroup_cnt][13])); | ||
638 | 609 | ||
639 | rtlphy->pwrgroup_cnt++; | 610 | rtlphy->pwrgroup_cnt++; |
640 | } | 611 | } |