diff options
author | 2019-01-31 11:38:52 +0000 | |
---|---|---|
committer | 2019-01-31 11:38:52 +0000 | |
commit | cc6e2d0b00bbf6b15eca80582caba36ca2701a5f (patch) | |
tree | 6acda6491aa0fe14ad0942b07ef116719722ffdc | |
parent | thinko, from Scott Cheloha (diff) | |
download | wireguard-openbsd-cc6e2d0b00bbf6b15eca80582caba36ca2701a5f.tar.xz wireguard-openbsd-cc6e2d0b00bbf6b15eca80582caba36ca2701a5f.zip |
Enable IQ/ADC calibration in the athn(4) driver.
Code for this was already present, it was just not being called yet.
Tested on AR9280 and AR9271 by jmc@, kevlo@, jmatthew@, juanfra@, and myself.
-rw-r--r-- | sys/dev/ic/athn.c | 19 | ||||
-rw-r--r-- | sys/dev/ic/athnvar.h | 3 |
2 files changed, 17 insertions, 5 deletions
diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c index 9e8b2924c70..ff3bfbc622d 100644 --- a/sys/dev/ic/athn.c +++ b/sys/dev/ic/athn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: athn.c,v 1.99 2018/04/26 12:50:07 pirofti Exp $ */ +/* $OpenBSD: athn.c,v 1.100 2019/01/31 11:38:52 stsp Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -1268,9 +1268,20 @@ athn_calib_to(void *arg) #ifdef notyet /* XXX ANI. */ athn_ani_monitor(sc); - - ops->next_calib(sc); #endif + + /* Do periodic (every 30 seconds) ADC/IQ calibration. */ + if (sc->cur_calib_mask != 0) { + ops->next_calib(sc); + sc->iqcal_ticks = ticks; + } else if (sc->sup_calib_mask != 0 && + ticks >= sc->iqcal_ticks + 30 * hz) { + memset(&sc->calib, 0, sizeof(sc->calib)); + sc->cur_calib_mask = sc->sup_calib_mask; + ops->do_calib(sc); + sc->iqcal_ticks = ticks; + } + if (ic->ic_fixed_rate == -1) { if (ic->ic_opmode == IEEE80211_M_STA) athn_iter_calib(sc, ic->ic_bss); @@ -2552,7 +2563,7 @@ athn_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) if (sc->sup_calib_mask != 0) { memset(&sc->calib, 0, sizeof(sc->calib)); sc->cur_calib_mask = sc->sup_calib_mask; - /* ops->do_calib(sc); */ + sc->ops.do_calib(sc); } /* XXX Start ANI. */ diff --git a/sys/dev/ic/athnvar.h b/sys/dev/ic/athnvar.h index 2232d5484d2..ac873da792e 100644 --- a/sys/dev/ic/athnvar.h +++ b/sys/dev/ic/athnvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: athnvar.h,v 1.37 2017/01/12 16:32:28 stsp Exp $ */ +/* $OpenBSD: athnvar.h,v 1.38 2019/01/31 11:38:52 stsp Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -494,6 +494,7 @@ struct athn_softc { int8_t pdadc; int8_t tcomp; int olpc_ticks; + int iqcal_ticks; /* PA predistortion. */ uint16_t gain1[AR_MAX_CHAINS]; |