wifi: ath12k: Fix frequency range in driver
authorAditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Tue, 8 Apr 2025 04:21:27 +0000 (09:51 +0530)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Thu, 17 Apr 2025 22:49:33 +0000 (15:49 -0700)
commit657b0c72c4ad688d424560af98e3258b3f875a4d
treef5e96003487fdc6ec363d0be5fbd6b95819be76b
parentb7544de8a2984e61b95c58c1c6c1e8ce659b1021
wifi: ath12k: Fix frequency range in driver

During the initial WMI exchange, the firmware updates the
hardware-supported start and end frequencies in the
ath12k_wmi_hal_reg_capabilities_ext_arg structure. These frequencies,
being hardware-supported, may not always align with the current
regulatory operating frequencies. When operating as multiple grouped
hardwares under a single wiphy, the driver advertises these values
directly to the upper layer in the per-radio frequency range,
which can be misleading.

Sample output snippet from iw phyX info command -

[..]
Supported wiphy radios:
          * Idx 0:
                  Frequency Range: 2312 MHz - 2732 MHz
 [..]

          * Idx 1:
                  Frequency Range: 5150 MHz - 5330 MHz
 [..]
[..]

The frequency range displayed above is incorrect because the driver
directly advertises the hardware-supported values to the upper layer.

The driver is aware of the current operating regulatory rules, and
hence it can use this information to determine the final operating
start and end frequencies.

To resolve this issue, add support to store the start and end
frequencies received during the regulatory update event.
Then, intersect these with the hardware-supported start and
end frequencies, and finally, advertise the intersected values to the
upper layer.

Sample output snippet from iw phyX info command after the fix -

[..]
Supported wiphy radios:
          * Idx 0:
                  Frequency Range: 2402 MHz - 2472 MHz
 [..]

          * Idx 1:
                  Frequency Range: 5170 MHz - 5330 MHz
 [..]
[..]

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Co-developed-by: Rajat Soni <quic_rajson@quicinc.com>
Signed-off-by: Rajat Soni <quic_rajson@quicinc.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20250408042128.720263-3-quic_rajson@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/core.h
drivers/net/wireless/ath/ath12k/mac.c
drivers/net/wireless/ath/ath12k/reg.c