Lines Matching refs:rt2x00dev
36 static int rt2x00link_antenna_get_link_rssi(struct rt2x00_dev *rt2x00dev) in rt2x00link_antenna_get_link_rssi() argument
38 struct link_ant *ant = &rt2x00dev->link.ant; in rt2x00link_antenna_get_link_rssi()
40 if (rt2x00dev->link.qual.rx_success) in rt2x00link_antenna_get_link_rssi()
46 static int rt2x00link_antenna_get_rssi_history(struct rt2x00_dev *rt2x00dev) in rt2x00link_antenna_get_rssi_history() argument
48 struct link_ant *ant = &rt2x00dev->link.ant; in rt2x00link_antenna_get_rssi_history()
55 static void rt2x00link_antenna_update_rssi_history(struct rt2x00_dev *rt2x00dev, in rt2x00link_antenna_update_rssi_history() argument
58 struct link_ant *ant = &rt2x00dev->link.ant; in rt2x00link_antenna_update_rssi_history()
62 static void rt2x00link_antenna_reset(struct rt2x00_dev *rt2x00dev) in rt2x00link_antenna_reset() argument
64 ewma_rssi_init(&rt2x00dev->link.ant.rssi_ant); in rt2x00link_antenna_reset()
67 static void rt2x00lib_antenna_diversity_sample(struct rt2x00_dev *rt2x00dev) in rt2x00lib_antenna_diversity_sample() argument
69 struct link_ant *ant = &rt2x00dev->link.ant; in rt2x00lib_antenna_diversity_sample()
73 int sample_current = rt2x00link_antenna_get_link_rssi(rt2x00dev); in rt2x00lib_antenna_diversity_sample()
74 int sample_other = rt2x00link_antenna_get_rssi_history(rt2x00dev); in rt2x00lib_antenna_diversity_sample()
92 rt2x00link_antenna_update_rssi_history(rt2x00dev, in rt2x00lib_antenna_diversity_sample()
105 rt2x00lib_config_antenna(rt2x00dev, new_ant); in rt2x00lib_antenna_diversity_sample()
108 static void rt2x00lib_antenna_diversity_eval(struct rt2x00_dev *rt2x00dev) in rt2x00lib_antenna_diversity_eval() argument
110 struct link_ant *ant = &rt2x00dev->link.ant; in rt2x00lib_antenna_diversity_eval()
121 rssi_curr = rt2x00link_antenna_get_link_rssi(rt2x00dev); in rt2x00lib_antenna_diversity_eval()
122 rssi_old = rt2x00link_antenna_get_rssi_history(rt2x00dev); in rt2x00lib_antenna_diversity_eval()
123 rt2x00link_antenna_update_rssi_history(rt2x00dev, rssi_curr); in rt2x00lib_antenna_diversity_eval()
145 rt2x00lib_config_antenna(rt2x00dev, new_ant); in rt2x00lib_antenna_diversity_eval()
148 static bool rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev) in rt2x00lib_antenna_diversity() argument
150 struct link_ant *ant = &rt2x00dev->link.ant; in rt2x00lib_antenna_diversity()
169 rt2x00lib_antenna_diversity_sample(rt2x00dev); in rt2x00lib_antenna_diversity()
171 } else if (rt2x00dev->link.count & 1) { in rt2x00lib_antenna_diversity()
172 rt2x00lib_antenna_diversity_eval(rt2x00dev); in rt2x00lib_antenna_diversity()
179 void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev, in rt2x00link_update_stats() argument
183 struct link *link = &rt2x00dev->link; in rt2x00link_update_stats()
184 struct link_qual *qual = &rt2x00dev->link.qual; in rt2x00link_update_stats()
185 struct link_ant *ant = &rt2x00dev->link.ant; in rt2x00link_update_stats()
191 if (!rt2x00dev->intf_sta_count) in rt2x00link_update_stats()
220 void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev) in rt2x00link_start_tuner() argument
222 struct link *link = &rt2x00dev->link; in rt2x00link_start_tuner()
228 if (!rt2x00dev->intf_ap_count && !rt2x00dev->intf_sta_count) in rt2x00link_start_tuner()
237 if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) in rt2x00link_start_tuner()
240 rt2x00link_reset_tuner(rt2x00dev, false); in rt2x00link_start_tuner()
242 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) in rt2x00link_start_tuner()
243 ieee80211_queue_delayed_work(rt2x00dev->hw, in rt2x00link_start_tuner()
247 void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev) in rt2x00link_stop_tuner() argument
249 cancel_delayed_work_sync(&rt2x00dev->link.work); in rt2x00link_stop_tuner()
252 void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna) in rt2x00link_reset_tuner() argument
254 struct link_qual *qual = &rt2x00dev->link.qual; in rt2x00link_reset_tuner()
257 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00link_reset_tuner()
268 rt2x00dev->link.count = 0; in rt2x00link_reset_tuner()
270 ewma_rssi_init(&rt2x00dev->link.avg_rssi); in rt2x00link_reset_tuner()
282 rt2x00dev->ops->lib->reset_tuner(rt2x00dev, qual); in rt2x00link_reset_tuner()
285 rt2x00link_antenna_reset(rt2x00dev); in rt2x00link_reset_tuner()
288 static void rt2x00link_reset_qual(struct rt2x00_dev *rt2x00dev) in rt2x00link_reset_qual() argument
290 struct link_qual *qual = &rt2x00dev->link.qual; in rt2x00link_reset_qual()
298 static void rt2x00link_tuner_sta(struct rt2x00_dev *rt2x00dev, struct link *link) in rt2x00link_tuner_sta() argument
300 struct link_qual *qual = &rt2x00dev->link.qual; in rt2x00link_tuner_sta()
305 rt2x00dev->ops->lib->link_stats(rt2x00dev, qual); in rt2x00link_tuner_sta()
306 rt2x00dev->low_level_stats.dot11FCSErrorCount += qual->rx_failed; in rt2x00link_tuner_sta()
324 if (rt2x00_has_cap_link_tuning(rt2x00dev)) in rt2x00link_tuner_sta()
325 rt2x00dev->ops->lib->link_tuner(rt2x00dev, qual, link->count); in rt2x00link_tuner_sta()
330 rt2x00leds_led_quality(rt2x00dev, qual->rssi); in rt2x00link_tuner_sta()
337 if (rt2x00lib_antenna_diversity(rt2x00dev)) in rt2x00link_tuner_sta()
338 rt2x00link_reset_qual(rt2x00dev); in rt2x00link_tuner_sta()
343 struct rt2x00_dev *rt2x00dev = in rt2x00link_tuner() local
345 struct link *link = &rt2x00dev->link; in rt2x00link_tuner()
351 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags) || in rt2x00link_tuner()
352 test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) in rt2x00link_tuner()
356 mutex_lock(&rt2x00dev->conf_mutex); in rt2x00link_tuner()
358 if (rt2x00dev->intf_sta_count) in rt2x00link_tuner()
359 rt2x00link_tuner_sta(rt2x00dev, link); in rt2x00link_tuner()
361 if (rt2x00dev->ops->lib->gain_calibration && in rt2x00link_tuner()
363 rt2x00dev->ops->lib->gain_calibration(rt2x00dev); in rt2x00link_tuner()
365 if (rt2x00dev->ops->lib->vco_calibration && in rt2x00link_tuner()
366 rt2x00_has_cap_vco_recalibration(rt2x00dev) && in rt2x00link_tuner()
368 rt2x00dev->ops->lib->vco_calibration(rt2x00dev); in rt2x00link_tuner()
370 mutex_unlock(&rt2x00dev->conf_mutex); in rt2x00link_tuner()
377 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) in rt2x00link_tuner()
378 ieee80211_queue_delayed_work(rt2x00dev->hw, in rt2x00link_tuner()
382 void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev) in rt2x00link_start_watchdog() argument
384 struct link *link = &rt2x00dev->link; in rt2x00link_start_watchdog()
386 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && in rt2x00link_start_watchdog()
387 rt2x00dev->ops->lib->watchdog && !link->watchdog_disabled) in rt2x00link_start_watchdog()
388 ieee80211_queue_delayed_work(rt2x00dev->hw, in rt2x00link_start_watchdog()
393 void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev) in rt2x00link_stop_watchdog() argument
395 cancel_delayed_work_sync(&rt2x00dev->link.watchdog_work); in rt2x00link_stop_watchdog()
400 struct rt2x00_dev *rt2x00dev = in rt2x00link_watchdog() local
402 struct link *link = &rt2x00dev->link; in rt2x00link_watchdog()
408 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00link_watchdog()
411 rt2x00dev->ops->lib->watchdog(rt2x00dev); in rt2x00link_watchdog()
413 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) in rt2x00link_watchdog()
414 ieee80211_queue_delayed_work(rt2x00dev->hw, in rt2x00link_watchdog()
419 void rt2x00link_register(struct rt2x00_dev *rt2x00dev) in rt2x00link_register() argument
421 struct link *link = &rt2x00dev->link; in rt2x00link_register()