~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/net/wireless/rt2x00/rt2x00link.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
192
192
        /*
193
193
         * Determine if software diversity is enabled for
194
194
         * either the TX or RX antenna (or both).
195
 
         * Always perform this check since within the link
196
 
         * tuner interval the configuration might have changed.
197
195
         */
198
 
        ant->flags &= ~ANTENNA_RX_DIVERSITY;
199
 
        ant->flags &= ~ANTENNA_TX_DIVERSITY;
200
 
 
201
 
        if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
202
 
                ant->flags |= ANTENNA_RX_DIVERSITY;
203
 
        if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
204
 
                ant->flags |= ANTENNA_TX_DIVERSITY;
205
 
 
206
196
        if (!(ant->flags & ANTENNA_RX_DIVERSITY) &&
207
197
            !(ant->flags & ANTENNA_TX_DIVERSITY)) {
208
198
                ant->flags = 0;
283
273
        /**
284
274
         * While scanning, link tuning is disabled. By default
285
275
         * the most sensitive settings will be used to make sure
286
 
         * that all beacons and probe responses will be recieved
 
276
         * that all beacons and probe responses will be received
287
277
         * during the scan.
288
278
         */
289
279
        if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags))
383
373
         * do not support link tuning at all, while other devices can disable
384
374
         * the feature from the EEPROM.
385
375
         */
386
 
        if (test_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags))
 
376
        if (test_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags))
387
377
                rt2x00dev->ops->lib->link_tuner(rt2x00dev, qual, link->count);
388
378
 
389
379
        /*
413
403
{
414
404
        struct link *link = &rt2x00dev->link;
415
405
 
416
 
        if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) ||
417
 
            !test_bit(DRIVER_SUPPORT_WATCHDOG, &rt2x00dev->flags))
418
 
                return;
419
 
 
420
 
        schedule_delayed_work(&link->watchdog_work, WATCHDOG_INTERVAL);
 
406
        if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) &&
 
407
            rt2x00dev->ops->lib->watchdog)
 
408
                ieee80211_queue_delayed_work(rt2x00dev->hw,
 
409
                                             &link->watchdog_work,
 
410
                                             WATCHDOG_INTERVAL);
421
411
}
422
412
 
423
413
void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev)
441
431
        rt2x00dev->ops->lib->watchdog(rt2x00dev);
442
432
 
443
433
        if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
444
 
                schedule_delayed_work(&link->watchdog_work, WATCHDOG_INTERVAL);
 
434
                ieee80211_queue_delayed_work(rt2x00dev->hw,
 
435
                                             &link->watchdog_work,
 
436
                                             WATCHDOG_INTERVAL);
 
437
}
 
438
 
 
439
void rt2x00link_start_agc(struct rt2x00_dev *rt2x00dev)
 
440
{
 
441
        struct link *link = &rt2x00dev->link;
 
442
 
 
443
        if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) &&
 
444
            rt2x00dev->ops->lib->gain_calibration)
 
445
                ieee80211_queue_delayed_work(rt2x00dev->hw,
 
446
                                             &link->agc_work,
 
447
                                             AGC_INTERVAL);
 
448
}
 
449
 
 
450
void rt2x00link_stop_agc(struct rt2x00_dev *rt2x00dev)
 
451
{
 
452
        cancel_delayed_work_sync(&rt2x00dev->link.agc_work);
 
453
}
 
454
 
 
455
static void rt2x00link_agc(struct work_struct *work)
 
456
{
 
457
        struct rt2x00_dev *rt2x00dev =
 
458
            container_of(work, struct rt2x00_dev, link.agc_work.work);
 
459
        struct link *link = &rt2x00dev->link;
 
460
 
 
461
        /*
 
462
         * When the radio is shutting down we should
 
463
         * immediately cease the watchdog monitoring.
 
464
         */
 
465
        if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
 
466
                return;
 
467
 
 
468
        rt2x00dev->ops->lib->gain_calibration(rt2x00dev);
 
469
 
 
470
        if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
 
471
                ieee80211_queue_delayed_work(rt2x00dev->hw,
 
472
                                             &link->agc_work,
 
473
                                             AGC_INTERVAL);
445
474
}
446
475
 
447
476
void rt2x00link_register(struct rt2x00_dev *rt2x00dev)
448
477
{
 
478
        INIT_DELAYED_WORK(&rt2x00dev->link.agc_work, rt2x00link_agc);
449
479
        INIT_DELAYED_WORK(&rt2x00dev->link.watchdog_work, rt2x00link_watchdog);
450
480
        INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner);
451
481
}