diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 5b98a74a2554..fb86e2c55248 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -639,31 +639,31 @@ static void rt2500pci_link_stats(struct rt2x00_dev *rt2x00dev, | |||
639 | qual->false_cca = rt2x00_get_field32(reg, CNT3_FALSE_CCA); | 639 | qual->false_cca = rt2x00_get_field32(reg, CNT3_FALSE_CCA); |
640 | } | 640 | } |
641 | 641 | ||
642 | static inline void rt2500pci_set_vgc(struct rt2x00_dev *rt2x00dev, u8 vgc_level) | 642 | static inline void rt2500pci_set_vgc(struct rt2x00_dev *rt2x00dev, |
643 | struct link_qual *qual, u8 vgc_level) | ||
643 | { | 644 | { |
644 | if (rt2x00dev->link.vgc_level_reg != vgc_level) { | 645 | if (qual->vgc_level_reg != vgc_level) { |
645 | rt2500pci_bbp_write(rt2x00dev, 17, vgc_level); | 646 | rt2500pci_bbp_write(rt2x00dev, 17, vgc_level); |
646 | rt2x00dev->link.vgc_level_reg = vgc_level; | 647 | qual->vgc_level_reg = vgc_level; |
647 | } | 648 | } |
648 | } | 649 | } |
649 | 650 | ||
650 | static void rt2500pci_reset_tuner(struct rt2x00_dev *rt2x00dev) | 651 | static void rt2500pci_reset_tuner(struct rt2x00_dev *rt2x00dev, |
652 | struct link_qual *qual) | ||
651 | { | 653 | { |
652 | rt2500pci_set_vgc(rt2x00dev, 0x48); | 654 | rt2500pci_set_vgc(rt2x00dev, qual, 0x48); |
653 | } | 655 | } |
654 | 656 | ||
655 | static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev) | 657 | static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev, |
658 | struct link_qual *qual, const u32 count) | ||
656 | { | 659 | { |
657 | struct link *link = &rt2x00dev->link; | ||
658 | int rssi = rt2x00_get_link_rssi(link); | ||
659 | |||
660 | /* | 660 | /* |
661 | * To prevent collisions with MAC ASIC on chipsets | 661 | * To prevent collisions with MAC ASIC on chipsets |
662 | * up to version C the link tuning should halt after 20 | 662 | * up to version C the link tuning should halt after 20 |
663 | * seconds while being associated. | 663 | * seconds while being associated. |
664 | */ | 664 | */ |
665 | if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D && | 665 | if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D && |
666 | rt2x00dev->intf_associated && link->count > 20) | 666 | rt2x00dev->intf_associated && count > 20) |
667 | return; | 667 | return; |
668 | 668 | ||
669 | /* | 669 | /* |
@@ -681,25 +681,25 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev) | |||
681 | * then corrupt the R17 tuning. To remidy this the tuning should | 681 | * then corrupt the R17 tuning. To remidy this the tuning should |
682 | * be stopped (While making sure the R17 value will not exceed limits) | 682 | * be stopped (While making sure the R17 value will not exceed limits) |
683 | */ | 683 | */ |
684 | if (rssi < -80 && link->count > 20) { | 684 | if (qual->rssi < -80 && count > 20) { |
685 | if (link->vgc_level_reg >= 0x41) | 685 | if (qual->vgc_level_reg >= 0x41) |
686 | rt2500pci_set_vgc(rt2x00dev, link->vgc_level); | 686 | rt2500pci_set_vgc(rt2x00dev, qual, qual->vgc_level); |
687 | return; | 687 | return; |
688 | } | 688 | } |
689 | 689 | ||
690 | /* | 690 | /* |
691 | * Special big-R17 for short distance | 691 | * Special big-R17 for short distance |
692 | */ | 692 | */ |
693 | if (rssi >= -58) { | 693 | if (qual->rssi >= -58) { |
694 | rt2500pci_set_vgc(rt2x00dev, 0x50); | 694 | rt2500pci_set_vgc(rt2x00dev, qual, 0x50); |
695 | return; | 695 | return; |
696 | } | 696 | } |
697 | 697 | ||
698 | /* | 698 | /* |
699 | * Special mid-R17 for middle distance | 699 | * Special mid-R17 for middle distance |
700 | */ | 700 | */ |
701 | if (rssi >= -74) { | 701 | if (qual->rssi >= -74) { |
702 | rt2500pci_set_vgc(rt2x00dev, 0x41); | 702 | rt2500pci_set_vgc(rt2x00dev, qual, 0x41); |
703 | return; | 703 | return; |
704 | } | 704 | } |
705 | 705 | ||
@@ -707,8 +707,8 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev) | |||
707 | * Leave short or middle distance condition, restore r17 | 707 | * Leave short or middle distance condition, restore r17 |
708 | * to the dynamic tuning range. | 708 | * to the dynamic tuning range. |
709 | */ | 709 | */ |
710 | if (link->vgc_level_reg >= 0x41) { | 710 | if (qual->vgc_level_reg >= 0x41) { |
711 | rt2500pci_set_vgc(rt2x00dev, link->vgc_level); | 711 | rt2500pci_set_vgc(rt2x00dev, qual, qual->vgc_level); |
712 | return; | 712 | return; |
713 | } | 713 | } |
714 | 714 | ||
@@ -718,12 +718,12 @@ dynamic_cca_tune: | |||
718 | * R17 is inside the dynamic tuning range, | 718 | * R17 is inside the dynamic tuning range, |
719 | * start tuning the link based on the false cca counter. | 719 | * start tuning the link based on the false cca counter. |
720 | */ | 720 | */ |
721 | if (link->qual.false_cca > 512 && link->vgc_level_reg < 0x40) { | 721 | if (qual->false_cca > 512 && qual->vgc_level_reg < 0x40) { |
722 | rt2500pci_set_vgc(rt2x00dev, ++link->vgc_level_reg); | 722 | rt2500pci_set_vgc(rt2x00dev, qual, ++qual->vgc_level_reg); |
723 | link->vgc_level = link->vgc_level_reg; | 723 | qual->vgc_level = qual->vgc_level_reg; |
724 | } else if (link->qual.false_cca < 100 && link->vgc_level_reg > 0x32) { | 724 | } else if (qual->false_cca < 100 && qual->vgc_level_reg > 0x32) { |
725 | rt2500pci_set_vgc(rt2x00dev, --link->vgc_level_reg); | 725 | rt2500pci_set_vgc(rt2x00dev, qual, --qual->vgc_level_reg); |
726 | link->vgc_level = link->vgc_level_reg; | 726 | qual->vgc_level = qual->vgc_level_reg; |
727 | } | 727 | } |
728 | } | 728 | } |
729 | 729 | ||