aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00link.c
diff options
context:
space:
mode:
authorHelmut Schaa <helmut.schaa@googlemail.com>2011-03-28 07:33:40 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-04 16:20:03 -0400
commit9e33a3553821418b2c4f53d09311476c55176b13 (patch)
treefa0538ca1775be5b598949b2418721268e0ece53 /drivers/net/wireless/rt2x00/rt2x00link.c
parent2f2bb7e8bdc977c94cdaaf84328526555eba89b1 (diff)
rt2x00: Implement tx power temperature compensation
rt2800 devices should adjust their tx power in accordance with the eeproms temperature calibration values. Add a new driver callback gain_calibration that is called every 4 seconds. The rt2800 gain calibration routine simply runs the tx power configuration that takes care of calculating the temperature compensation delta. We don't need to synchronize the calls to rt2800_config_txpower as they should all happen from mac80211's single threaded workqueue. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Signed-off-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.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}