diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2010-08-12 16:32:32 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2010-08-12 16:32:32 +0000 |
commit | 38d7afdf38d77cbf469512c9130c47ae5c586049 (patch) | |
tree | 76f808c994a039583e6d1a589a6162b3e7dcea57 /sys | |
parent | 8dda537fe7f2a5380b3fff938b17b0d3c28f078c (diff) |
For chips in open-loop power control mode, periodically (every 30 secs)
compensate Tx gain for temperature changes.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/ar5008.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/ar9280.c | 3 | ||||
-rw-r--r-- | sys/dev/ic/ar9287.c | 3 | ||||
-rw-r--r-- | sys/dev/ic/athn.c | 15 | ||||
-rw-r--r-- | sys/dev/ic/athnvar.h | 4 |
5 files changed, 25 insertions, 8 deletions
diff --git a/sys/dev/ic/ar5008.c b/sys/dev/ic/ar5008.c index c0fc2f759ea..e48a400cb1c 100644 --- a/sys/dev/ic/ar5008.c +++ b/sys/dev/ic/ar5008.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar5008.c,v 1.11 2010/07/15 19:38:40 damien Exp $ */ +/* $OpenBSD: ar5008.c,v 1.12 2010/08/12 16:32:31 damien Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -2293,8 +2293,12 @@ ar5008_hw_init(struct athn_softc *sc, struct ieee80211_channel *c, ar5008_set_phy(sc, c, extc); ar5008_init_chains(sc); - if (sc->flags & ATHN_FLAG_OLPC) + if (sc->flags & ATHN_FLAG_OLPC) { + extern int ticks; + sc->olpc_ticks = ticks; ops->olpc_init(sc); + } + ops->set_txpower(sc, c, extc); if (!AR_SINGLE_CHIP(sc)) diff --git a/sys/dev/ic/ar9280.c b/sys/dev/ic/ar9280.c index edb5c212ee0..c70c70c2646 100644 --- a/sys/dev/ic/ar9280.c +++ b/sys/dev/ic/ar9280.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9280.c,v 1.11 2010/08/12 16:04:51 damien Exp $ */ +/* $OpenBSD: ar9280.c,v 1.12 2010/08/12 16:32:31 damien Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -110,6 +110,7 @@ ar9280_attach(struct athn_softc *sc) sc->ops.spur_mitigate = ar9280_spur_mitigate; sc->ops.get_spur_chans = ar5416_get_spur_chans; sc->ops.olpc_init = ar9280_olpc_init; + sc->ops.olpc_temp_compensation = ar9280_olpc_temp_compensation; sc->ini = &ar9280_2_0_ini; sc->serdes = ar9280_2_0_serdes; diff --git a/sys/dev/ic/ar9287.c b/sys/dev/ic/ar9287.c index 514dd1f3bd3..7c1b76166d4 100644 --- a/sys/dev/ic/ar9287.c +++ b/sys/dev/ic/ar9287.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9287.c,v 1.13 2010/07/15 19:29:00 damien Exp $ */ +/* $OpenBSD: ar9287.c,v 1.14 2010/08/12 16:32:31 damien Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -119,6 +119,7 @@ ar9287_attach(struct athn_softc *sc) sc->ops.spur_mitigate = ar9280_spur_mitigate; sc->ops.get_spur_chans = ar9287_get_spur_chans; sc->ops.olpc_init = ar9287_olpc_init; + sc->ops.olpc_temp_compensation = ar9287_olpc_temp_compensation; sc->ini = &ar9287_1_1_ini; sc->serdes = ar9280_2_0_serdes; diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c index 951be394fd0..a96b13cac6c 100644 --- a/sys/dev/ic/athn.c +++ b/sys/dev/ic/athn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: athn.c,v 1.59 2010/08/11 07:27:36 ray Exp $ */ +/* $OpenBSD: athn.c,v 1.60 2010/08/12 16:32:31 damien Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -1141,17 +1141,26 @@ athn_iter_func(void *arg, struct ieee80211_node *ni) void athn_calib_to(void *arg) { + extern int ticks; struct athn_softc *sc = arg; + struct athn_ops *ops = &sc->ops; struct ieee80211com *ic = &sc->sc_ic; int s; s = splnet(); + + if ((sc->flags & ATHN_FLAG_OLPC) && + sc->olpc_ticks + 30 * hz < ticks) { + /* Compensate for temperature changes. */ + sc->olpc_ticks = ticks; + ops->olpc_temp_compensation(sc); + } + #ifdef notyet /* XXX ANI. */ athn_ani_monitor(sc); - /* XXX OLPC temperature compensation. */ - sc->ops.next_calib(sc); + ops->next_calib(sc); #endif if (ic->ic_fixed_rate == -1) { if (ic->ic_opmode == IEEE80211_M_STA) diff --git a/sys/dev/ic/athnvar.h b/sys/dev/ic/athnvar.h index 034189361b6..356b29213a3 100644 --- a/sys/dev/ic/athnvar.h +++ b/sys/dev/ic/athnvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: athnvar.h,v 1.20 2010/07/21 14:01:58 kettenis Exp $ */ +/* $OpenBSD: athnvar.h,v 1.21 2010/08/12 16:32:31 damien Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -360,6 +360,7 @@ struct athn_ops { struct ieee80211_channel *); void (*swap_rom)(struct athn_softc *); void (*olpc_init)(struct athn_softc *); + void (*olpc_temp_compensation)(struct athn_softc *); /* GPIO callbacks. */ int (*gpio_read)(struct athn_softc *, int); void (*gpio_write)(struct athn_softc *, int, int); @@ -467,6 +468,7 @@ struct athn_softc { int8_t tx_gain_tbl[AR9280_TX_GAIN_TABLE_SIZE]; int8_t pdadc; int8_t tcomp; + int olpc_ticks; /* PA predistortion. */ uint16_t gain1[AR_MAX_CHAINS]; |