Linux wireless drivers development
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 02/16] wifi: mt76: mt7603: fix reading target power from eeprom
Date: Fri, 16 Aug 2024 19:35:15 +0200	[thread overview]
Message-ID: <20240816173529.17873-2-nbd@nbd.name> (raw)
In-Reply-To: <20240816173529.17873-1-nbd@nbd.name>

If the ext-PA target power is unset, fall back to the standard EEPROM value.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt7603/init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/init.c b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
index 6c55c72f28a2..f84c9a06af75 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
@@ -456,11 +456,13 @@ mt7603_init_txpower(struct mt7603_dev *dev,
 	int target_power = eeprom[MT_EE_TX_POWER_0_START_2G + 2] & ~BIT(7);
 	u8 *rate_power = &eeprom[MT_EE_TX_POWER_CCK];
 	bool ext_pa = eeprom[MT_EE_NIC_CONF_0 + 1] & BIT(1);
+	u8 ext_pa_pwr;
 	int max_offset, cur_offset;
 	int i;
 
-	if (ext_pa && is_mt7603(dev))
-		target_power = eeprom[MT_EE_TX_POWER_TSSI_OFF] & ~BIT(7);
+	ext_pa_pwr = eeprom[MT_EE_TX_POWER_TSSI_OFF];
+	if (ext_pa && is_mt7603(dev) && ext_pa_pwr != 0 && ext_pa_pwr != 0xff)
+		target_power = ext_pa_pwr & ~BIT(7);
 
 	if (target_power & BIT(6))
 		target_power = -(target_power & GENMASK(5, 0));
-- 
2.44.0


  reply	other threads:[~2024-08-16 17:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-16 17:35 [PATCH 01/16] mt76: mt7603: fix mixed declarations and code Felix Fietkau
2024-08-16 17:35 ` Felix Fietkau [this message]
2024-08-16 17:35 ` [PATCH 03/16] wifi: mt76: mt7603: initialize chainmask Felix Fietkau
2024-08-16 17:35 ` [PATCH 04/16] wifi: mt76: fix mt76_get_rate Felix Fietkau
2024-08-16 17:35 ` [PATCH 05/16] wifi: mt76: partially move channel change code to core Felix Fietkau
2024-08-16 17:35 ` [PATCH 06/16] wifi: mt76: add separate tx scheduling queue for off-channel tx Felix Fietkau
2024-08-16 17:35 ` [PATCH 07/16] wifi: mt76: mt7915: disable tx worker during tx BA session enable/disable Felix Fietkau
2024-08-16 17:35 ` [PATCH 08/16] wifi: mt76: mt7915: allocate vif wcid in the same range as stations Felix Fietkau
2024-08-16 17:35 ` [PATCH 09/16] wifi: mt76: connac: add support for IEEE 802.11 fragmentation Felix Fietkau
2024-08-16 17:35 ` [PATCH 10/16] wifi: mt76: connac: add support for passing connection state directly Felix Fietkau
2024-08-16 17:35 ` [PATCH 11/16] wifi: mt76: change .sta_assoc callback to .sta_event Felix Fietkau
2024-08-16 17:35 ` [PATCH 12/16] wifi: mt76: mt7915: use mac80211 .sta_state op Felix Fietkau
2024-08-16 17:35 ` [PATCH 13/16] wifi: mt76: mt7915: set MT76_MCU_RESET early in mt7915_mac_full_reset Felix Fietkau
2024-08-16 17:35 ` [PATCH 14/16] wifi: mt76: mt7915: retry mcu messages Felix Fietkau
2024-08-16 17:35 ` [PATCH 15/16] wifi: mt76: mt7915: reset the device after MCU timeout Felix Fietkau
2024-08-23 18:32   ` Ben Greear
2024-08-23 18:35     ` Felix Fietkau
2024-08-16 17:35 ` [PATCH 16/16] wifi: mt76: mt7915: add dummy HW offload of IEEE 802.11 fragmentation Felix Fietkau

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=20240816173529.17873-2-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=linux-wireless@vger.kernel.org \
    /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