[PATCH ath-next v2] wifi: ath12k: add basic hwmon temperature reporting

Pablo MARTIN-GOMEZ pmartin-gomez at freebox.fr
Thu Feb 19 03:31:48 PST 2026


Hello,

On 19/02/2026 08:34, Maharaja Kennadyrajan wrote:
> Add initial thermal support by wiring up a per-radio (pdev) hwmon temperature
> sensor backed by the existing WMI pdev temperature command and event.
> When userspace reads the sysfs file temp1_input, the driver sends
> WMI_PDEV_GET_TEMPERATURE_CMDID (tag WMI_TAG_PDEV_GET_TEMPERATURE_CMD) and waits
> for the corresponding WMI_PDEV_TEMPERATURE_EVENTID
> (tag WMI_TAG_PDEV_TEMPERATURE_EVENT) to get the temperature and pdev_id.
>
> Export the reported value in millidegrees Celsius as required by hwmon.
> The temperature reported is per-radio (pdev). In a multi-radio wiphy under a
> single phy, a separate hwmon device is created for each radio.
>
> Sample command and output:
> $ cat /sys/devices/pci0000:00/.../ieee80211/phyX/hwmonY/temp1_input
> $ 50000
>
> 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
>
> Reported-by: kernel test robot <lkp at intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202602160145.YQdvbqYY-lkp@intel.com/
> Co-developed-by: Aishwarya R <aishwarya.r at oss.qualcomm.com>
> Signed-off-by: Aishwarya R <aishwarya.r at oss.qualcomm.com>
> Signed-off-by: Maharaja Kennadyrajan <maharaja.kennadyrajan at oss.qualcomm.com>
> ---
>
> v2: Fixed the kernel test robot reported build test error.
>
>   drivers/net/wireless/ath/ath12k/Makefile  |   1 +
>   drivers/net/wireless/ath/ath12k/core.c    |  13 +++
>   drivers/net/wireless/ath/ath12k/core.h    |   3 +
>   drivers/net/wireless/ath/ath12k/mac.c     |   5 +
>   drivers/net/wireless/ath/ath12k/thermal.c | 125 ++++++++++++++++++++++
>   drivers/net/wireless/ath/ath12k/thermal.h |  44 ++++++++
>   drivers/net/wireless/ath/ath12k/wmi.c     |  57 +++++-----
>   7 files changed, 217 insertions(+), 31 deletions(-)
>   create mode 100644 drivers/net/wireless/ath/ath12k/thermal.c
>   create mode 100644 drivers/net/wireless/ath/ath12k/thermal.h
>
[...]
> +
> +int ath12k_thermal_register(struct ath12k_base *ab)
> +{
> +	struct ath12k *ar;
> +	int i, j, ret;
> +
> +	if (!IS_REACHABLE(CONFIG_HWMON))
> +		return 0;
> +
> +	for (i = 0; i < ab->num_radios; i++) {
> +		ar = ab->pdevs[i].ar;
> +		if (!ar)
> +			continue;
> +
> +		ar->thermal.hwmon_dev =
> +			hwmon_device_register_with_groups(&ar->ah->hw->wiphy->dev,
> +							  "ath12k_hwmon", ar,
> +							  ath12k_hwmon_groups);
> +		if (IS_ERR(ar->thermal.hwmon_dev)) {
> +			ret = PTR_ERR(ar->thermal.hwmon_dev);
> +			ar->thermal.hwmon_dev = NULL;
> +			ath12k_err(ar->ab, "failed to register hwmon device: %d\n",
> +				   ret);
> +			for (j = i - 1; j >= 0; j--) {
> +				ar = ab->pdevs[i].ar;
Shouldn't it be `ar = ab->pdevs[j].ar;`?
> +				if (!ar)
> +					continue;
> +
> +				hwmon_device_unregister(ar->thermal.hwmon_dev);
> +				ar->thermal.hwmon_dev = NULL;
> +			}
> +			return ret;
> +		}
> +	}
> +
> +	return 0;
> +}
> +

[...]

Best regards,

Pablo MG




More information about the ath12k mailing list