[PATCH ath-next 1/5] wifi: ath12k: handle thermal throttle stats WMI event
Maharaja Kennadyrajan
maharaja.kennadyrajan at oss.qualcomm.com
Tue Mar 31 07:24:42 PDT 2026
Add handling for WMI_THERM_THROT_STATS_EVENTID by defining the
wmi_therm_throt_stats_event TLV and parsing pdev_id, temperature and
throttle level.
The firmware can emit this event periodically, including when the
throttle level is 0.
Log the received thermal throttle stats to get the current temperature level,
temperature and thermal throttling levels.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00302-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.115823.3
Signed-off-by: Maharaja Kennadyrajan <maharaja.kennadyrajan at oss.qualcomm.com>
---
drivers/net/wireless/ath/ath12k/wmi.c | 38 +++++++++++++++++++++++++++
drivers/net/wireless/ath/ath12k/wmi.h | 8 ++++++
2 files changed, 46 insertions(+)
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index 65a05a9520ff..34184d0d03ff 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -8819,6 +8819,41 @@ ath12k_wmi_pdev_temperature_event(struct ath12k_base *ab,
rcu_read_unlock();
}
+static void ath12k_wmi_thermal_throt_stats_event(struct ath12k_base *ab,
+ struct sk_buff *skb)
+{
+ const struct wmi_therm_throt_stats_event *ev;
+ struct ath12k *ar;
+
+ const void **tb __free(kfree) = ath12k_wmi_tlv_parse_alloc(ab, skb, GFP_ATOMIC);
+ if (IS_ERR(tb)) {
+ ath12k_err(ab, "failed to parse thermal throttling stats tlv: %ld\n",
+ PTR_ERR(tb));
+ return;
+ }
+
+ ev = tb[WMI_TAG_THERM_THROT_STATS_EVENT];
+ if (!ev) {
+ ath12k_err(ab, "failed to fetch thermal throt stats ev\n");
+ return;
+ }
+
+ rcu_read_lock();
+ ar = ath12k_mac_get_ar_by_pdev_id(ab, le32_to_cpu(ev->pdev_id));
+ if (!ar) {
+ ath12k_warn(ab, "received thermal_throt_stats in invalid pdev %u\n",
+ le32_to_cpu(ev->pdev_id));
+ rcu_read_unlock();
+ return;
+ }
+ rcu_read_unlock();
+
+ ath12k_dbg(ab, ATH12K_DBG_WMI,
+ "thermal stats ev level %u pdev_id %u temp %u throt_levels %u\n",
+ le32_to_cpu(ev->level), le32_to_cpu(ev->pdev_id),
+ le32_to_cpu(ev->temp), le32_to_cpu(ev->therm_throt_levels));
+}
+
static void ath12k_fils_discovery_event(struct ath12k_base *ab,
struct sk_buff *skb)
{
@@ -9900,6 +9935,9 @@ static void ath12k_wmi_op_rx(struct ath12k_base *ab, struct sk_buff *skb)
case WMI_PDEV_TEMPERATURE_EVENTID:
ath12k_wmi_pdev_temperature_event(ab, skb);
break;
+ case WMI_THERM_THROT_STATS_EVENTID:
+ ath12k_wmi_thermal_throt_stats_event(ab, skb);
+ break;
case WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID:
ath12k_wmi_pdev_dma_ring_buf_release_event(ab, skb);
break;
diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 5ba9b7d3a888..8539435c292d 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -870,6 +870,7 @@ enum wmi_tlv_event_id {
WMI_READ_DATA_FROM_FLASH_EVENTID,
WMI_REPORT_RX_AGGR_FAILURE_EVENTID,
WMI_PKGID_EVENTID,
+ WMI_THERM_THROT_STATS_EVENTID,
WMI_GPIO_INPUT_EVENTID = WMI_TLV_CMD(WMI_GRP_GPIO),
WMI_UPLOADH_EVENTID,
WMI_CAPTUREH_EVENTID,
@@ -4120,6 +4121,13 @@ enum set_init_cc_flags {
ALPHA_IS_SET,
};
+struct wmi_therm_throt_stats_event {
+ __le32 pdev_id;
+ __le32 temp;
+ __le32 level;
+ __le32 therm_throt_levels;
+} __packed;
+
struct ath12k_wmi_init_country_arg {
union {
u16 country_code;
--
2.34.1
More information about the ath12k
mailing list