aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/main.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-04-20 10:03:32 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-07 15:02:12 -0400
commitf5eda47f45e90dfa38e25d569b9ac84ba94f8301 (patch)
tree5f806ae4729696cebef0bef0c261c6353b18045a /drivers/net/wireless/b43/main.c
parent2afc49015db927fea7bc6ca33c0a60bf5d7c2c5f (diff)
b43: Rewrite LO calibration algorithm
This patch distributes the Local Oscillator calibration bursts over time, so that calibration only happens when it's actually needed. Currently we periodically perform a recalibration of the whole table. The table is huge and this takes lots of time. Additionally only small bits of the table are actually needed at a given time. So instead of maintaining a huge table with all possible calibration values, we create dynamic calibration settings that a) We only calibrate when they are actually needed. b) Are cached for some time until they expire. So a recalibration might happen if we need a calibration setting that's not cached, or if the active calibration setting expires. Currently the expire timeout is set to 30 seconds. We may raise that in future. This patch reduces overall memory consumption by nuking the huge static calibration tables. This patch has been tested on several 4306, 4311 and 4318 flavours. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/main.c')
-rw-r--r--drivers/net/wireless/b43/main.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 8fdba9415c04..e3d8555d4a99 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2308,7 +2308,7 @@ static void b43_gpio_cleanup(struct b43_wldev *dev)
2308} 2308}
2309 2309
2310/* http://bcm-specs.sipsolutions.net/EnableMac */ 2310/* http://bcm-specs.sipsolutions.net/EnableMac */
2311static void b43_mac_enable(struct b43_wldev *dev) 2311void b43_mac_enable(struct b43_wldev *dev)
2312{ 2312{
2313 dev->mac_suspended--; 2313 dev->mac_suspended--;
2314 B43_WARN_ON(dev->mac_suspended < 0); 2314 B43_WARN_ON(dev->mac_suspended < 0);
@@ -2331,7 +2331,7 @@ static void b43_mac_enable(struct b43_wldev *dev)
2331} 2331}
2332 2332
2333/* http://bcm-specs.sipsolutions.net/SuspendMAC */ 2333/* http://bcm-specs.sipsolutions.net/SuspendMAC */
2334static void b43_mac_suspend(struct b43_wldev *dev) 2334void b43_mac_suspend(struct b43_wldev *dev)
2335{ 2335{
2336 int i; 2336 int i;
2337 u32 tmp; 2337 u32 tmp;
@@ -2503,6 +2503,7 @@ static void b43_chip_exit(struct b43_wldev *dev)
2503{ 2503{
2504 b43_radio_turn_off(dev, 1); 2504 b43_radio_turn_off(dev, 1);
2505 b43_gpio_cleanup(dev); 2505 b43_gpio_cleanup(dev);
2506 b43_lo_g_cleanup(dev);
2506 /* firmware is released later */ 2507 /* firmware is released later */
2507} 2508}
2508 2509
@@ -2609,28 +2610,12 @@ err_gpio_clean:
2609 return err; 2610 return err;
2610} 2611}
2611 2612
2612static void b43_periodic_every120sec(struct b43_wldev *dev)
2613{
2614 struct b43_phy *phy = &dev->phy;
2615
2616 if (phy->type != B43_PHYTYPE_G || phy->rev < 2)
2617 return;
2618
2619 b43_mac_suspend(dev);
2620 b43_lo_g_measure(dev);
2621 b43_mac_enable(dev);
2622 if (b43_has_hardware_pctl(phy))
2623 b43_lo_g_ctl_mark_all_unused(dev);
2624}
2625
2626static void b43_periodic_every60sec(struct b43_wldev *dev) 2613static void b43_periodic_every60sec(struct b43_wldev *dev)
2627{ 2614{
2628 struct b43_phy *phy = &dev->phy; 2615 struct b43_phy *phy = &dev->phy;
2629 2616
2630 if (phy->type != B43_PHYTYPE_G) 2617 if (phy->type != B43_PHYTYPE_G)
2631 return; 2618 return;
2632 if (!b43_has_hardware_pctl(phy))
2633 b43_lo_g_ctl_mark_all_unused(dev);
2634 if (dev->dev->bus->sprom.boardflags_lo & B43_BFL_RSSI) { 2619 if (dev->dev->bus->sprom.boardflags_lo & B43_BFL_RSSI) {
2635 b43_mac_suspend(dev); 2620 b43_mac_suspend(dev);
2636 b43_calc_nrssi_slope(dev); 2621 b43_calc_nrssi_slope(dev);
@@ -2682,6 +2667,7 @@ static void b43_periodic_every15sec(struct b43_wldev *dev)
2682 } 2667 }
2683 } 2668 }
2684 b43_phy_xmitpower(dev); //FIXME: unless scanning? 2669 b43_phy_xmitpower(dev); //FIXME: unless scanning?
2670 b43_lo_g_maintanance_work(dev);
2685 //TODO for APHY (temperature?) 2671 //TODO for APHY (temperature?)
2686 2672
2687 atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT); 2673 atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT);
@@ -2693,8 +2679,6 @@ static void do_periodic_work(struct b43_wldev *dev)
2693 unsigned int state; 2679 unsigned int state;
2694 2680
2695 state = dev->periodic_state; 2681 state = dev->periodic_state;
2696 if (state % 8 == 0)
2697 b43_periodic_every120sec(dev);
2698 if (state % 4 == 0) 2682 if (state % 4 == 0)
2699 b43_periodic_every60sec(dev); 2683 b43_periodic_every60sec(dev);
2700 if (state % 2 == 0) 2684 if (state % 2 == 0)
@@ -3668,8 +3652,8 @@ static void setup_struct_phy_for_init(struct b43_wldev *dev,
3668 lo = phy->lo_control; 3652 lo = phy->lo_control;
3669 if (lo) { 3653 if (lo) {
3670 memset(lo, 0, sizeof(*(phy->lo_control))); 3654 memset(lo, 0, sizeof(*(phy->lo_control)));
3671 lo->rebuild = 1;
3672 lo->tx_bias = 0xFF; 3655 lo->tx_bias = 0xFF;
3656 INIT_LIST_HEAD(&lo->calib_list);
3673 } 3657 }
3674 phy->max_lb_gain = 0; 3658 phy->max_lb_gain = 0;
3675 phy->trsw_rx_gain = 0; 3659 phy->trsw_rx_gain = 0;