From patchwork Tue Jul 20 20:56:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "John W. Linville" X-Patchwork-Id: 113086 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6KL0EiS024996 for ; Tue, 20 Jul 2010 21:00:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758581Ab0GTVAN (ORCPT ); Tue, 20 Jul 2010 17:00:13 -0400 Received: from charlotte.tuxdriver.com ([70.61.120.58]:36878 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755552Ab0GTVAM (ORCPT ); Tue, 20 Jul 2010 17:00:12 -0400 Received: from uucp by smtp.tuxdriver.com with local-rmail (Exim 4.63) (envelope-from ) id 1ObJv9-0007ET-2f; Tue, 20 Jul 2010 17:00:11 -0400 Received: from linville-t400.local (linville-t400.local [127.0.0.1]) by linville-t400.local (8.14.4/8.14.3) with ESMTP id o6KKuQZB025685; Tue, 20 Jul 2010 16:56:26 -0400 Received: (from linville@localhost) by linville-t400.local (8.14.4/8.14.4/Submit) id o6KKuQ7Y025683; Tue, 20 Jul 2010 16:56:26 -0400 From: "John W. Linville" To: linux-wireless@vger.kernel.org Cc: "John W. Linville" Subject: [PATCH v2] rtl8180: improve signal reporting for rtl8185 hardware Date: Tue, 20 Jul 2010 16:56:25 -0400 Message-Id: <1279659385-25650-1-git-send-email-linville@tuxdriver.com> X-Mailer: git-send-email 1.7.1.1 In-Reply-To: <1279572443-14361-1-git-send-email-linville@tuxdriver.com> References: <1279572443-14361-1-git-send-email-linville@tuxdriver.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 20 Jul 2010 21:00:15 +0000 (UTC) diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c index 4270502..31808f9 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c @@ -103,6 +103,7 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) { struct rtl8180_priv *priv = dev->priv; unsigned int count = 32; + u8 signal; while (count--) { struct rtl8180_rx_desc *entry = &priv->rx_ring[priv->rx_idx]; @@ -130,10 +131,14 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) skb_put(skb, flags & 0xFFF); rx_status.antenna = (flags2 >> 15) & 1; - /* TODO: improve signal/rssi reporting */ - rx_status.signal = (flags2 >> 8) & 0x7F; - /* XXX: is this correct? */ rx_status.rate_idx = (flags >> 20) & 0xF; + /* TODO: improve signal/rssi reporting for !rtl8185 */ + signal = (flags2 >> 17) & 0x7F; + if (rx_status.rate_idx > 3) + signal = 90 - clamp_t(u8, signal, 25, 90); + else + signal = 95 - clamp_t(u8, signal, 30, 95); + rx_status.signal = signal; rx_status.freq = dev->conf.channel->center_freq; rx_status.band = dev->conf.channel->band; rx_status.mactime = le64_to_cpu(entry->tsft);