aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2400pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2400pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 1afba42cc128..e87ad43e8e8d 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -600,35 +600,36 @@ static void rt2400pci_link_stats(struct rt2x00_dev *rt2x00dev,
600 qual->false_cca = bbp; 600 qual->false_cca = bbp;
601} 601}
602 602
603static inline void rt2400pci_set_vgc(struct rt2x00_dev *rt2x00dev, u8 vgc_level)
604{
605 rt2400pci_bbp_write(rt2x00dev, 13, vgc_level);
606 rt2x00dev->link.vgc_level = vgc_level;
607 rt2x00dev->link.vgc_level_reg = vgc_level;
608}
609
603static void rt2400pci_reset_tuner(struct rt2x00_dev *rt2x00dev) 610static void rt2400pci_reset_tuner(struct rt2x00_dev *rt2x00dev)
604{ 611{
605 rt2400pci_bbp_write(rt2x00dev, 13, 0x08); 612 rt2400pci_set_vgc(rt2x00dev, 0x08);
606 rt2x00dev->link.vgc_level = 0x08;
607} 613}
608 614
609static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev) 615static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev)
610{ 616{
611 u8 reg; 617 struct link *link = &rt2x00dev->link;
612 618
613 /* 619 /*
614 * The link tuner should not run longer then 60 seconds, 620 * The link tuner should not run longer then 60 seconds,
615 * and should run once every 2 seconds. 621 * and should run once every 2 seconds.
616 */ 622 */
617 if (rt2x00dev->link.count > 60 || !(rt2x00dev->link.count & 1)) 623 if (link->count > 60 || !(link->count & 1))
618 return; 624 return;
619 625
620 /* 626 /*
621 * Base r13 link tuning on the false cca count. 627 * Base r13 link tuning on the false cca count.
622 */ 628 */
623 rt2400pci_bbp_read(rt2x00dev, 13, &reg); 629 if ((link->qual.false_cca > 512) && (link->vgc_level < 0x20))
624 630 rt2400pci_set_vgc(rt2x00dev, ++link->vgc_level);
625 if (rt2x00dev->link.qual.false_cca > 512 && reg < 0x20) { 631 else if ((link->qual.false_cca < 100) && (link->vgc_level > 0x08))
626 rt2400pci_bbp_write(rt2x00dev, 13, ++reg); 632 rt2400pci_set_vgc(rt2x00dev, --link->vgc_level);
627 rt2x00dev->link.vgc_level = reg;
628 } else if (rt2x00dev->link.qual.false_cca < 100 && reg > 0x08) {
629 rt2400pci_bbp_write(rt2x00dev, 13, --reg);
630 rt2x00dev->link.vgc_level = reg;
631 }
632} 633}
633 634
634/* 635/*