wifi: mt76: mt7915: configure noise floor reporting on reset
Subsystems (2)
PATCH 1/1 wifi: mt76: mt7915: configure noise floor reporting on reset
When performing a full system recovery of the MCU on a dual-phy platform, band 0 (usually 2.4GHz) stops reading correct noise floor data.
This is due to noise floor reporting only being configured correctly for the second device PHY.
Configure the respective registers correctly after restarting the MCU firmware to fix reported noise-floor values.
--- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +3 -1
@@ -25,11 +25,13 @@ int mt7915_run(struct ieee80211_hw *hw)struct mt7915_dev *dev =mt7915_hw_dev (hw);struct mt7915_phy *phy =mt7915_hw_phy (hw);bool running; +bool reset;int ret; running =mt7915_dev_running (dev); + reset =test_bit (MT76_RESET , &phy->mt76->state); -if (!running) { +if (!running || (reset && phy == &dev->phy)) { ret =mt76_connac_mcu_set_pm (&dev->mt76, dev->phy.mt76->band_idx,0 );if (ret)
Signature · 1 line
2.53.0
Felix Fietkau
maintainerQuoted 11 lines · David Bauer
When performing a full system recovery of the MCU on a dual-phy platform, band 0 (usually 2.4GHz) stops reading correct noise floor data.
This is due to noise floor reporting only being configured correctly for the second device PHY.
Configure the respective registers correctly after restarting the MCU firmware to fix reported noise-floor values.
Signed-off-by David Bauer <[email protected]>
Have you considered clearing MT76_STATE_RUNNING in mt7915_mac_restart instead?
- Felix
Hi Felix,
Quoted 5 lines · Felix Fietkau
Quoted 4 lines · David Bauer
When performing a full system recovery of the MCU on a dual-phy platform, band 0 (usually 2.4GHz) stops reading correct noise floor data.
Quoted 8 lines
Quoted 7 lines
This is due to noise floor reporting only being configured correctly for the second device PHY.
Configure the respective registers correctly after restarting the MCU firmware to fix reported noise-floor values.
Signed-off-by David Bauer <[email protected]>Have you considered clearing
MT76_STATE_RUNNINGinmt7915_mac_restartinstead?
The call to mt7915_run is guarded by MT76_STATE_RUNNING being set per-phy.
I think this is to not start the second PHY in case it was never started due to it not being present. We could in theory remove this check for the primary PHY and clear the flag prior calling mt7915_run.
This seems a bit more hacky to me. Alternatively I can also refactor the entire mechanism to make it easier to understand and resolve this indirection in the process.
What do you think?
Best
David
Quoted 2 lines
- Felix
Felix Fietkau
maintainerQuoted 19 lines · David Bauer
Hi Felix,
Quoted 5 lines · Felix Fietkau
Quoted 4 lines · David Bauer
When performing a full system recovery of the MCU on a dual-phy platform, band 0 (usually 2.4GHz) stops reading correct noise floor data.
Quoted 8 lines
Quoted 7 lines
This is due to noise floor reporting only being configured correctly for the second device PHY.
Configure the respective registers correctly after restarting the MCU firmware to fix reported noise-floor values.
Signed-off-by David Bauer <[email protected]>Have you considered clearing
MT76_STATE_RUNNINGinmt7915_mac_restartinstead?The call to
mt7915_runis guarded byMT76_STATE_RUNNINGbeing set per-phy.
Quoted 7 lines
I think this is to not start the second PHY in case it was never started due to it not being present. We could in theory remove this check for the primary PHY and clear the flag prior calling
mt7915_run.This seems a bit more hacky to me. Alternatively I can also refactor the entire mechanism to make it easier to understand and resolve this indirection in the process.
My suggestion would be to do this:start_main = test_and_clear_bit(MT76_STATE_RUNNING, &dev->mphy.state); start_ext = ext_phy &&
test_and_clear_bit(MT76_STATE_RUNNING, &ext_phy->state);
Then using those as conditions for calling mt7915_run in mt7915_mac_restart.
That way the special case in mt7915_run disappears and the behavior becomes easier to follow.
- Felix