Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3011448pxj; Mon, 17 May 2021 15:31:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTq5/hlCWXaJANvqpg6zG3kiQfVaATvWy36EIrz/mQZZJEpGh9+oSR2AKkvlGvMPbGXIoU X-Received: by 2002:a17:906:7695:: with SMTP id o21mr2280068ejm.529.1621290700193; Mon, 17 May 2021 15:31:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621290700; cv=none; d=google.com; s=arc-20160816; b=tcHK3X+QRKeE4B6+hIPg6neLzdnrTPmddxHW/EOukoFXDUDZEbvsT6o6KnyToTESQ5 MPvui9O5pLXReZKHdMcPfncwZGL8ycBKmasGFgWqM8q1t7Dif5uznJBrSr/usg0c745u VPybmPFcEJw1Qvlfy8omtX9bPKFznqrG9jMJ4rWLU9Yos4NESlu5gP+VZ5t8yBguozUI 5KkbnixCVRsHpTTZLVuJX6Bx0Ovvz/UkP5vFQSNjG1FTAlEFGAxyclNuR2ol3veuhyvL X1giEECV5nE+IRmEEMFVh3UczEPxMjleQmxK0wr1M60w1TB6/T8rnkYESNnTivJcOhag +g8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ib8CtmyKiZNRi/3cAO6eRFwSLNbxja4LcipwZRb54xk=; b=yEroXzC+7XaWpEcJ0K4FI+r4j75/BLzcIerZFSI8/yjDc14Hf+Bfebmbif9JkZcS31 hQJeG3dUiKGTqovqym5aDffCAjREgI/2QXRL9P7k6x0rSSz17QFLhCIVXW5LOPSYS1ew M6vgYDE5bUonv6bFQrZOX2k5PMq5Qz1ib9n3oTh28FlytKWaL6K4SLYrvkR5uIW9VTRo Vgg9vhO5rr3VjpGMV5sNOgS8qwo97P/3jlzJvOsXRvkVX9mOdXiYElYZxgl+Y9uWwybs RdnhRNfaeosJZZTQafflGbrVW4RTZX/VlPyeal4mumkTgnKRd8Jqxcw7FR/0uUAD/qAo nvtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mFMZpyh4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si15002486eja.217.2021.05.17.15.31.17; Mon, 17 May 2021 15:31:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mFMZpyh4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237017AbhEQOPa (ORCPT + 99 others); Mon, 17 May 2021 10:15:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:46384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238347AbhEQOMy (ORCPT ); Mon, 17 May 2021 10:12:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D0D1D613DE; Mon, 17 May 2021 14:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260490; bh=k1/+NZWdIyxXM4YAwQQG+VyV9Eo3Vmzg3To1cnf+uRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mFMZpyh4D6UBbYx0ZCBLD/eDSPCUNlxcJINlzEG6m/n1GSpZE7+8NYfgDB7sDxIdF uclLkOimmgwDBKKoGJI1y3EFeksfGiI4mi/rp1JpVuS1IzX7OdQmK72Da+o2/9CXak 97clatFdKNuj9eQW33UwdN2z6F5+xfKGOOxPz8sY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shayne Chen , Felix Fietkau , Sasha Levin Subject: [PATCH 5.12 069/363] mt76: mt7915: fix txpower init for TSSI off chips Date: Mon, 17 May 2021 15:58:55 +0200 Message-Id: <20210517140304.933115163@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shayne Chen [ Upstream commit a226ccd04c479ccd23d6927c64bad1b441707f70 ] Fix incorrect txpower init value for TSSI off chips which causes too small txpower. Signed-off-by: Shayne Chen Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- .../wireless/mediatek/mt76/mt7915/eeprom.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c index 660398ac53c2..738ecf8f4fa2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c @@ -124,7 +124,7 @@ int mt7915_eeprom_get_target_power(struct mt7915_dev *dev, struct ieee80211_channel *chan, u8 chain_idx) { - int index; + int index, target_power; bool tssi_on; if (chain_idx > 3) @@ -133,15 +133,22 @@ int mt7915_eeprom_get_target_power(struct mt7915_dev *dev, tssi_on = mt7915_tssi_enabled(dev, chan->band); if (chan->band == NL80211_BAND_2GHZ) { - index = MT_EE_TX0_POWER_2G + chain_idx * 3 + !tssi_on; + index = MT_EE_TX0_POWER_2G + chain_idx * 3; + target_power = mt7915_eeprom_read(dev, index); + + if (!tssi_on) + target_power += mt7915_eeprom_read(dev, index + 1); } else { - int group = tssi_on ? - mt7915_get_channel_group(chan->hw_value) : 8; + int group = mt7915_get_channel_group(chan->hw_value); + + index = MT_EE_TX0_POWER_5G + chain_idx * 12; + target_power = mt7915_eeprom_read(dev, index + group); - index = MT_EE_TX0_POWER_5G + chain_idx * 12 + group; + if (!tssi_on) + target_power += mt7915_eeprom_read(dev, index + 8); } - return mt7915_eeprom_read(dev, index); + return target_power; } static const u8 sku_cck_delta_map[] = { -- 2.30.2