diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-01-31 11:38:53 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-01-31 11:38:53 +0000 |
commit | 1a094c6172aa074b4f45b736157cd76b23655e53 (patch) | |
tree | d2d4e7afa298efcd4aa5a51fd3d68082f99e0f77 /sys/dev | |
parent | 3bfb2441226d541a7af85f58f27630404d8b229c (diff) |
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.
Diffstat (limited to 'sys/dev')
-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]; |