From patchwork Wed Sep 16 19:27:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Ilnseher X-Patchwork-Id: 48057 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8GJRKDW014958 for ; Wed, 16 Sep 2009 19:27:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758907AbZIPT1O (ORCPT ); Wed, 16 Sep 2009 15:27:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758912AbZIPT1O (ORCPT ); Wed, 16 Sep 2009 15:27:14 -0400 Received: from mail-bw0-f219.google.com ([209.85.218.219]:56613 "EHLO mail-bw0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758905AbZIPT1N (ORCPT ); Wed, 16 Sep 2009 15:27:13 -0400 Received: by bwz19 with SMTP id 19so3736574bwz.37 for ; Wed, 16 Sep 2009 12:27:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:sender:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=sk2H+zbi41zig38IgHMSaqUB+A+74VfhT45GFsYv8oQ=; b=fcUrYz6Nvs93Q0rVDMRRuz6EGFoz1DPfYchpvdcc91PLYHR9XZlUsUKt+qAqP6OG6z 1BxcMPTrodCRxntihgsX5kxkYUm8cnuYsfhxlkZPMHusUL7zNXQXFL+QfHX3GQyZUzLz Z5P2tRQ4y2xuqQHy8jgt4dzKMxkU+ZZrh+yq8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=sender:subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=cfK8ZgXb7fTQbuzgvVZxzEwjImx934ripyv56WC3dBEsBwenb7iYxx0OgAiOTsOtn8 mBB0RJBD6WJrWr9Mh+vC03Tj/OQyFd5NAijyuszTY1IanRNNNNzEJwvRs2qXgFlQ6DOs GoISlHscSYC6JqANZI1UUCmiFUOqnziz/D0fE= Received: by 10.86.154.32 with SMTP id b32mr7730729fge.10.1253129235373; Wed, 16 Sep 2009 12:27:15 -0700 (PDT) Received: from ?192.168.178.28? (88-134-126-140-dynip.superkabel.de [88.134.126.140]) by mx.google.com with ESMTPS id l19sm426477fgb.7.2009.09.16.12.27.14 (version=SSLv3 cipher=RC4-MD5); Wed, 16 Sep 2009 12:27:14 -0700 (PDT) Subject: [PATCH 1/2] b43: Add lpphy_update_tx_power_npt function to improve TX power handling on LP PHYs From: Thomas Ilnseher To: John Linville Cc: Broadcom Wireless , linux-wireless , Larry Finger , =?ISO-8859-1?Q?G=E1bor?= Stefanik Date: Wed, 16 Sep 2009 21:27:16 +0200 Message-Id: <1253129236.2989.37.camel@note> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The lpphy_update_tx_power_npt routine is currently missing in the code. I added the routine according to the specs. Signed-off-by: Thomas Ilnseher --- -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -uNr compat-wireless-2009-09-15/drivers/net/wireless/b43/b43.h compat-wireless-2009-09-15.mod/drivers/net/wireless/b43/b43.h --- compat-wireless-2009-09-15/drivers/net/wireless/b43/b43.h 2009-09-15 06:13:53.000000000 +0200 +++ compat-wireless-2009-09-15.mod/drivers/net/wireless/b43/b43.h 2009-09-15 23:35:02.651859159 +0200 @@ -255,7 +255,10 @@ #define B43_SHM_SH_MAXBFRAMES 0x0080 /* Maximum number of frames in a burst */ #define B43_SHM_SH_SPUWKUP 0x0094 /* pre-wakeup for synth PU in us */ #define B43_SHM_SH_PRETBTT 0x0096 /* pre-TBTT in us */ - +/* MAC Statistics */ +#define B43_SHM_SH_TX_FRAMES_SENT 0x00E0 /* # TX Frames sent */ +#define B43_SHM_SH_TX_RTS 0x00E2 /* # TX RTS */ +#define B43_SHM_SH_TX_CTS 0x00E4 /* # TX CTS */ /* SHM_SCRATCH offsets */ #define B43_SHM_SC_MINCONT 0x0003 /* Minimum contention window */ #define B43_SHM_SC_MAXCONT 0x0004 /* Maximum contention window */ diff -uNr compat-wireless-2009-09-15/drivers/net/wireless/b43/phy_lp.c compat-wireless-2009-09-15.mod/drivers/net/wireless/b43/phy_lp.c --- compat-wireless-2009-09-15/drivers/net/wireless/b43/phy_lp.c 2009-09-15 06:13:53.000000000 +0200 +++ compat-wireless-2009-09-15.mod/drivers/net/wireless/b43/phy_lp.c 2009-09-16 00:00:20.712857949 +0200 @@ -1103,6 +1103,28 @@ (u16)~B43_LPPHY_TX_PWR_CTL_CMD_MODE, ctl); } +static void lpphy_update_tx_power_npt(struct b43_wldev *dev) +{ + u16 tx_cnt; + u16 npt; + u16 s3; + + s3 = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_TX_FRAMES_SENT); + tx_cnt = s3 - dev->phy.lp->tssi_tx_count; + npt = (b43_phy_read(dev, B43_LPPHY_TX_PWR_CTL_NNUM) & 0x700) >> 8; + + if ((1 << (npt & 0x1F)) >= tx_cnt) + return; + /* NB: Spec says do the stuff if xxx < tx_cnt, so return on xxx > txcnt */ + dev->phy.lp->tssi_tx_count = s3; + if (npt < 7) { + npt++; + b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_NNUM, 0xF8FF, (npt << 8)); + } + dev->phy.lp->tssi_npt = npt; + dev->phy.lp->tssi_idx = (b43_phy_read(dev, B43_LPPHY_TX_PWR_CTL_STAT) & 0x7F00) >> 8; +} + static void lpphy_set_tx_power_control(struct b43_wldev *dev, enum b43_lpphy_txpctl_mode mode) { @@ -1116,7 +1138,7 @@ lpphy->txpctl_mode = mode; if (oldmode == B43_LPPHY_TXPCTL_HW) { - //TODO Update TX Power NPT + lpphy_update_tx_power_npt(dev); //TODO Clear all TX Power offsets } else { if (mode == B43_LPPHY_TXPCTL_HW) {