aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00link.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00link.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00link.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c
index fc8cee91b54e..128b3615c08c 100644
--- a/drivers/net/wireless/rt2x00/rt2x00link.c
+++ b/drivers/net/wireless/rt2x00/rt2x00link.c
@@ -446,8 +446,46 @@ static void rt2x00link_watchdog(struct work_struct *work)
446 WATCHDOG_INTERVAL); 446 WATCHDOG_INTERVAL);
447} 447}
448 448
449void rt2x00link_start_agc(struct rt2x00_dev *rt2x00dev)
450{
451 struct link *link = &rt2x00dev->link;
452
453 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) &&
454 rt2x00dev->ops->lib->gain_calibration)
455 ieee80211_queue_delayed_work(rt2x00dev->hw,
456 &link->agc_work,
457 AGC_INTERVAL);
458}
459
460void rt2x00link_stop_agc(struct rt2x00_dev *rt2x00dev)
461{
462 cancel_delayed_work_sync(&rt2x00dev->link.agc_work);
463}
464
465static void rt2x00link_agc(struct work_struct *work)
466{
467 struct rt2x00_dev *rt2x00dev =
468 container_of(work, struct rt2x00_dev, link.agc_work.work);
469 struct link *link = &rt2x00dev->link;
470
471 /*
472 * When the radio is shutting down we should
473 * immediately cease the watchdog monitoring.
474 */
475 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
476 return;
477
478 rt2x00dev->ops->lib->gain_calibration(rt2x00dev);
479
480 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
481 ieee80211_queue_delayed_work(rt2x00dev->hw,
482 &link->agc_work,
483 AGC_INTERVAL);
484}
485
449void rt2x00link_register(struct rt2x00_dev *rt2x00dev) 486void rt2x00link_register(struct rt2x00_dev *rt2x00dev)
450{ 487{
488 INIT_DELAYED_WORK(&rt2x00dev->link.agc_work, rt2x00link_agc);
451 INIT_DELAYED_WORK(&rt2x00dev->link.watchdog_work, rt2x00link_watchdog); 489 INIT_DELAYED_WORK(&rt2x00dev->link.watchdog_work, rt2x00link_watchdog);
452 INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner); 490 INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner);
453} 491}