* [PATCH] mt76x0: do not overwrite other MT_BBP(AGC, 8) fields
@ 2018-10-31 7:32 Stanislaw Gruszka
2018-10-31 10:07 ` Lorenzo Bianconi
2018-11-01 9:47 ` Felix Fietkau
0 siblings, 2 replies; 3+ messages in thread
From: Stanislaw Gruszka @ 2018-10-31 7:32 UTC (permalink / raw)
To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless
MT_BBP(AGC, 8) register has values depend on band in
mt76x0_bbp_switch_tab, so we should not overwrite other fields
than MT_BBP_AGC_GAIN when setting gain.
This can fix performance issues when connecting to 2.4GHz AP.
Fixes: 4636a2544c3b ("mt76x0: phy: align channel gain logic to mt76x2 one")
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
index ba98814ae47d..88dd0aa7e877 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
@@ -690,10 +690,8 @@ static void mt76x0_phy_temp_sensor(struct mt76x02_dev *dev)
static void mt76x0_phy_set_gain_val(struct mt76x02_dev *dev)
{
u8 gain = dev->cal.agc_gain_cur[0] - dev->cal.agc_gain_adjust;
- u32 val = 0x122c << 16 | 0xf2;
- mt76_wr(dev, MT_BBP(AGC, 8),
- val | FIELD_PREP(MT_BBP_AGC_GAIN, gain));
+ mt76_rmw_field(dev, MT_BBP(AGC, 8), MT_BBP_AGC_GAIN, gain);
if ((dev->mt76.chandef.chan->flags & IEEE80211_CHAN_RADAR) &&
!is_mt7630(dev))
--
2.7.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mt76x0: do not overwrite other MT_BBP(AGC, 8) fields
2018-10-31 7:32 [PATCH] mt76x0: do not overwrite other MT_BBP(AGC, 8) fields Stanislaw Gruszka
@ 2018-10-31 10:07 ` Lorenzo Bianconi
2018-11-01 9:47 ` Felix Fietkau
1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2018-10-31 10:07 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: Felix Fietkau, linux-wireless
> MT_BBP(AGC, 8) register has values depend on band in
> mt76x0_bbp_switch_tab, so we should not overwrite other fields
> than MT_BBP_AGC_GAIN when setting gain.
>
> This can fix performance issues when connecting to 2.4GHz AP.
>
> Fixes: 4636a2544c3b ("mt76x0: phy: align channel gain logic to mt76x2 one")
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
> drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> index ba98814ae47d..88dd0aa7e877 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> @@ -690,10 +690,8 @@ static void mt76x0_phy_temp_sensor(struct mt76x02_dev *dev)
> static void mt76x0_phy_set_gain_val(struct mt76x02_dev *dev)
> {
> u8 gain = dev->cal.agc_gain_cur[0] - dev->cal.agc_gain_adjust;
> - u32 val = 0x122c << 16 | 0xf2;
>
> - mt76_wr(dev, MT_BBP(AGC, 8),
> - val | FIELD_PREP(MT_BBP_AGC_GAIN, gain));
> + mt76_rmw_field(dev, MT_BBP(AGC, 8), MT_BBP_AGC_GAIN, gain);
>
> if ((dev->mt76.chandef.chan->flags & IEEE80211_CHAN_RADAR) &&
> !is_mt7630(dev))
> --
> 2.7.5
>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mt76x0: do not overwrite other MT_BBP(AGC, 8) fields
2018-10-31 7:32 [PATCH] mt76x0: do not overwrite other MT_BBP(AGC, 8) fields Stanislaw Gruszka
2018-10-31 10:07 ` Lorenzo Bianconi
@ 2018-11-01 9:47 ` Felix Fietkau
1 sibling, 0 replies; 3+ messages in thread
From: Felix Fietkau @ 2018-11-01 9:47 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: Lorenzo Bianconi, linux-wireless
On 2018-10-31 08:32, Stanislaw Gruszka wrote:
> MT_BBP(AGC, 8) register has values depend on band in
> mt76x0_bbp_switch_tab, so we should not overwrite other fields
> than MT_BBP_AGC_GAIN when setting gain.
>
> This can fix performance issues when connecting to 2.4GHz AP.
>
> Fixes: 4636a2544c3b ("mt76x0: phy: align channel gain logic to mt76x2 one")
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Applied, thanks.
- Felix
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-01 9:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31 7:32 [PATCH] mt76x0: do not overwrite other MT_BBP(AGC, 8) fields Stanislaw Gruszka
2018-10-31 10:07 ` Lorenzo Bianconi
2018-11-01 9:47 ` Felix Fietkau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).