From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH v2 1/4] mt76: mt7603: fix reading target tx power from eeprom
Date: Thu, 27 Jun 2019 12:58:01 +0200 [thread overview]
Message-ID: <20190627105801.64145-1-nbd@nbd.name> (raw)
In-Reply-To: <20190607164355.51876-1-nbd@nbd.name>
For the external PA (TSSI OFF) case, the target power needs to be read
from a different location in EEPROM
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
v2:
- fix patch prefix
- limit change to mt7603 (mt7628 does not have this eeprom field)
drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h | 2 ++
drivers/net/wireless/mediatek/mt76/mt7603/init.c | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h
index f27b99b7e359..b893facfba48 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h
@@ -69,6 +69,8 @@ enum mt7603_eeprom_field {
MT_EE_CP_FT_VERSION = 0x0f0,
+ MT_EE_TX_POWER_TSSI_OFF = 0x0f2,
+
MT_EE_XTAL_FREQ_OFFSET = 0x0f4,
MT_EE_XTAL_TRIM_2_COMP = 0x0f5,
MT_EE_XTAL_TRIM_3_COMP = 0x0f6,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/init.c b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
index 4e269044f8a4..43baad7fd082 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
@@ -465,9 +465,13 @@ mt7603_init_txpower(struct mt7603_dev *dev,
u8 *eeprom = (u8 *)dev->mt76.eeprom.data;
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);
int max_offset, cur_offset;
int i;
+ if (ext_pa && is_mt7603(dev))
+ target_power = eeprom[MT_EE_TX_POWER_TSSI_OFF] & ~BIT(7);
+
if (target_power & BIT(6))
target_power = -(target_power & GENMASK(5, 0));
--
2.17.0
prev parent reply other threads:[~2019-06-27 10:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-07 16:43 [PATCH 1/4] mt7603: fix reading target tx power from eeprom Felix Fietkau
2019-06-07 16:43 ` [PATCH 2/4] mt76: fix setting chan->max_power Felix Fietkau
2019-06-07 16:43 ` [PATCH 3/4] mt76: mt76x02: fix tx status reporting issues Felix Fietkau
2019-06-12 14:38 ` [PATCH v2 " Felix Fietkau
2019-06-13 8:44 ` Lorenzo Bianconi
2019-06-25 10:58 ` [PATCH v3 " Felix Fietkau
2019-06-07 16:43 ` [PATCH 4/4] mt76: mt76x02: fix tx reordering on rate control probing without a-mpdu Felix Fietkau
2019-06-08 10:42 ` [PATCH v2 " Felix Fietkau
2019-06-27 10:58 ` Felix Fietkau [this message]
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=20190627105801.64145-1-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