Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp143683pxf; Wed, 31 Mar 2021 19:33:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/79wRqlOm7wobITkbcYxhFICX1Hg69Ar4bQnWBhNIoXFWmKdmbxn7t4YBmAW2Sb5bryHt X-Received: by 2002:a17:906:684b:: with SMTP id a11mr6634642ejs.329.1617244393322; Wed, 31 Mar 2021 19:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617244393; cv=none; d=google.com; s=arc-20160816; b=jpYkCw4K/ZXwi0B/WZ2XIovX9ALL6aXuGi4l7RZezAJr0hMUesWeNG+Z5uW/IPrHQs f6jBOwgOT94ECDLyhWgO8IS0IYXfwqAZid2JISYuV6FFP5kZmEINCGB1xAT1Nb6bbVlE gEwdO+cyGtarHN9aoWactRrO6ZFgLPUcl+q8E746mV3U92n9aE8qUL5j2xyArN2w7Msz Dhuq0qXvA29MJYjoC1ur+Rf4uODjJLZYAMMs2H56iC5/s8CqKSTyDi3NLwMnynUIv3xL mJNdphjFyLCGaMXKk3B3plSwEGydNccmF2pZFcdNAjNrSEnwpNoX/3qcYSmGSqLLs8xZ E7cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=hDM2VPC0S/n2mWjFZisWT6VjUOkqMrUpbw06V4NsTNo=; b=o4U0op+wLzdfhuFtnsvbC7aobPzwhYjYGqh2YwCrQdY5MzjkDZ5mDRQgTn59KrVNXy f9CHyrJaNhizmkIOIM/EbdbaJBz4jbtzqDrBq4ZZ2dpLFhi700H7FiUUL9juSSHnpv6M 0Max2jnHeLXx+uvPTNMulPWReRjov8VQjuUCKKS89NXZuFRN9F0FjJSH4mdYzpaXAPjx cFvJ1NWf6stVUGBhDbf3WDxHtr2OHzkaj02TNvZiQGLLW2m1M7b8DjAhRha/u21aCcWW GADRP2O9QobEl06pBXDOU/q48W8JER2wFjebp3u/9SQjdKvkjaF7xsrSSHEvJfPXquBh CibA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rh9si3415109ejb.341.2021.03.31.19.32.46; Wed, 31 Mar 2021 19:33:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232763AbhDACcF (ORCPT + 99 others); Wed, 31 Mar 2021 22:32:05 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:42897 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229497AbhDACbr (ORCPT ); Wed, 31 Mar 2021 22:31:47 -0400 X-UUID: fa5eee72cc9749b7b013c379c294a30c-20210401 X-UUID: fa5eee72cc9749b7b013c379c294a30c-20210401 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1372645251; Thu, 01 Apr 2021 10:31:44 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 1 Apr 2021 10:31:43 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 1 Apr 2021 10:31:42 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , linux-mediatek , Shayne Chen Subject: [PATCH] mt76: mt7915: fix txpower init for TSSI off chips Date: Thu, 1 Apr 2021 10:31:29 +0800 Message-ID: <20210401023129.31941-1-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Fix incorrect txpower init value for TSSI off chips which causes too small txpower. Signed-off-by: Shayne Chen --- .../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 a7ffc20..18be0d6 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; } s8 mt7915_eeprom_get_power_delta(struct mt7915_dev *dev, int band) -- 2.18.0