Lines Matching +full:tx +full:- +full:d +full:- +full:cal
1 // SPDX-License-Identifier: GPL-2.0-or-later
8 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
10 Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
33 list_for_each_entry(c, &lo->calib_list, list) { in b43_find_lo_calib()
34 if (!b43_compare_bbatt(&c->bbatt, bbatt)) in b43_find_lo_calib()
36 if (!b43_compare_rfatt(&c->rfatt, rfatt)) in b43_find_lo_calib()
44 /* Write the LocalOscillator Control (adjust) value-pair. */
47 struct b43_phy *phy = &dev->phy; in b43_lo_write()
51 if (unlikely(abs(control->i) > 16 || abs(control->q) > 16)) { in b43_lo_write()
52 b43dbg(dev->wl, "Invalid LO control pair " in b43_lo_write()
53 "(I: %d, Q: %d)\n", control->i, control->q); in b43_lo_write()
58 B43_WARN_ON(phy->type != B43_PHYTYPE_G); in b43_lo_write()
60 value = (u8) (control->q); in b43_lo_write()
61 value |= ((u8) (control->i)) << 8; in b43_lo_write()
68 struct b43_phy *phy = &dev->phy; in lo_measure_feedthrough()
72 if (phy->gmode) { in lo_measure_feedthrough()
88 if ((dev->dev->bus_sprom->boardflags_lo & B43_BFL_EXTLNA) in lo_measure_feedthrough()
89 && phy->rev > 6) in lo_measure_feedthrough()
131 struct b43_phy *phy = &dev->phy; in lo_txctl_register_table()
134 if (phy->type == B43_PHYTYPE_B) { in lo_txctl_register_table()
136 if (phy->radio_rev <= 5) { in lo_txctl_register_table()
144 if (phy->rev >= 2 && phy->radio_rev == 8) { in lo_txctl_register_table()
164 struct b43_phy *phy = &dev->phy; in lo_measure_txctl_values()
165 struct b43_phy_g *gphy = phy->g; in lo_measure_txctl_values()
166 struct b43_txpower_lo_control *lo = gphy->lo_control; in lo_measure_txctl_values()
187 lb_gain = gphy->max_lb_gain / 2; in lo_measure_txctl_values()
190 pga = abs(10 - lb_gain) / 6; in lo_measure_txctl_values()
198 if ((phy->rev >= 2) && in lo_measure_txctl_values()
199 (phy->radio_ver == 0x2050) && (phy->radio_rev == 8)) in lo_measure_txctl_values()
202 if ((10 - lb_gain) < cmp_val) in lo_measure_txctl_values()
203 tmp = (10 - lb_gain); in lo_measure_txctl_values()
239 lo->tx_bias = tx_bias; in lo_measure_txctl_values()
240 lo->tx_magn = tx_magn; in lo_measure_txctl_values()
243 if (lo->tx_bias == 0) in lo_measure_txctl_values()
248 & 0xFF00) | lo->tx_bias | lo-> in lo_measure_txctl_values()
252 lo->tx_magn = 0; in lo_measure_txctl_values()
253 lo->tx_bias = 0; in lo_measure_txctl_values()
254 b43_radio_mask(dev, 0x52, 0xFFF0); /* TX bias == 0 */ in lo_measure_txctl_values()
256 lo->txctl_measured_time = jiffies; in lo_measure_txctl_values()
261 struct b43_phy *phy = &dev->phy; in lo_read_power_vector()
262 struct b43_phy_g *gphy = phy->g; in lo_read_power_vector()
263 struct b43_txpower_lo_control *lo = gphy->lo_control; in lo_read_power_vector()
275 lo->power_vector = power_vector; in lo_read_power_vector()
276 lo->pwr_vec_read_time = jiffies; in lo_read_power_vector()
283 struct b43_phy *phy = &dev->phy; in lo_measure_gain_values()
284 struct b43_phy_g *gphy = phy->g; in lo_measure_gain_values()
294 trsw_rx_gain = gphy->trsw_rx_gain / 2; in lo_measure_gain_values()
296 trsw_rx_gain = max_rx_gain - trsw_rx_gain; in lo_measure_gain_values()
301 gphy->lna_lod_gain = 0; in lo_measure_gain_values()
303 gphy->lna_lod_gain = 1; in lo_measure_gain_values()
304 trsw_rx_gain -= 8; in lo_measure_gain_values()
307 gphy->pga_gain = trsw_rx_gain / 3; in lo_measure_gain_values()
308 if (gphy->pga_gain >= 5) { in lo_measure_gain_values()
309 gphy->pga_gain -= 5; in lo_measure_gain_values()
310 gphy->lna_gain = 2; in lo_measure_gain_values()
312 gphy->lna_gain = 0; in lo_measure_gain_values()
314 gphy->lna_gain = 0; in lo_measure_gain_values()
315 gphy->trsw_rx_gain = 0x20; in lo_measure_gain_values()
317 gphy->lna_lod_gain = 1; in lo_measure_gain_values()
318 gphy->pga_gain = 2; in lo_measure_gain_values()
320 gphy->lna_lod_gain = 1; in lo_measure_gain_values()
321 gphy->pga_gain = 1; in lo_measure_gain_values()
323 gphy->lna_lod_gain = 1; in lo_measure_gain_values()
324 gphy->pga_gain = 0; in lo_measure_gain_values()
326 gphy->lna_lod_gain = 0; in lo_measure_gain_values()
327 gphy->pga_gain = 0; in lo_measure_gain_values()
332 if (gphy->lna_lod_gain == 0) in lo_measure_gain_values()
375 struct ssb_sprom *sprom = dev->dev->bus_sprom; in lo_measure_setup()
376 struct b43_phy *phy = &dev->phy; in lo_measure_setup()
377 struct b43_phy_g *gphy = phy->g; in lo_measure_setup()
378 struct b43_txpower_lo_control *lo = gphy->lo_control; in lo_measure_setup()
382 sav->phy_lo_mask = b43_phy_read(dev, B43_PHY_LO_MASK); in lo_measure_setup()
383 sav->phy_extg_01 = b43_phy_read(dev, B43_PHY_EXTG(0x01)); in lo_measure_setup()
384 sav->phy_dacctl_hwpctl = b43_phy_read(dev, B43_PHY_DACCTL); in lo_measure_setup()
385 sav->phy_cck_14 = b43_phy_read(dev, B43_PHY_CCK(0x14)); in lo_measure_setup()
386 sav->phy_hpwr_tssictl = b43_phy_read(dev, B43_PHY_HPWR_TSSICTL); in lo_measure_setup()
393 if (phy->type == B43_PHYTYPE_B && in lo_measure_setup()
394 phy->radio_ver == 0x2050 && phy->radio_rev < 6) { in lo_measure_setup()
398 if (phy->rev >= 2) { in lo_measure_setup()
399 sav->phy_analogover = b43_phy_read(dev, B43_PHY_ANALOGOVER); in lo_measure_setup()
400 sav->phy_analogoverval = in lo_measure_setup()
402 sav->phy_rfover = b43_phy_read(dev, B43_PHY_RFOVER); in lo_measure_setup()
403 sav->phy_rfoverval = b43_phy_read(dev, B43_PHY_RFOVERVAL); in lo_measure_setup()
404 sav->phy_classctl = b43_phy_read(dev, B43_PHY_CLASSCTL); in lo_measure_setup()
405 sav->phy_cck_3E = b43_phy_read(dev, B43_PHY_CCK(0x3E)); in lo_measure_setup()
406 sav->phy_crs0 = b43_phy_read(dev, B43_PHY_CRS0); in lo_measure_setup()
412 if (phy->type == B43_PHYTYPE_G) { in lo_measure_setup()
413 if ((phy->rev >= 7) && in lo_measure_setup()
414 (sprom->boardflags_lo & B43_BFL_EXTLNA)) { in lo_measure_setup()
424 sav->reg_3F4 = b43_read16(dev, 0x3F4); in lo_measure_setup()
425 sav->reg_3E2 = b43_read16(dev, 0x3E2); in lo_measure_setup()
426 sav->radio_43 = b43_radio_read16(dev, 0x43); in lo_measure_setup()
427 sav->radio_7A = b43_radio_read16(dev, 0x7A); in lo_measure_setup()
428 sav->phy_pgactl = b43_phy_read(dev, B43_PHY_PGACTL); in lo_measure_setup()
429 sav->phy_cck_2A = b43_phy_read(dev, B43_PHY_CCK(0x2A)); in lo_measure_setup()
430 sav->phy_syncctl = b43_phy_read(dev, B43_PHY_SYNCCTL); in lo_measure_setup()
431 sav->phy_dacctl = b43_phy_read(dev, B43_PHY_DACCTL); in lo_measure_setup()
434 sav->radio_52 = b43_radio_read16(dev, 0x52); in lo_measure_setup()
435 sav->radio_52 &= 0x00F0; in lo_measure_setup()
437 if (phy->type == B43_PHYTYPE_B) { in lo_measure_setup()
438 sav->phy_cck_30 = b43_phy_read(dev, B43_PHY_CCK(0x30)); in lo_measure_setup()
439 sav->phy_cck_06 = b43_phy_read(dev, B43_PHY_CCK(0x06)); in lo_measure_setup()
450 (phy->type == B43_PHYTYPE_G) ? B43_PHY_LO_MASK : B43_PHY_CCK(0x2E); in lo_measure_setup()
453 tmp = sav->phy_syncctl; in lo_measure_setup()
455 tmp = sav->radio_7A; in lo_measure_setup()
459 if (phy->type == B43_PHYTYPE_G || in lo_measure_setup()
460 (phy->type == B43_PHYTYPE_B && in lo_measure_setup()
461 phy->radio_ver == 0x2050 && phy->radio_rev >= 6)) { in lo_measure_setup()
465 if (phy->rev >= 2) in lo_measure_setup()
469 if (phy->type == B43_PHYTYPE_G) in lo_measure_setup()
472 /* Re-measure the txctl values, if needed. */ in lo_measure_setup()
473 if (time_before(lo->txctl_measured_time, in lo_measure_setup()
474 jiffies - B43_LO_TXCTL_EXPIRE)) in lo_measure_setup()
477 if (phy->type == B43_PHYTYPE_G && phy->rev >= 3) { in lo_measure_setup()
480 if (phy->type == B43_PHYTYPE_B) in lo_measure_setup()
490 struct b43_phy *phy = &dev->phy; in lo_measure_restore()
491 struct b43_phy_g *gphy = phy->g; in lo_measure_restore()
494 if (phy->rev >= 2) { in lo_measure_restore()
496 tmp = (gphy->pga_gain << 8); in lo_measure_restore()
503 tmp = (gphy->pga_gain | 0xEFA0); in lo_measure_restore()
506 if (phy->type == B43_PHYTYPE_G) { in lo_measure_restore()
507 if (phy->rev >= 3) in lo_measure_restore()
511 if (phy->rev >= 2) in lo_measure_restore()
516 b43_write16(dev, 0x3F4, sav->reg_3F4); in lo_measure_restore()
517 b43_phy_write(dev, B43_PHY_PGACTL, sav->phy_pgactl); in lo_measure_restore()
518 b43_phy_write(dev, B43_PHY_CCK(0x2A), sav->phy_cck_2A); in lo_measure_restore()
519 b43_phy_write(dev, B43_PHY_SYNCCTL, sav->phy_syncctl); in lo_measure_restore()
520 b43_phy_write(dev, B43_PHY_DACCTL, sav->phy_dacctl); in lo_measure_restore()
521 b43_radio_write16(dev, 0x43, sav->radio_43); in lo_measure_restore()
522 b43_radio_write16(dev, 0x7A, sav->radio_7A); in lo_measure_restore()
524 tmp = sav->radio_52; in lo_measure_restore()
527 b43_write16(dev, 0x3E2, sav->reg_3E2); in lo_measure_restore()
528 if (phy->type == B43_PHYTYPE_B && in lo_measure_restore()
529 phy->radio_ver == 0x2050 && phy->radio_rev <= 5) { in lo_measure_restore()
530 b43_phy_write(dev, B43_PHY_CCK(0x30), sav->phy_cck_30); in lo_measure_restore()
531 b43_phy_write(dev, B43_PHY_CCK(0x06), sav->phy_cck_06); in lo_measure_restore()
533 if (phy->rev >= 2) { in lo_measure_restore()
534 b43_phy_write(dev, B43_PHY_ANALOGOVER, sav->phy_analogover); in lo_measure_restore()
536 sav->phy_analogoverval); in lo_measure_restore()
537 b43_phy_write(dev, B43_PHY_CLASSCTL, sav->phy_classctl); in lo_measure_restore()
538 b43_phy_write(dev, B43_PHY_RFOVER, sav->phy_rfover); in lo_measure_restore()
539 b43_phy_write(dev, B43_PHY_RFOVERVAL, sav->phy_rfoverval); in lo_measure_restore()
540 b43_phy_write(dev, B43_PHY_CCK(0x3E), sav->phy_cck_3E); in lo_measure_restore()
541 b43_phy_write(dev, B43_PHY_CRS0, sav->phy_crs0); in lo_measure_restore()
544 tmp = (sav->phy_lo_mask & 0xBFFF); in lo_measure_restore()
546 b43_phy_write(dev, B43_PHY_EXTG(0x01), sav->phy_extg_01); in lo_measure_restore()
547 b43_phy_write(dev, B43_PHY_DACCTL, sav->phy_dacctl_hwpctl); in lo_measure_restore()
548 b43_phy_write(dev, B43_PHY_CCK(0x14), sav->phy_cck_14); in lo_measure_restore()
549 b43_phy_write(dev, B43_PHY_HPWR_TSSICTL, sav->phy_hpwr_tssictl); in lo_measure_restore()
551 b43_gphy_channel_switch(dev, sav->old_channel, 1); in lo_measure_restore()
565 struct b43_lo_g_statemachine *d) in lo_probe_possible_loctls() argument
567 struct b43_phy *phy = &dev->phy; in lo_probe_possible_loctls()
568 struct b43_phy_g *gphy = phy->g; in lo_probe_possible_loctls()
572 .i = -100, in lo_probe_possible_loctls()
573 .q = -100, in lo_probe_possible_loctls()
583 {.i = 1,.q = -1,}, in lo_probe_possible_loctls()
584 {.i = 0,.q = -1,}, in lo_probe_possible_loctls()
585 {.i = -1,.q = -1,}, in lo_probe_possible_loctls()
586 {.i = -1,.q = 0,}, in lo_probe_possible_loctls()
587 {.i = -1,.q = 1,}, in lo_probe_possible_loctls()
591 if (d->current_state == 0) { in lo_probe_possible_loctls()
594 } else if (d->current_state % 2 == 0) { in lo_probe_possible_loctls()
595 begin = d->current_state - 1; in lo_probe_possible_loctls()
596 end = d->current_state + 1; in lo_probe_possible_loctls()
598 begin = d->current_state - 2; in lo_probe_possible_loctls()
599 end = d->current_state + 2; in lo_probe_possible_loctls()
604 end -= 8; in lo_probe_possible_loctls()
608 d->current_state = i; in lo_probe_possible_loctls()
612 test_loctl.i += modifiers[i - 1].i * d->state_val_multiplier; in lo_probe_possible_loctls()
613 test_loctl.q += modifiers[i - 1].q * d->state_val_multiplier; in lo_probe_possible_loctls()
618 feedth = lo_measure_feedthrough(dev, gphy->lna_gain, in lo_probe_possible_loctls()
619 gphy->pga_gain, in lo_probe_possible_loctls()
620 gphy->trsw_rx_gain); in lo_probe_possible_loctls()
621 if (feedth < d->lowest_feedth) { in lo_probe_possible_loctls()
625 d->lowest_feedth = feedth; in lo_probe_possible_loctls()
626 if ((d->nr_measured < 2) && in lo_probe_possible_loctls()
638 d->current_state = i; in lo_probe_possible_loctls()
648 struct b43_phy *phy = &dev->phy; in lo_probe_loctls_statemachine()
649 struct b43_phy_g *gphy = phy->g; in lo_probe_loctls_statemachine()
650 struct b43_lo_g_statemachine d; in lo_probe_loctls_statemachine() local
656 d.nr_measured = 0; in lo_probe_loctls_statemachine()
657 d.state_val_multiplier = 1; in lo_probe_loctls_statemachine()
659 d.state_val_multiplier = 3; in lo_probe_loctls_statemachine()
661 memcpy(&d.min_loctl, loctl, sizeof(struct b43_loctl)); in lo_probe_loctls_statemachine()
665 b43_lo_write(dev, &d.min_loctl); in lo_probe_loctls_statemachine()
666 feedth = lo_measure_feedthrough(dev, gphy->lna_gain, in lo_probe_loctls_statemachine()
667 gphy->pga_gain, in lo_probe_loctls_statemachine()
668 gphy->trsw_rx_gain); in lo_probe_loctls_statemachine()
674 feedth = lo_measure_feedthrough(dev, gphy->lna_gain, in lo_probe_loctls_statemachine()
675 gphy->pga_gain, in lo_probe_loctls_statemachine()
676 gphy->trsw_rx_gain); in lo_probe_loctls_statemachine()
678 d.lowest_feedth = feedth; in lo_probe_loctls_statemachine()
680 d.current_state = 0; in lo_probe_loctls_statemachine()
683 (d.current_state >= 0 in lo_probe_loctls_statemachine()
684 && d.current_state <= 8)); in lo_probe_loctls_statemachine()
685 memcpy(&probe_loctl, &d.min_loctl, in lo_probe_loctls_statemachine()
688 lo_probe_possible_loctls(dev, &probe_loctl, &d); in lo_probe_loctls_statemachine()
691 if ((probe_loctl.i == d.min_loctl.i) && in lo_probe_loctls_statemachine()
692 (probe_loctl.q == d.min_loctl.q)) in lo_probe_loctls_statemachine()
694 memcpy(&d.min_loctl, &probe_loctl, in lo_probe_loctls_statemachine()
696 d.nr_measured++; in lo_probe_loctls_statemachine()
697 } while (d.nr_measured < 24); in lo_probe_loctls_statemachine()
698 memcpy(loctl, &d.min_loctl, sizeof(struct b43_loctl)); in lo_probe_loctls_statemachine()
701 if (d.lowest_feedth > 0x1194) in lo_probe_loctls_statemachine()
702 *max_rx_gain -= 6; in lo_probe_loctls_statemachine()
703 else if (d.lowest_feedth < 0x5DC) in lo_probe_loctls_statemachine()
706 if (d.lowest_feedth <= 0x5DC) { in lo_probe_loctls_statemachine()
707 d.state_val_multiplier = 1; in lo_probe_loctls_statemachine()
710 d.state_val_multiplier = 2; in lo_probe_loctls_statemachine()
712 d.state_val_multiplier = 1; in lo_probe_loctls_statemachine()
724 struct b43_phy *phy = &dev->phy; in b43_calibrate_lo_setting()
725 struct b43_phy_g *gphy = phy->g; in b43_calibrate_lo_setting()
731 struct b43_lo_calib *cal; in b43_calibrate_lo_setting() local
738 saved_regs.old_channel = phy->channel; in b43_calibrate_lo_setting()
744 b43_radio_maskset(dev, 0x43, 0xFFF0, rfatt->att); in b43_calibrate_lo_setting()
745 b43_radio_maskset(dev, txctl_reg, ~txctl_value, (rfatt->with_padmix ? txctl_value :0)); in b43_calibrate_lo_setting()
747 max_rx_gain = rfatt->att * 2; in b43_calibrate_lo_setting()
748 max_rx_gain += bbatt->att / 2; in b43_calibrate_lo_setting()
749 if (rfatt->with_padmix) in b43_calibrate_lo_setting()
750 max_rx_gain -= pad_mix_gain; in b43_calibrate_lo_setting()
752 max_rx_gain += gphy->max_lb_gain; in b43_calibrate_lo_setting()
756 b43_gphy_set_baseband_attenuation(dev, bbatt->att); in b43_calibrate_lo_setting()
763 b43dbg(dev->wl, "LO: Calibrated for BB(%u), RF(%u,%u) " in b43_calibrate_lo_setting()
764 "=> I=%d Q=%d\n", in b43_calibrate_lo_setting()
765 bbatt->att, rfatt->att, rfatt->with_padmix, in b43_calibrate_lo_setting()
769 cal = kmalloc(sizeof(*cal), GFP_KERNEL); in b43_calibrate_lo_setting()
770 if (!cal) { in b43_calibrate_lo_setting()
771 b43warn(dev->wl, "LO calib: out of memory\n"); in b43_calibrate_lo_setting()
774 memcpy(&cal->bbatt, bbatt, sizeof(*bbatt)); in b43_calibrate_lo_setting()
775 memcpy(&cal->rfatt, rfatt, sizeof(*rfatt)); in b43_calibrate_lo_setting()
776 memcpy(&cal->ctl, &loctl, sizeof(loctl)); in b43_calibrate_lo_setting()
777 cal->calib_time = jiffies; in b43_calibrate_lo_setting()
778 INIT_LIST_HEAD(&cal->list); in b43_calibrate_lo_setting()
780 return cal; in b43_calibrate_lo_setting()
790 struct b43_txpower_lo_control *lo = dev->phy.g->lo_control; in b43_get_calib_lo_settings()
801 list_add(&c->list, &lo->calib_list); in b43_get_calib_lo_settings()
808 struct b43_phy *phy = &dev->phy; in b43_gphy_dc_lt_init()
809 struct b43_phy_g *gphy = phy->g; in b43_gphy_dc_lt_init()
810 struct b43_txpower_lo_control *lo = gphy->lo_control; in b43_gphy_dc_lt_init()
819 B43_WARN_ON(lo->rfatt_list.len * lo->bbatt_list.len > 64); in b43_gphy_dc_lt_init()
821 power_vector = lo->power_vector; in b43_gphy_dc_lt_init()
830 struct b43_lo_calib *cal; in b43_gphy_dc_lt_init() local
838 bb_offset = i / lo->rfatt_list.len; in b43_gphy_dc_lt_init()
839 rf_offset = i % lo->rfatt_list.len; in b43_gphy_dc_lt_init()
840 bbatt = &(lo->bbatt_list.list[bb_offset]); in b43_gphy_dc_lt_init()
841 rfatt = &(lo->rfatt_list.list[rf_offset]); in b43_gphy_dc_lt_init()
843 cal = b43_calibrate_lo_setting(dev, bbatt, rfatt); in b43_gphy_dc_lt_init()
844 if (!cal) { in b43_gphy_dc_lt_init()
845 b43warn(dev->wl, "LO: Could not " in b43_gphy_dc_lt_init()
850 val = (u8)(cal->ctl.q); in b43_gphy_dc_lt_init()
851 val |= ((u8)(cal->ctl.i)) << 4; in b43_gphy_dc_lt_init()
852 kfree(cal); in b43_gphy_dc_lt_init()
859 lo->dc_lt[idx] = (lo->dc_lt[idx] & 0x00FF) in b43_gphy_dc_lt_init()
863 lo->dc_lt[idx] = (lo->dc_lt[idx] & 0xFF00) in b43_gphy_dc_lt_init()
871 b43_phy_write(dev, 0x3A0 + i, lo->dc_lt[i]); in b43_gphy_dc_lt_init()
880 if (!rf->with_padmix) in b43_lo_fixup_rfatt()
882 if ((rf->att != 1) && (rf->att != 2) && (rf->att != 3)) in b43_lo_fixup_rfatt()
883 rf->att = 4; in b43_lo_fixup_rfatt()
888 struct b43_phy_g *gphy = dev->phy.g; in b43_lo_g_adjust()
889 struct b43_lo_calib *cal; in b43_lo_g_adjust() local
892 memcpy(&rf, &gphy->rfatt, sizeof(rf)); in b43_lo_g_adjust()
895 cal = b43_get_calib_lo_settings(dev, &gphy->bbatt, &rf); in b43_lo_g_adjust()
896 if (!cal) in b43_lo_g_adjust()
898 b43_lo_write(dev, &cal->ctl); in b43_lo_g_adjust()
906 struct b43_lo_calib *cal; in b43_lo_g_adjust_to() local
913 cal = b43_get_calib_lo_settings(dev, &bb, &rf); in b43_lo_g_adjust_to()
914 if (!cal) in b43_lo_g_adjust_to()
916 b43_lo_write(dev, &cal->ctl); in b43_lo_g_adjust_to()
922 struct b43_phy *phy = &dev->phy; in b43_lo_g_maintenance_work()
923 struct b43_phy_g *gphy = phy->g; in b43_lo_g_maintenance_work()
924 struct b43_txpower_lo_control *lo = gphy->lo_control; in b43_lo_g_maintenance_work()
927 struct b43_lo_calib *cal, *tmp; in b43_lo_g_maintenance_work() local
938 expire = now - B43_LO_PWRVEC_EXPIRE; in b43_lo_g_maintenance_work()
939 if (time_before(lo->pwr_vec_read_time, expire)) { in b43_lo_g_maintenance_work()
950 expire = now - B43_LO_CALIB_EXPIRE; in b43_lo_g_maintenance_work()
951 list_for_each_entry_safe(cal, tmp, &lo->calib_list, list) { in b43_lo_g_maintenance_work()
952 if (!time_before(cal->calib_time, expire)) in b43_lo_g_maintenance_work()
955 if (b43_compare_bbatt(&cal->bbatt, &gphy->bbatt) && in b43_lo_g_maintenance_work()
956 b43_compare_rfatt(&cal->rfatt, &gphy->rfatt)) { in b43_lo_g_maintenance_work()
961 b43dbg(dev->wl, "LO: Item BB(%u), RF(%u,%u), " in b43_lo_g_maintenance_work()
962 "I=%d, Q=%d expired\n", in b43_lo_g_maintenance_work()
963 cal->bbatt.att, cal->rfatt.att, in b43_lo_g_maintenance_work()
964 cal->rfatt.with_padmix, in b43_lo_g_maintenance_work()
965 cal->ctl.i, cal->ctl.q); in b43_lo_g_maintenance_work()
967 list_del(&cal->list); in b43_lo_g_maintenance_work()
968 kfree(cal); in b43_lo_g_maintenance_work()
970 if (current_item_expired || unlikely(list_empty(&lo->calib_list))) { in b43_lo_g_maintenance_work()
973 b43dbg(dev->wl, "LO: Recalibrating current LO setting\n"); in b43_lo_g_maintenance_work()
974 cal = b43_calibrate_lo_setting(dev, &gphy->bbatt, &gphy->rfatt); in b43_lo_g_maintenance_work()
975 if (cal) { in b43_lo_g_maintenance_work()
976 list_add(&cal->list, &lo->calib_list); in b43_lo_g_maintenance_work()
977 b43_lo_write(dev, &cal->ctl); in b43_lo_g_maintenance_work()
979 b43warn(dev->wl, "Failed to recalibrate current LO setting\n"); in b43_lo_g_maintenance_work()
985 struct b43_txpower_lo_control *lo = dev->phy.g->lo_control; in b43_lo_g_cleanup()
986 struct b43_lo_calib *cal, *tmp; in b43_lo_g_cleanup() local
990 list_for_each_entry_safe(cal, tmp, &lo->calib_list, list) { in b43_lo_g_cleanup()
991 list_del(&cal->list); in b43_lo_g_cleanup()
992 kfree(cal); in b43_lo_g_cleanup()