wifi: ath12k: handle thermal throttle stats WMI event

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@oss.qualcomm.com>
Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20260413153840.1969931-2-maharaja.kennadyrajan@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
This commit is contained in:
Maharaja Kennadyrajan 2026-04-13 21:08:36 +05:30 committed by Jeff Johnson
parent 31d4f8d427
commit 845b613b57
2 changed files with 47 additions and 0 deletions

View File

@ -8750,6 +8750,42 @@ 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;
tb = ath12k_wmi_tlv_parse(ab, skb);
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)
{
@ -9799,6 +9835,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;

View File

@ -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;