[PATCH] wifi: ath9k: restore background spectral scan after reset

Nick Hainke posted 1 patch 1 week, 2 days ago
drivers/net/wireless/ath/ath9k/main.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
[PATCH] wifi: ath9k: restore background spectral scan after reset
Posted by Nick Hainke 1 week, 2 days ago
A reset leaves spectral_mode set to SPECTRAL_BACKGROUND, but resets the
spectral registers and receive filter. The driver therefore still reports
a background scan even though the hardware no longer produces FFT samples.

Re-trigger background spectral scanning after reset recovery so the
software and hardware state match again. Do not re-trigger spectral
scanning in disabled, manual, channel-scan, radar, or off-channel modes.

Assisted-by: Claude:opus-5
Signed-off-by: Nick Hainke <vincent@systemli.org>
---
 drivers/net/wireless/ath/ath9k/main.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 740a6fc7b067..00e587fe6ee3 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -231,6 +231,17 @@ static bool ath_prepare_reset(struct ath_softc *sc)
 	return ret;
 }
 
+static void ath_restore_spectral_scan(struct ath_softc *sc, bool start)
+{
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+
+	if (!start || sc->cur_chan->offchannel || sc->hw->conf.radar_enabled ||
+	    sc->spec_priv.spectral_mode != SPECTRAL_BACKGROUND)
+		return;
+
+	ath9k_cmn_spectral_scan_trigger(common, &sc->spec_priv);
+}
+
 static bool ath_complete_reset(struct ath_softc *sc, bool start)
 {
 	struct ath_hw *ah = sc->sc_ah;
@@ -269,6 +280,7 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)
 		ath_restart_work(sc);
 		ath_txq_schedule_all(sc);
 	}
+	ath_restore_spectral_scan(sc, start);
 
 	sc->gtt_cnt = 0;
 
-- 
2.55.0