public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: Shayne Chen <shayne.chen@mediatek.com>
To: Felix Fietkau <nbd@nbd.name>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Evelyn Tsai <evelyn.tsai@mediatek.com>,
	linux-mediatek <linux-mediatek@lists.infradead.org>,
	Allen Ye <allen.ye@mediatek.com>,
	Shayne Chen <shayne.chen@mediatek.com>
Subject: [PATCH 3/8] wifi: mt76: use chainmask for power delta calculation
Date: Thu, 2 Nov 2023 18:02:57 +0800	[thread overview]
Message-ID: <20231102100302.22160-3-shayne.chen@mediatek.com> (raw)
In-Reply-To: <20231102100302.22160-1-shayne.chen@mediatek.com>

From: Allen Ye <allen.ye@mediatek.com>

The power gain value is related to total TX path, so change the
calculation to use per-phy chainmask.

Signed-off-by: Allen Ye <allen.ye@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/eeprom.c     | 2 +-
 drivers/net/wireless/mediatek/mt76/mac80211.c   | 2 +-
 drivers/net/wireless/mediatek/mt76/mt7915/mcu.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c
index 7725dd6763ef..53f5ef4120ca 100644
--- a/drivers/net/wireless/mediatek/mt76/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/eeprom.c
@@ -379,7 +379,7 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
 	if (!np)
 		return target_power;
 
-	txs_delta = mt76_get_txs_delta(np, hweight8(phy->antenna_mask));
+	txs_delta = mt76_get_txs_delta(np, hweight16(phy->chainmask));
 
 	val = mt76_get_of_array(np, "rates-cck", &len, ARRAY_SIZE(dest->cck));
 	mt76_apply_array_limit(dest->cck, ARRAY_SIZE(dest->cck), val,
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index 6ee7be6eaab8..c15074bb24c1 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -1537,7 +1537,7 @@ int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		     int *dbm)
 {
 	struct mt76_phy *phy = hw->priv;
-	int n_chains = hweight8(phy->antenna_mask);
+	int n_chains = hweight16(phy->chainmask);
 	int delta = mt76_tx_power_nss_delta(n_chains);
 
 	*dbm = DIV_ROUND_UP(phy->txpower_cur + delta, 2);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
index 1592b5d6751a..b41ac4aaced7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
@@ -519,7 +519,7 @@ static inline s8
 mt7915_get_power_bound(struct mt7915_phy *phy, s8 txpower)
 {
 	struct mt76_phy *mphy = phy->mt76;
-	int n_chains = hweight8(mphy->antenna_mask);
+	int n_chains = hweight16(mphy->chainmask);
 
 	txpower = mt76_get_sar_power(mphy, mphy->chandef.chan, txpower * 2);
 	txpower -= mt76_tx_power_nss_delta(n_chains);
-- 
2.39.2



  parent reply	other threads:[~2023-11-02 10:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02 10:02 [PATCH 1/8] wifi: mt76: change txpower init to per-phy Shayne Chen
2023-11-02 10:02 ` [PATCH 2/8] wifi: mt76: mt7996: add txpower setting support Shayne Chen
2023-12-01 23:40   ` Ben Greear
2023-12-07 17:15     ` Shayne Chen (陳軒丞)
2023-12-07 21:01       ` Ben Greear
2024-03-01 20:12         ` ***Spam*** " Ben Greear
2024-03-04 18:13           ` Ben Greear
2023-11-02 10:02 ` Shayne Chen [this message]
2023-11-02 10:02 ` [PATCH 4/8] wifi: mt76: mt7996: switch to mcu command for TX GI report Shayne Chen
2023-12-04 21:57   ` Ben Greear
2023-12-07 17:07     ` Shayne Chen (陳軒丞)
2023-12-07 17:46       ` Ben Greear
2023-11-02 10:02 ` [PATCH 5/8] wifi: mt76: mt7996: fix alignment of sta info event Shayne Chen
2023-11-02 10:03 ` [PATCH 6/8] wifi: mt76: mt7996: rework ampdu params setting Shayne Chen
2023-11-02 10:03 ` [PATCH 7/8] wifi: mt76: connac: add beacon protection support for mt7996 Shayne Chen
2023-11-02 10:03 ` [PATCH 8/8] wifi: mt76: connac: fix EHT phy mode check Shayne Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231102100302.22160-3-shayne.chen@mediatek.com \
    --to=shayne.chen@mediatek.com \
    --cc=allen.ye@mediatek.com \
    --cc=evelyn.tsai@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox