Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _codeql_detected_source_root
6 changes: 5 additions & 1 deletion mt76x2/pci_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
mt76_wr(dev, MT_BBP(AGC, 61), 0xFF64A4E2);
mt76_wr(dev, MT_BBP(AGC, 7), 0x08081010);
mt76_wr(dev, MT_BBP(AGC, 11), 0x00000404);
mt76_wr(dev, MT_BBP(AGC, 2), 0x00007070);
/* Adjust AGC 2 for high-band 5GHz channels (157-165) to improve stability */
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the USB path: the comment specifies '(157-165)' but the logic applies to all >= 157. Please align the comment and the condition so they describe the same range.

Suggested change
/* Adjust AGC 2 for high-band 5GHz channels (157-165) to improve stability */
/* Adjust AGC 2 for high-band 5GHz channels (>= 157) to improve stability */

Copilot uses AI. Check for mistakes.
if (band == NL80211_BAND_5GHZ && chan->hw_value >= 157)
mt76_wr(dev, MT_BBP(AGC, 2), 0x00006868);
else
mt76_wr(dev, MT_BBP(AGC, 2), 0x00007070);
mt76_wr(dev, MT_TXOP_CTRL_CFG, 0x04101B3F);

if (scan)
Expand Down
3 changes: 3 additions & 0 deletions mt76x2/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ void mt76x2_phy_update_channel_gain(struct mt76x02_dev *dev)
agc_35 = agc_37 = 0x08080808;
else if (dev->mphy.chandef.width == NL80211_CHAN_WIDTH_80)
agc_35 = 0x10101014;
else if (dev->mphy.chandef.chan->band == NL80211_BAND_5GHZ &&
dev->mphy.chandef.chan->hw_value >= 157)
agc_35 = 0x0f0f0f14;
Comment on lines 322 to +326
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new high-band (>=157) AGC_35 value is unreachable when width == NL80211_CHAN_WIDTH_80 because the width check occurs first. If the intent is to reduce gain on UNII-3 regardless of channel width, reorder the conditionals or incorporate the >=157 override into the 80MHz branch so high-band 80MHz channels also get 0x0f0f0f14 (or an explicitly chosen 80MHz high-band value).

Suggested change
else if (dev->mphy.chandef.width == NL80211_CHAN_WIDTH_80)
agc_35 = 0x10101014;
else if (dev->mphy.chandef.chan->band == NL80211_BAND_5GHZ &&
dev->mphy.chandef.chan->hw_value >= 157)
agc_35 = 0x0f0f0f14;
else if (dev->mphy.chandef.chan->band == NL80211_BAND_5GHZ &&
dev->mphy.chandef.chan->hw_value >= 157)
agc_35 = 0x0f0f0f14;
else if (dev->mphy.chandef.width == NL80211_CHAN_WIDTH_80)
agc_35 = 0x10101014;

Copilot uses AI. Check for mistakes.
else
agc_35 = 0x11111116;

Expand Down
6 changes: 5 additions & 1 deletion mt76x2/usb_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ int mt76x2u_phy_set_channel(struct mt76x02_dev *dev,
mt76_wr(dev, MT_BBP(AGC, 61), 0xff64a4e2);
mt76_wr(dev, MT_BBP(AGC, 7), 0x08081010);
mt76_wr(dev, MT_BBP(AGC, 11), 0x00000404);
mt76_wr(dev, MT_BBP(AGC, 2), 0x00007070);
/* Adjust AGC 2 for high-band 5GHz channels (157-165) to improve stability */
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says '(157-165)' but the condition applies to all channels >= 157. Either tighten the condition to match the stated range (e.g., <= 165) or update the comment to reflect the actual behavior (e.g., 'channels >=157 / UNII-3+').

Suggested change
/* Adjust AGC 2 for high-band 5GHz channels (157-165) to improve stability */
/* Adjust AGC 2 for high-band 5GHz channels (>=157 / UNII-3+) to improve stability */

Copilot uses AI. Check for mistakes.
if (chan->band == NL80211_BAND_5GHZ && chan->hw_value >= 157)
mt76_wr(dev, MT_BBP(AGC, 2), 0x00006868);
else
mt76_wr(dev, MT_BBP(AGC, 2), 0x00007070);
mt76_wr(dev, MT_TXOP_CTRL_CFG, 0X04101b3f);

mt76_set(dev, MT_BBP(TXO, 4), BIT(25));
Expand Down
Loading