void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna) { struct link_qual *qual = &rt2x00dev->link.qual; u8 vgc_level = qual->vgc_level_reg; if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) return; /* * Reset link information. * Both the currently active vgc level as well as * the link tuner counter should be reset. Resetting * the counter is important for devices where the * device should only perform link tuning during the * first minute after being enabled. */ rt2x00dev->link.count = 0; memset(qual, 0, sizeof(*qual)); ewma_rssi_init(&rt2x00dev->link.avg_rssi); /* * Restore the VGC level as stored in the registers, * the driver can use this to determine if the register * must be updated during reset or not. */ qual->vgc_level_reg = vgc_level; /* * Reset the link tuner. */ rt2x00dev->ops->lib->reset_tuner(rt2x00dev, qual); if (antenna) rt2x00link_antenna_reset(rt2x00dev); }
void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna) { struct link_qual *qual = &rt2x00dev->link.qual; if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) return; /* * Reset link information. * Both the currently active vgc level as well as * the link tuner counter should be reset. Resetting * the counter is important for devices where the * device should only perform link tuning during the * first minute after being enabled. */ rt2x00dev->link.count = 0; memset(qual, 0, sizeof(*qual)); /* * Reset the link tuner. */ rt2x00dev->ops->lib->reset_tuner(rt2x00dev, qual); if (antenna) rt2x00link_antenna_reset(rt2x00dev); }