From patchwork Sun Aug 5 19:35:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Kossifidis X-Patchwork-Id: 1275571 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 8B6A8DF27F for ; Sun, 5 Aug 2012 19:36:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754987Ab2HETgG (ORCPT ); Sun, 5 Aug 2012 15:36:06 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:52849 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754852Ab2HETgF (ORCPT ); Sun, 5 Aug 2012 15:36:05 -0400 Received: by weyx8 with SMTP id x8so1488533wey.19 for ; Sun, 05 Aug 2012 12:36:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=qoPY+GW5Tggw3IHlk6tfMOqutzIpSg2wxXEgFWsDFuA=; b=vFKwxi/kXhArGgJO7OFsTWmcZsXmiva9XpI49+C06zeMWkbSn7ZrukZk2eD5kVY07y HD9fHPUQSdnLRpl7qQE7ALCmPOtlfIXfQObmmQyID3FNJ7vIvSRM5OXHvM4KpXnNHw/H JrSMpIdI7pY4tDqFnFZrCLNjf24Lsx6X/uDcHyrwaVVuLeL3i9SYW/loSon0kQDXL8tJ Inpu6+QSLYANfMnJnmvRtLe37BYMS8v/GYP1sKI9x0szKwwqAXDCJb/tr3IuVjDlD0xN 1dXoFomR85ufKaxVe8pdlYUGxAX9D0ETMbhu6yJx/k9U3+EkF9bQBkfDsPzikRhsOlAa 0Zrg== Received: by 10.180.80.134 with SMTP id r6mr12349177wix.1.1344195364117; Sun, 05 Aug 2012 12:36:04 -0700 (PDT) Received: from localhost.localdomain (athedsl-133041.home.otenet.gr. [85.75.95.80]) by mx.google.com with ESMTPS id b7sm16708044wiz.9.2012.08.05.12.35.58 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 05 Aug 2012 12:36:03 -0700 (PDT) From: Nick Kossifidis To: ath5k-devel@lists.ath5k.org, linux-wireless@vger.kernel.org Cc: linville@tuxdriver.com, mcgrof@gmail.com, jirislaby@gmail.com, thomas@net.t-labs.tu-berlin.de, nbd@openwrt.org, Nick Kossifidis Subject: [PATCH v2 1/5] ath5k: Use correct value for min_pwr and cur_pwr Date: Sun, 5 Aug 2012 22:35:33 +0300 Message-Id: <1344195337-27461-2-git-send-email-mickflemm@gmail.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1344195337-27461-1-git-send-email-mickflemm@gmail.com> References: <1344195337-27461-1-git-send-email-mickflemm@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Make sure we don't store the table offsets for min and cur power levels, store the 0.25dB values instead. This way we don't clamp the tx power level to max (because now cur_pwr holds the 0.25dB value, not the table offset) after re-using cur_pwr on reset. Signed-off-by: Nick Kossifidis --- drivers/net/wireless/ath/ath5k/phy.c | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 8b71a2d..aa1a77d 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c @@ -3562,6 +3562,20 @@ ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr, for (i = 8; i <= 15; i++) rates[i] -= ah->ah_txpower.txp_cck_ofdm_gainf_delta; + /* Save min/max and current tx power for this channel + * in 0.25dB units. + * + * Note: We use rates[0] for current tx power because + * it covers most of the rates, in most cases. It's our + * tx power limit and what the user expects to see. */ + ah->ah_txpower.txp_min_pwr = 2 * rates[7]; + ah->ah_txpower.txp_cur_pwr = 2 * rates[0]; + + /* Set max txpower for correct OFDM operation on all rates + * -that is the txpower for 54Mbit-, it's used for the PAPD + * gain probe and it's in 0.5dB units */ + ah->ah_txpower.txp_ofdm = rates[7]; + /* Now that we have all rates setup use table offset to * match the power range set by user with the power indices * on PCDAC/PDADC table */ @@ -3571,11 +3585,6 @@ ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr, if (rates[i] > 63) rates[i] = 63; } - - /* Min/max in 0.25dB units */ - ah->ah_txpower.txp_min_pwr = 2 * rates[7]; - ah->ah_txpower.txp_cur_pwr = 2 * rates[0]; - ah->ah_txpower.txp_ofdm = rates[7]; }