From 8dda537fe7f2a5380b3fff938b17b0d3c28f078c Mon Sep 17 00:00:00 2001 From: Damien Bergamini Date: Thu, 12 Aug 2010 16:04:52 +0000 Subject: Fix look-up of the power control digital-to-analog converter (PCDAC) value in the Tx gain table. This fixes AR9280/AR9281 chips in open-loop power control mode, like the high power solution found in the Acer Aspire One. tested by ray@ --- sys/dev/ic/ar9280.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/dev/ic/ar9280.c b/sys/dev/ic/ar9280.c index 128dd65653a..edb5c212ee0 100644 --- a/sys/dev/ic/ar9280.c +++ b/sys/dev/ic/ar9280.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar9280.c,v 1.10 2010/07/15 20:37:38 damien Exp $ */ +/* $OpenBSD: ar9280.c,v 1.11 2010/08/12 16:04:51 damien Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini @@ -427,12 +427,15 @@ ar9280_olpc_get_pdadcs(struct athn_softc *sc, struct ieee80211_channel *c, pwr = (pierdata[lo].pwrPdg[0][0] + pierdata[hi].pwrPdg[0][0]) / 2; pwr /= 2; /* Convert to dB. */ - pcdac = pierdata[hi].pcdac[0][0]; /* XXX lo??? */ + pcdac = pierdata[hi].pcdac[0][0]; for (idx = 0; idx < AR9280_TX_GAIN_TABLE_SIZE - 1; idx++) - if (pcdac > sc->tx_gain_tbl[idx]) + if (pcdac <= sc->tx_gain_tbl[idx]) break; *txgain = idx; + DPRINTFN(3, ("fbin=%d lo=%d hi=%d pwr=%d pcdac=%d txgain=%d\n", + fbin, lo, hi, pwr, pcdac, idx)); + for (i = 0; i < AR_NUM_PDADC_VALUES; i++) pdadcs[i] = (i < pwr) ? 0x00 : 0xff; -- cgit v1.2.3