From patchwork Thu Jun 21 09:17:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 10479523 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 2A31B60383 for ; Thu, 21 Jun 2018 09:18:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B2A52925F for ; Thu, 21 Jun 2018 09:18:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19E38292AC; Thu, 21 Jun 2018 09:18:10 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 6B919292C3 for ; Thu, 21 Jun 2018 09:18:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932937AbeFUJSI (ORCPT ); Thu, 21 Jun 2018 05:18:08 -0400 Received: from nbd.name ([46.4.11.11]:55504 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932534AbeFUJSF (ORCPT ); Thu, 21 Jun 2018 05:18:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=YLJNB9M6U2l4u8cUWGBRFpwF0GaXWnqDhsU0UFEpXCY=; b=hUsKprpDTGeU7TX72agrLJCa6y 59ScY7KHSlmd1vUbBXgtK2gB4LuO/8I3i6dQxtduOUrDSlM9/wP38NCchO4Qb5cvGj1y391XZi0Xt GUKMk5vjpLKU56C0HU28Gc+2MjulRCfsz4t5g6uqLM52nRwOU0ppAp8lyMMB11O/t4eU=; Received: by maeck.lan (Postfix, from userid 501) id 685152DE8964; Thu, 21 Jun 2018 11:18:02 +0200 (CEST) From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: kvalo@codeaurora.org Subject: [PATCH 6/9] mt76: fix variable gain adjustment range Date: Thu, 21 Jun 2018 11:17:58 +0200 Message-Id: <20180621091801.41184-6-nbd@nbd.name> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180621091801.41184-1-nbd@nbd.name> References: <20180621091801.41184-1-nbd@nbd.name> 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 The range should only be limited to 4 for really weak signals, for all other gain settings the range is 16. Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt76x2_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c index 51fd7ddfa8f5..9c7b19ce73f2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_phy.c @@ -485,7 +485,7 @@ static void mt76x2_phy_adjust_vga_gain(struct mt76x2_dev *dev) { u32 false_cca; - u8 limit = dev->cal.low_gain > 1 ? 4 : 16; + u8 limit = dev->cal.low_gain > 0 ? 16 : 4; false_cca = FIELD_GET(MT_RX_STAT_1_CCA_ERRORS, mt76_rr(dev, MT_RX_STAT_1)); if (false_cca > 800 && dev->cal.agc_gain_adjust < limit)