Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd-Vt+b4OUoWG0@public.gmane.org>
To: Lorenzo Bianconi
	<lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 02/20] mt76: add stbc entries to mt76_rate_power
Date: Fri, 21 Sep 2018 18:09:37 +0200	[thread overview]
Message-ID: <73834a66-5d00-d7b2-b46c-6ab360588fd4@nbd.name> (raw)
In-Reply-To: <15d756db7fef57befcc2e2e28e640be10493df88.1537433365.git.lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On 2018-09-20 11:11, Lorenzo Bianconi wrote:
> From: Felix Fietkau <nbd-Vt+b4OUoWG0@public.gmane.org>
> 
> Add stbc tx power eeprom parsing support for mt76x2 driver.
> 
> Signed-off-by: Felix Fietkau <nbd-Vt+b4OUoWG0@public.gmane.org>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
I folded in the following extra change, and changed the description.
VHT8/9 also have STBC specific entries in the power registers.
I also added a distinction between vht[8/9] and ofdm[6/7], which
come from the same EEPROM value but have distinct register fields.

- Felix

---
--- a/mt76.h
+++ b/mt76.h
@@ -423,11 +423,11 @@ struct mt76_rate_power {
 		struct {
 			s8 cck[4];
 			s8 ofdm[8];
-			s8 stbc[8];
+			s8 stbc[10];
 			s8 ht[16];
 			s8 vht[10];
 		};
-		s8 all[46];
+		s8 all[48];
 	};
 };
 
