aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/b43/main.c')
-rw-r--r--drivers/net/wireless/b43/main.c53
1 files changed, 12 insertions, 41 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index a9f7148493f7..a603a154d496 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2143,21 +2143,6 @@ static void b43_mgmtframe_txantenna(struct b43_wldev *dev, int antenna)
2143 b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_PRPHYCTL, tmp); 2143 b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_PRPHYCTL, tmp);
2144} 2144}
2145 2145
2146/* Returns TRUE, if the radio is enabled in hardware. */
2147static bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
2148{
2149 if (dev->phy.rev >= 3) {
2150 if (!(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI)
2151 & B43_MMIO_RADIO_HWENABLED_HI_MASK))
2152 return 1;
2153 } else {
2154 if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
2155 & B43_MMIO_RADIO_HWENABLED_LO_MASK)
2156 return 1;
2157 }
2158 return 0;
2159}
2160
2161/* This is the opposite of b43_chip_init() */ 2146/* This is the opposite of b43_chip_init() */
2162static void b43_chip_exit(struct b43_wldev *dev) 2147static void b43_chip_exit(struct b43_wldev *dev)
2163{ 2148{
@@ -2350,32 +2335,18 @@ static void b43_periodic_every15sec(struct b43_wldev *dev)
2350 //TODO for APHY (temperature?) 2335 //TODO for APHY (temperature?)
2351} 2336}
2352 2337
2353static void b43_periodic_every1sec(struct b43_wldev *dev)
2354{
2355 bool radio_hw_enable;
2356
2357 /* check if radio hardware enabled status changed */
2358 radio_hw_enable = b43_is_hw_radio_enabled(dev);
2359 if (unlikely(dev->radio_hw_enable != radio_hw_enable)) {
2360 dev->radio_hw_enable = radio_hw_enable;
2361 b43_rfkill_toggled(dev, radio_hw_enable);
2362 }
2363}
2364
2365static void do_periodic_work(struct b43_wldev *dev) 2338static void do_periodic_work(struct b43_wldev *dev)
2366{ 2339{
2367 unsigned int state; 2340 unsigned int state;
2368 2341
2369 state = dev->periodic_state; 2342 state = dev->periodic_state;
2370 if (state % 120 == 0) 2343 if (state % 8 == 0)
2371 b43_periodic_every120sec(dev); 2344 b43_periodic_every120sec(dev);
2372 if (state % 60 == 0) 2345 if (state % 4 == 0)
2373 b43_periodic_every60sec(dev); 2346 b43_periodic_every60sec(dev);
2374 if (state % 30 == 0) 2347 if (state % 2 == 0)
2375 b43_periodic_every30sec(dev); 2348 b43_periodic_every30sec(dev);
2376 if (state % 15 == 0) 2349 b43_periodic_every15sec(dev);
2377 b43_periodic_every15sec(dev);
2378 b43_periodic_every1sec(dev);
2379} 2350}
2380 2351
2381/* Estimate a "Badness" value based on the periodic work 2352/* Estimate a "Badness" value based on the periodic work
@@ -2386,13 +2357,11 @@ static int estimate_periodic_work_badness(unsigned int state)
2386{ 2357{
2387 int badness = 0; 2358 int badness = 0;
2388 2359
2389 if (state % 120 == 0) /* every 120 sec */ 2360 if (state % 8 == 0) /* every 120 sec */
2390 badness += 10; 2361 badness += 10;
2391 if (state % 60 == 0) /* every 60 sec */ 2362 if (state % 4 == 0) /* every 60 sec */
2392 badness += 5; 2363 badness += 5;
2393 if (state % 30 == 0) /* every 30 sec */ 2364 if (state % 2 == 0) /* every 30 sec */
2394 badness += 1;
2395 if (state % 15 == 0) /* every 15 sec */
2396 badness += 1; 2365 badness += 1;
2397 2366
2398#define BADNESS_LIMIT 4 2367#define BADNESS_LIMIT 4
@@ -2443,13 +2412,13 @@ static void b43_periodic_work_handler(struct work_struct *work)
2443 spin_unlock_irqrestore(&dev->wl->irq_lock, flags); 2412 spin_unlock_irqrestore(&dev->wl->irq_lock, flags);
2444 } 2413 }
2445 dev->periodic_state++; 2414 dev->periodic_state++;
2446 out_requeue: 2415out_requeue:
2447 if (b43_debug(dev, B43_DBG_PWORK_FAST)) 2416 if (b43_debug(dev, B43_DBG_PWORK_FAST))
2448 delay = msecs_to_jiffies(50); 2417 delay = msecs_to_jiffies(50);
2449 else 2418 else
2450 delay = round_jiffies(HZ); 2419 delay = round_jiffies(HZ * 15);
2451 queue_delayed_work(dev->wl->hw->workqueue, &dev->periodic_work, delay); 2420 queue_delayed_work(dev->wl->hw->workqueue, &dev->periodic_work, delay);
2452 out: 2421out:
2453 mutex_unlock(&dev->wl->mutex); 2422 mutex_unlock(&dev->wl->mutex);
2454} 2423}
2455 2424
@@ -3720,6 +3689,7 @@ static int b43_setup_modes(struct b43_wldev *dev,
3720 3689
3721static void b43_wireless_core_detach(struct b43_wldev *dev) 3690static void b43_wireless_core_detach(struct b43_wldev *dev)
3722{ 3691{
3692 b43_rfkill_free(dev);
3723 /* We release firmware that late to not be required to re-request 3693 /* We release firmware that late to not be required to re-request
3724 * is all the time when we reinit the core. */ 3694 * is all the time when we reinit the core. */
3725 b43_release_firmware(dev); 3695 b43_release_firmware(dev);
@@ -3805,6 +3775,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
3805 if (!wl->current_dev) 3775 if (!wl->current_dev)
3806 wl->current_dev = dev; 3776 wl->current_dev = dev;
3807 INIT_WORK(&dev->restart_work, b43_chip_reset); 3777 INIT_WORK(&dev->restart_work, b43_chip_reset);
3778 b43_rfkill_alloc(dev);
3808 3779
3809 b43_radio_turn_off(dev, 1); 3780 b43_radio_turn_off(dev, 1);
3810 b43_switch_analog(dev, 0); 3781 b43_switch_analog(dev, 0);