diff options
author | John Li <chen-yang.li@mediatek.com> | 2012-02-16 08:40:57 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-02-27 14:05:44 -0500 |
commit | 2e9c43dd45ced5bd77c94d4216f96b4a49448d73 (patch) | |
tree | 6c6a219ab04d652197fef2f8ae5538571ed1782a /drivers/net/wireless/rt2x00/rt2x00link.c | |
parent | 9da27232060411e98c27a8407610c794acb08c8b (diff) |
rt2x00:Add VCO recalibration
Signed-off-by: John Li <chen-yang.li@mediatek.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00link.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00link.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c index ea10b0068f82..8368aab86f28 100644 --- a/drivers/net/wireless/rt2x00/rt2x00link.c +++ b/drivers/net/wireless/rt2x00/rt2x00link.c | |||
@@ -447,11 +447,27 @@ void rt2x00link_start_agc(struct rt2x00_dev *rt2x00dev) | |||
447 | AGC_INTERVAL); | 447 | AGC_INTERVAL); |
448 | } | 448 | } |
449 | 449 | ||
450 | void rt2x00link_start_vcocal(struct rt2x00_dev *rt2x00dev) | ||
451 | { | ||
452 | struct link *link = &rt2x00dev->link; | ||
453 | |||
454 | if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && | ||
455 | rt2x00dev->ops->lib->vco_calibration) | ||
456 | ieee80211_queue_delayed_work(rt2x00dev->hw, | ||
457 | &link->vco_work, | ||
458 | VCO_INTERVAL); | ||
459 | } | ||
460 | |||
450 | void rt2x00link_stop_agc(struct rt2x00_dev *rt2x00dev) | 461 | void rt2x00link_stop_agc(struct rt2x00_dev *rt2x00dev) |
451 | { | 462 | { |
452 | cancel_delayed_work_sync(&rt2x00dev->link.agc_work); | 463 | cancel_delayed_work_sync(&rt2x00dev->link.agc_work); |
453 | } | 464 | } |
454 | 465 | ||
466 | void rt2x00link_stop_vcocal(struct rt2x00_dev *rt2x00dev) | ||
467 | { | ||
468 | cancel_delayed_work_sync(&rt2x00dev->link.vco_work); | ||
469 | } | ||
470 | |||
455 | static void rt2x00link_agc(struct work_struct *work) | 471 | static void rt2x00link_agc(struct work_struct *work) |
456 | { | 472 | { |
457 | struct rt2x00_dev *rt2x00dev = | 473 | struct rt2x00_dev *rt2x00dev = |
@@ -473,9 +489,32 @@ static void rt2x00link_agc(struct work_struct *work) | |||
473 | AGC_INTERVAL); | 489 | AGC_INTERVAL); |
474 | } | 490 | } |
475 | 491 | ||
492 | static void rt2x00link_vcocal(struct work_struct *work) | ||
493 | { | ||
494 | struct rt2x00_dev *rt2x00dev = | ||
495 | container_of(work, struct rt2x00_dev, link.vco_work.work); | ||
496 | struct link *link = &rt2x00dev->link; | ||
497 | |||
498 | /* | ||
499 | * When the radio is shutting down we should | ||
500 | * immediately cease the VCO calibration. | ||
501 | */ | ||
502 | if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) | ||
503 | return; | ||
504 | |||
505 | rt2x00dev->ops->lib->vco_calibration(rt2x00dev); | ||
506 | |||
507 | if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | ||
508 | ieee80211_queue_delayed_work(rt2x00dev->hw, | ||
509 | &link->vco_work, | ||
510 | VCO_INTERVAL); | ||
511 | } | ||
512 | |||
476 | void rt2x00link_register(struct rt2x00_dev *rt2x00dev) | 513 | void rt2x00link_register(struct rt2x00_dev *rt2x00dev) |
477 | { | 514 | { |
478 | INIT_DELAYED_WORK(&rt2x00dev->link.agc_work, rt2x00link_agc); | 515 | INIT_DELAYED_WORK(&rt2x00dev->link.agc_work, rt2x00link_agc); |
516 | if (test_bit(CAPABILITY_VCO_RECALIBRATION, &rt2x00dev->cap_flags)) | ||
517 | INIT_DELAYED_WORK(&rt2x00dev->link.vco_work, rt2x00link_vcocal); | ||
479 | INIT_DELAYED_WORK(&rt2x00dev->link.watchdog_work, rt2x00link_watchdog); | 518 | INIT_DELAYED_WORK(&rt2x00dev->link.watchdog_work, rt2x00link_watchdog); |
480 | INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner); | 519 | INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner); |
481 | } | 520 | } |