From patchwork Wed May 2 09:46:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10375267 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9BD13603B4 for ; Wed, 2 May 2018 09:46:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DF7228CE5 for ; Wed, 2 May 2018 09:46:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 811B128DB0; Wed, 2 May 2018 09:46:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2992A28CE5 for ; Wed, 2 May 2018 09:46:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751063AbeEBJqu (ORCPT ); Wed, 2 May 2018 05:46:50 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:37184 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750898AbeEBJqt (ORCPT ); Wed, 2 May 2018 05:46:49 -0400 Received: by mail-wm0-f68.google.com with SMTP id l1so23225764wmb.2 for ; Wed, 02 May 2018 02:46:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MkPXYeqc49ma1TipWlMyGK+KvayXYcK1cBcSU8UwDpY=; b=q0PJ8FQvOjSspcUfy0s3ajMNEZxEpIdP4s1Eoy93WFvSPo/nsZzawvk4l0lnLDvOIO FGBzSG/F7N+lbuIGPvIqc01NSHZnFXKKd9f0+xGNBEZImsoypc6PJsmv0s/Hu5hDbxnj XG8El+ZGnazhqpKZdeHfgsi7GgbKK+bctH++OcO2WnV+0DEyF83o22RIKpBy5cedY3j6 PON5fwiMHTyAyKPyiZfnGmWyYE+BFklkAwKhre9JmCxCjG3MdbNf7f3LtNUZxn28gs7R m4W1d8s0vst2Jf6akGJpA9hv7tlusqJrjVKRDiu432Rk+krteD+3BBsEjPbrW4mixNVq YSEQ== X-Gm-Message-State: ALQs6tAWONQU5PRcIjiNc/eylc/3HNxLShrGGdnPuI3rf49fIXMO9hCg sO1cFYMgqGCABHt48JfjcmEyMzFiYgk= X-Google-Smtp-Source: AB8JxZoYKsquyoQbLKzipht+Yq+Tv3ePCpUrY+e3+PoZeMGzmq1Tr6eG2Bo5OaPtokCvYT7A8mc1Jg== X-Received: by 10.28.71.146 with SMTP id m18mr11077811wmi.144.1525254408487; Wed, 02 May 2018 02:46:48 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id y84sm2636613wmg.44.2018.05.02.02.46.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 May 2018 02:46:47 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org Subject: [PATCH] mt76x2: fix avg_rssi estimation Date: Wed, 2 May 2018 11:46:36 +0200 Message-Id: <62914ffe8256eb60af815fca6591473d67f5a639.1525254116.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add leftover filter coefficients in IIR rssi estimation Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e") Signed-off-by: Lorenzo Bianconi Acked-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt76x2_phy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c index 038d1fe6c726..c1c38ca3330a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c @@ -508,8 +508,10 @@ mt76x2_phy_update_channel_gain(struct mt76x2_dev *dev) u8 gain_delta; int low_gain; - dev->cal.avg_rssi[0] = (dev->cal.avg_rssi[0] * 15) / 16 + (rssi0 << 8); - dev->cal.avg_rssi[1] = (dev->cal.avg_rssi[1] * 15) / 16 + (rssi1 << 8); + dev->cal.avg_rssi[0] = (dev->cal.avg_rssi[0] * 15) / 16 + + (rssi0 << 8) / 16; + dev->cal.avg_rssi[1] = (dev->cal.avg_rssi[1] * 15) / 16 + + (rssi1 << 8) / 16; dev->cal.avg_rssi_all = (dev->cal.avg_rssi[0] + dev->cal.avg_rssi[1]) / 512;