git: e6ca3d05b93b - main - iwm: add thermal cutoff to firmware command support

From: Adrian Chadd <adrian_at_FreeBSD.org>
Date: Mon, 12 Oct 2026 02:51:36 UTC
The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=e6ca3d05b93b5f36dde2873076d7bc29dbcd46d1

commit e6ca3d05b93b5f36dde2873076d7bc29dbcd46d1
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2026-10-12 02:50:45 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-10-12 02:50:45 +0000

    iwm: add thermal cutoff to firmware command support
    
    This is based on firmware capabilities.
    
    Locally tested:
    
    * Intel 7260, STA mode
    
    Obtained from: OpenBSD a6e25c727a2214219715b51ba6af2221d7e0d674
    
    Differential Revision:  https://reviews.freebsd.org/D60077
---
 sys/dev/iwm/if_iwm.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c
index 3a2804242319..ed5949e3df6b 100644
--- a/sys/dev/iwm/if_iwm.c
+++ b/sys/dev/iwm/if_iwm.c
@@ -4727,6 +4727,29 @@ iwm_send_soc_conf(struct iwm_softc *sc)
 	return err;
 }
 
+static int
+iwm_send_temp_report_ths_cmd(struct iwm_softc *sc)
+{
+	struct iwm_temp_report_ths_cmd cmd;
+	int err;
+
+	/*
+	 * In order to give responsibility for critical-temperature-kill
+	 * and TX backoff to FW we need to send an empty temperature
+	 * reporting command at init time.
+	 */
+	memset(&cmd, 0, sizeof(cmd));
+
+	err = iwm_send_cmd_pdu(sc,
+	    IWM_WIDE_ID(IWM_PHY_OPS_GROUP, IWM_TEMP_REPORTING_THRESHOLDS_CMD),
+	    0, sizeof(cmd), &cmd);
+	if (err)
+		device_printf(sc->sc_dev,
+		    "TEMP_REPORT_THS_CMD command failed (error %d)\n", err);
+
+	return err;
+}
+
 static boolean_t
 iwm_is_lar_supported(struct iwm_softc *sc)
 {
@@ -4890,6 +4913,11 @@ iwm_init_hw(struct iwm_softc *sc)
 			goto error;
 	}
 
+	if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_CT_KILL_BY_FW)) {
+		if ((error = iwm_send_temp_report_ths_cmd(sc)) != 0)
+			goto error;
+	}
+
 	error = iwm_send_tx_ant_cfg(sc, iwm_get_valid_tx_ant(sc));
 	if (error != 0) {
 		device_printf(sc->sc_dev, "antenna config failed\n");