Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp284653pxj; Tue, 18 May 2021 03:24:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRKpTwAZ+FFKxTg4yQi6KWK5f9CKnJTr2sgCKCShds8RVtBZUzwBtt8OYDAevYtzg1ZkIr X-Received: by 2002:a05:6638:270b:: with SMTP id m11mr350352jav.59.1621333448227; Tue, 18 May 2021 03:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621333448; cv=none; d=google.com; s=arc-20160816; b=d9n0lXNRauzPYne8jwEB4xK0wAZxCPU1cQeJeyurEpOdqYHJleLmdbb+xZzLBI8wfL I9722bzzMzkbyei48kHAEyouzq49jD8Rbr4qP94gBUJd2OXjLW/r731dNKztjYZQB2ww /H8dSKA57T8M9+8CV5K1qcEYltnfNTqfvdA2ouvWZJgAP0k2PypB0uW6SU3+Y70OEv0B GD55oNs48/NJC7zpmiJ7se/jJQHk28dwsrpVjjrHqdFCG0hPWr6Sm1Cqk5axt4UkN17Q EaKpLIG//IXFxlbPNJWzGu/4UvChM0YJJCjec2F2AuKOnJz2u7ohZAksyFoizDa7zWqa e7Eg== 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=Cidf4Urlye51gFjBEJ7uxDkrSvLIGxn5/Oi5Nb7A0vY=; b=VgWS8vSw2esBkH88CECIWIBzSh+J3i+nn+qLE0zEcnHwxOSAqmLjSA+9/6Osf0BHty dXBzwMfqX580VagoA4c5C+0SFd3aoGmQGtMTReW2wIDZaWwjZeGNSMyPavBwuDuFsXE9 7Eu+LL5hjpzDVVkNi8VSSqAMml8OILa77MWqMo00ILbAxBmpyD5kzAX17UBrI35sJANG XyNaz2SAGaO2hxwqL2zcbBPOKAbPEOfNHyOhsCzvod775ofQ5UHZwzbCez8HuCBx+O2Z N0GEjXB0gvp14LAFNVfirckghkMuvi9YWMb4v1OTSBSo20aXJOhUfL3meBlbVGHaDYWQ T6VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bd8lkvTV; 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 t128si26310560iof.16.2021.05.18.03.23.54; Tue, 18 May 2021 03:24:08 -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=bd8lkvTV; 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 S243205AbhEQPNX (ORCPT + 99 others); Mon, 17 May 2021 11:13:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:32846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241684AbhEQPDE (ORCPT ); Mon, 17 May 2021 11:03:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1A16A61A06; Mon, 17 May 2021 14:27:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261673; bh=/SzXmTGqbDyxVH+gy01NWuzrI1L3UAsKsg/UFD0dWOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bd8lkvTV9CbWiaG4ugBxjsTQaKsROGkb/8rF17qJR7BECajPTnvfyCn6RUOoBb+9D cX3wbjM7DRU+Bo1UARbmzEjFIvRcwac4k/dGMuVrJZKy2OEgXt99BnEv7SV9k9sl8G w30b9PI8YdW43wcx+j1N2XuwsiEvYgP0XLrwbnx8= 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.10 050/289] mt76: mt7915: fix txpower init for TSSI off chips Date: Mon, 17 May 2021 15:59:35 +0200 Message-Id: <20210517140306.882608717@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 7deba7ebd68a..e4c5f968f706 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c @@ -104,7 +104,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) @@ -113,15 +113,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