Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2800661yba; Mon, 22 Apr 2019 13:13:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRQCHosVeV+20WRIknT6NF5w09Va5RHsvzlfpWoQjx9rd+gb7H1yeiPnvA+Rmoi/JW8cGH X-Received: by 2002:a63:5a1d:: with SMTP id o29mr21096870pgb.320.1555964028792; Mon, 22 Apr 2019 13:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555964028; cv=none; d=google.com; s=arc-20160816; b=ZURyoL4IIzJC4RkUNwg/JJQ8Tuswb4A/hOEe5nGP9Qs1AjrSvtcIxL2kSOKeC5+w47 iwlKI5/G9EduQjiQYXUlEPDXTUzcR+UGcUZB4EINcb3OfONvQBQHOmKDPIg+Z7jb5X5A zsW2/ui4+Sllz43LE2f5s2aTNsupjrtJ9+RvLUIGqhWiYhRjsK/lhCcMIRCSfe5Xf8Uf r7UjmkbQ3RpVeLhqMAcboQsPDivkbkZyUBjMCfcjHSWm6Ba6a/am8Yzf+/kG2ANeUauv IoSzQTtIgUDa52j2ygi+aUtVu8ZdxrKmc7L3/H7k56d1DouD8u5HxI9OpdcC/9JVYCvs /QhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BkaH2LssuCuhE+RPGPCG7yO1OZhMrzXq9IWMh9Cn2/w=; b=eBQOO5DJXJXuVuGE62S7/YLkflM22iWp5ro/+sjpI+nsNt6b3FJf1lTMjqp2+CLswo gx3/8c++oQ2s6vbTFfda9+rl+SK1qtiyMS1HEFAJYUmFyEl/xT4xa8s/FC7je4LZh0mx nNfsXDuaf0CYMzzGnB74W1HQQ1daItJOv53w5rPmKHIaLztUewxzVimElvUGPgsKdqBH GdnVb/Z8LBBTfq/FtE8hsk6b2uJjEaQFnVE2jrvOKvOWia+ms0AAiua+DaNlsuMlRKDj nsUAADyqaWMo6uzMy733UqLdUGB+J1LR5Vf9R7CPOZ0NcUWP9Y476dJoTqu2RQO5ajyU OvPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="AIy/9lWJ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r9si13855966pls.323.2019.04.22.13.13.33; Mon, 22 Apr 2019 13:13:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="AIy/9lWJ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732657AbfDVUMF (ORCPT + 99 others); Mon, 22 Apr 2019 16:12:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:42496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728515AbfDVTmL (ORCPT ); Mon, 22 Apr 2019 15:42:11 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2361B2177B; Mon, 22 Apr 2019 19:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962130; bh=TFEbNgOnjZdp+OrAKel34HlM7HEacZoMLPhNOvdElzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AIy/9lWJ9uxBpwWbQrIEOLoZLxgrerHNdn9FaStDiklAnw1DUP5wrt7hfibyTcdFu C9NK1Joz/sAG19XRu6wV9kqAj9/E2lP5MF+QgsUdvsdzam4jZ6DLDrDPvlkqZ2quve nMaZmhV+EpjTotyaYkibuYyDnVT3RVqpvb5wcs3E= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Felix Fietkau , Sasha Levin Subject: [PATCH AUTOSEL 5.0 05/98] mt76: mt76x2: fix external LNA gain settings Date: Mon, 22 Apr 2019 15:40:32 -0400 Message-Id: <20190422194205.10404-5-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194205.10404-1-sashal@kernel.org> References: <20190422194205.10404-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Felix Fietkau [ Upstream commit 45a042e3026824a7e910db7a4dd38fef0540b902 ] Devices with external LNA need different values for AGC registers 8 and 9 Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin (Microsoft) --- drivers/net/wireless/mediatek/mt76/mt76x2/phy.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c index c9634a774705..11167b7af668 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c @@ -260,10 +260,15 @@ mt76x2_phy_set_gain_val(struct mt76x02_dev *dev) gain_val[0] = dev->cal.agc_gain_cur[0] - dev->cal.agc_gain_adjust; gain_val[1] = dev->cal.agc_gain_cur[1] - dev->cal.agc_gain_adjust; - if (dev->mt76.chandef.width >= NL80211_CHAN_WIDTH_40) + val = 0x1836 << 16; + if (!mt76x2_has_ext_lna(dev) && + dev->mt76.chandef.width >= NL80211_CHAN_WIDTH_40) val = 0x1e42 << 16; - else - val = 0x1836 << 16; + + if (mt76x2_has_ext_lna(dev) && + dev->mt76.chandef.chan->band == NL80211_BAND_2GHZ && + dev->mt76.chandef.width < NL80211_CHAN_WIDTH_40) + val = 0x0f36 << 16; val |= 0xf8; -- 2.19.1