--- a/mt76x2_eeprom.c
+++ b/mt76x2_eeprom.c
@@ -353,7 +353,6 @@ void mt76x2_get_rate_power(struct mt76x2_dev *dev, struct mt76_rate_power *t,
 	val = mt76x02_eeprom_get(&dev->mt76, MT_EE_TX_POWER_HT_MCS4);
 	t->ht[4] = t->ht[5] = mt76x2_rate_power_val(val);
 	t->ht[6] = t->ht[7] = mt76x2_rate_power_val(val >> 8);
-	memcpy(t->stbc, t->ht, sizeof(t->stbc));
 
 	val = mt76x02_eeprom_get(&dev->mt76, MT_EE_TX_POWER_HT_MCS8);
 	t->ht[8] = t->ht[9] = mt76x2_rate_power_val(val);
@@ -375,6 +374,10 @@ void mt76x2_get_rate_power(struct mt76x2_dev *dev, struct mt76_rate_power *t,
 	if (!is_5ghz)
 		val >>= 8;
 	t->vht[8] = t->vht[9] = mt76x2_rate_power_val(val >> 8);
+
+	memcpy(t->stbc, t->ht, sizeof(t->stbc[0]) * 8);
+	t->stbc[8] = t->vht[8];
+	t->stbc[9] = t->vht[9];
 }
 EXPORT_SYMBOL_GPL(mt76x2_get_rate_power);
 
--- a/mt76x2_phy_common.c
+++ b/mt76x2_phy_common.c
@@ -231,11 +231,11 @@ void mt76x2_phy_set_txpower(struct mt76x2_dev *dev)
 	mt76_wr(dev, MT_TX_PWR_CFG_4,
 		mt76x2_tx_power_mask(t.stbc[4], t.stbc[6], 0, 0));
 	mt76_wr(dev, MT_TX_PWR_CFG_7,
-		mt76x2_tx_power_mask(t.ofdm[6], t.vht[8], t.ht[6], t.vht[8]));
+		mt76x2_tx_power_mask(t.ofdm[7], t.vht[8], t.ht[7], t.vht[9]));
 	mt76_wr(dev, MT_TX_PWR_CFG_8,
-		mt76x2_tx_power_mask(t.ht[14], 0, t.vht[8], t.vht[8]));
+		mt76x2_tx_power_mask(t.ht[14], 0, t.vht[8], t.vht[9]));
 	mt76_wr(dev, MT_TX_PWR_CFG_9,
-		mt76x2_tx_power_mask(t.ht[6], 0, t.vht[8], t.vht[8]));
+		mt76x2_tx_power_mask(t.ht[7], 0, t.stbc[8], t.stbc[9]));
 }
 EXPORT_SYMBOL_GPL(mt76x2_phy_set_txpower);
 

  parent reply	other threads:[~2018-09-21 16:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20  9:11 [PATCH 00/20] unify mt76x2 and mt76x0 eeprom code Lorenzo Bianconi
     [not found] ` <cover.1537433365.git.lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-09-20  9:11   ` [PATCH 01/20] mt76: move seq_put_array in mt76-core module Lorenzo Bianconi
2018-09-20  9:11   ` [PATCH 02/20] mt76: add stbc entries to mt76_rate_power Lorenzo Bianconi
     [not found]     ` <15d756db7fef57befcc2e2e28e640be10493df88.1537433365.git.lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-09-21 16:09       ` Felix Fietkau [this message]
2018-09-20  9:11   ` [PATCH 03/20] mt76: move common eeprom definitions in mt76x02-lib module Lorenzo Bianconi
2018-09-20  9:11   ` [PATCH 04/20] mt76: move eeprom utility routines in mt76x02_eeprom.h Lorenzo Bianconi
2018-09-20  9:11   ` [PATCH 05/20] mt76: move mt76x2_eeprom_get " Lorenzo Bianconi
2018-09-20  9:11   ` [PATCH 06/20] mt76: move mt76x02_mac_setaddr in mt76x02-lib module Lorenzo Bianconi
2018-09-20  9:11   ` [PATCH 07/20] mt76: move mt76x2_get_efuse_data " Lorenzo Bianconi
2018-09-20  9:11   ` [PATCH 08/20] mt76: move mt76x2_ext_pa_enabled routine in mt76x02_eeprom.c Lorenzo Bianconi
2018-09-20  9:11   ` [PATCH 09/20] mt76x0: remove mt76x0_set_country_reg routine Lorenzo Bianconi
2018-09-20  9:11   ` [PATCH 10/20] mt76: add mt76x02_get_rx_gain and mt76x02_get_lna_gain utility routines Lorenzo Bianconi
2018-09-20  9:11   ` [PATCH 11/20] mt76x0: unify lna_gain parsing Lorenzo Bianconi
2018-09-20  9:11   ` [PATCH 12/20] mt76x0: unify rssi_offset parsing Lorenzo Bianconi
2018-09-20  9:12   ` [PATCH 13/20] mt76x0: unify temperature offset parsing Lorenzo Bianconi
2018-09-20  9:12   ` [PATCH 14/20] mt76x0: unify freq " Lorenzo Bianconi
2018-09-20  9:12   ` [PATCH 15/20] mt76: move mt76x02_eeprom_parse_hw_cap in mt76x02-lib module Lorenzo Bianconi
2018-09-20  9:12   ` [PATCH 16/20] mt76x0: unify parse hw capabilities Lorenzo Bianconi
2018-09-20  9:12   ` [PATCH 17/20] mt76: move mt76x2_tssi_enabled in mt76x02_eeprom.h Lorenzo Bianconi
2018-09-20  9:12   ` [PATCH 18/20] mt76x0: remove eeprom dependency from mt76x0_set_tx_power_per_rate Lorenzo Bianconi
2018-09-20  9:12   ` [PATCH 19/20] mt76x0: remove eeprom dependency from mt76x0_set_tx_power_per_chan Lorenzo Bianconi
2018-09-20  9:12   ` [PATCH 20/20] mt76x0: use shared debugfs implementation Lorenzo Bianconi
2018-09-20 12:40   ` [PATCH 00/20] unify mt76x2 and mt76x0 eeprom code 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=73834a66-5d00-d7b2-b46c-6ab360588fd4@nbd.name \
    --to=nbd-vt+b4ouowg0@public.gmane.org \
    --cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lorenzo.bianconi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.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