From patchwork Fri Jul 31 18:05:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Kossifidis X-Patchwork-Id: 38552 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 n6VIZ1JC021333 for ; Fri, 31 Jul 2009 18:35:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752829AbZGaSe7 (ORCPT ); Fri, 31 Jul 2009 14:34:59 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752769AbZGaSe6 (ORCPT ); Fri, 31 Jul 2009 14:34:58 -0400 Received: from venema.h4ckr.net ([217.24.1.135]:42482 "EHLO venema.h4ckr.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752828AbZGaSe6 (ORCPT ); Fri, 31 Jul 2009 14:34:58 -0400 Received: from localhost (localhost [127.0.0.1]) by venema.h4ckr.net (Postfix) with ESMTP id 70D0F306845; Fri, 31 Jul 2009 20:05:57 +0200 (CEST) Received: from venema.h4ckr.net ([127.0.0.1]) by localhost (venema.h4ckr.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r8AdS4Pyt08I; Fri, 31 Jul 2009 20:05:57 +0200 (CEST) Received: from localhost (athedsl-4523496.home.otenet.gr [94.71.241.240]) by venema.h4ckr.net (Postfix) with ESMTP id CAADD3067CC; Fri, 31 Jul 2009 20:05:56 +0200 (CEST) Date: Fri, 31 Jul 2009 21:05:56 +0300 From: Nick Kossifidis To: ath5k-devel@venema.h4ckr.net, linux-wireless@vger.kernel.org Cc: linville@tuxdriver.com, jirislaby@gmail.com, me@bobcopeland.com, mcgrof@gmail.com, nbd@openwrt.org Subject: [PATCH 2/4] ath5k: Linear PCDAC code fixes Message-ID: <20090731180556.GC7963@makis> Mail-Followup-To: ath5k-devel@lists.ath5k.org, linux-wireless@vger.kernel.org, linville@tuxdriver.com, jirislaby@gmail.com, me@bobcopeland.com, mcgrof@gmail.com, nbd@openwrt.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org * Set correct xpd curve indices for high/low gain curves during rfbuffer setup on RF5112B with both calibration curves available. * Don't return zero min power when we have the same pcdac value twice because it breaks interpolation. Instead return the right x barrier as we do when we have equal power levels for 2 different pcdac values. --- drivers/net/wireless/ath/ath5k/phy.c | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) -- 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 --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 2075ba9..6afba98 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c @@ -740,13 +740,22 @@ int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, AR5K_RF_XPD_GAIN, true); } else { - /* TODO: Set high and low gain bits */ - ath5k_hw_rfb_op(ah, rf_regs, - ee->ee_x_gain[ee_mode], + u8 *pdg_curve_to_idx = ee->ee_pdc_to_idx[ee_mode]; + if (ee->ee_pd_gains[ee_mode] > 1) { + ath5k_hw_rfb_op(ah, rf_regs, + pdg_curve_to_idx[0], AR5K_RF_PD_GAIN_LO, true); - ath5k_hw_rfb_op(ah, rf_regs, - ee->ee_x_gain[ee_mode], + ath5k_hw_rfb_op(ah, rf_regs, + pdg_curve_to_idx[1], AR5K_RF_PD_GAIN_HI, true); + } else { + ath5k_hw_rfb_op(ah, rf_regs, + pdg_curve_to_idx[0], + AR5K_RF_PD_GAIN_LO, true); + ath5k_hw_rfb_op(ah, rf_regs, + pdg_curve_to_idx[0], + AR5K_RF_PD_GAIN_HI, true); + } /* Lower synth voltage on Rev 2 */ ath5k_hw_rfb_op(ah, rf_regs, 2, @@ -1896,8 +1905,9 @@ ath5k_get_linear_pcdac_min(const u8 *stepL, const u8 *stepR, s16 min_pwrL, min_pwrR; s16 pwr_i; - if (WARN_ON(stepL[0] == stepL[1] || stepR[0] == stepR[1])) - return 0; + /* Some vendors write the same pcdac value twice !!! */ + if (stepL[0] == stepL[1] || stepR[0] == stepR[1]) + return max(pwrL[0], pwrR[0]); if (pwrL[0] == pwrL[1]) min_pwrL = pwrL[0];