]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath12k: fix mac phy capability parsing
authorBaochen Qiang <baochen.qiang@oss.qualcomm.com>
Mon, 12 Jan 2026 07:36:26 +0000 (15:36 +0800)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Fri, 16 Jan 2026 01:19:39 +0000 (17:19 -0800)
Currently ath12k_pull_mac_phy_cap_svc_ready_ext() assumes only one band
supported in each phy, hence it skips 5 GHz band if 2 GHz band support
is detected. This does not work for device which gets only one phy but
has both bands supported, such as QCC2072.

Change to check each band individually to fix this issue.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00302-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.115823.3

Signed-off-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20260112-ath12k-support-qcc2072-v2-6-fc8ce1e43969@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/wmi.c

index dd643af892c28930239f63abd8f28e130ca2d4e6..ef7690f829ca48aadf3637902b91384d541aafda 100644 (file)
@@ -399,6 +399,7 @@ ath12k_pull_mac_phy_cap_svc_ready_ext(struct ath12k_wmi_pdev *wmi_handle,
        struct ath12k_band_cap *cap_band;
        struct ath12k_pdev_cap *pdev_cap = &pdev->cap;
        struct ath12k_fw_pdev *fw_pdev;
+       u32 supported_bands;
        u32 phy_map;
        u32 hw_idx, phy_idx = 0;
        int i;
@@ -422,14 +423,19 @@ ath12k_pull_mac_phy_cap_svc_ready_ext(struct ath12k_wmi_pdev *wmi_handle,
                return -EINVAL;
 
        mac_caps = wmi_mac_phy_caps + phy_idx;
+       supported_bands = le32_to_cpu(mac_caps->supported_bands);
+
+       if (!(supported_bands & WMI_HOST_WLAN_2GHZ_CAP) &&
+           !(supported_bands & WMI_HOST_WLAN_5GHZ_CAP))
+               return -EINVAL;
 
        pdev->pdev_id = ath12k_wmi_mac_phy_get_pdev_id(mac_caps);
        pdev->hw_link_id = ath12k_wmi_mac_phy_get_hw_link_id(mac_caps);
-       pdev_cap->supported_bands |= le32_to_cpu(mac_caps->supported_bands);
+       pdev_cap->supported_bands |= supported_bands;
        pdev_cap->ampdu_density = le32_to_cpu(mac_caps->ampdu_density);
 
        fw_pdev = &ab->fw_pdev[ab->fw_pdev_count];
-       fw_pdev->supported_bands = le32_to_cpu(mac_caps->supported_bands);
+       fw_pdev->supported_bands = supported_bands;
        fw_pdev->pdev_id = ath12k_wmi_mac_phy_get_pdev_id(mac_caps);
        fw_pdev->phy_id = le32_to_cpu(mac_caps->phy_id);
        ab->fw_pdev_count++;
@@ -438,10 +444,12 @@ ath12k_pull_mac_phy_cap_svc_ready_ext(struct ath12k_wmi_pdev *wmi_handle,
         * band to band for a single radio, need to see how this should be
         * handled.
         */
-       if (le32_to_cpu(mac_caps->supported_bands) & WMI_HOST_WLAN_2GHZ_CAP) {
+       if (supported_bands & WMI_HOST_WLAN_2GHZ_CAP) {
                pdev_cap->tx_chain_mask = le32_to_cpu(mac_caps->tx_chain_mask_2g);
                pdev_cap->rx_chain_mask = le32_to_cpu(mac_caps->rx_chain_mask_2g);
-       } else if (le32_to_cpu(mac_caps->supported_bands) & WMI_HOST_WLAN_5GHZ_CAP) {
+       }
+
+       if (supported_bands & WMI_HOST_WLAN_5GHZ_CAP) {
                pdev_cap->vht_cap = le32_to_cpu(mac_caps->vht_cap_info_5g);
                pdev_cap->vht_mcs = le32_to_cpu(mac_caps->vht_supp_mcs_5g);
                pdev_cap->he_mcs = le32_to_cpu(mac_caps->he_supp_mcs_5g);
@@ -451,8 +459,6 @@ ath12k_pull_mac_phy_cap_svc_ready_ext(struct ath12k_wmi_pdev *wmi_handle,
                        WMI_NSS_RATIO_EN_DIS_GET(mac_caps->nss_ratio);
                pdev_cap->nss_ratio_info =
                        WMI_NSS_RATIO_INFO_GET(mac_caps->nss_ratio);
-       } else {
-               return -EINVAL;
        }
 
        /* tx/rx chainmask reported from fw depends on the actual hw chains used,
@@ -468,7 +474,7 @@ ath12k_pull_mac_phy_cap_svc_ready_ext(struct ath12k_wmi_pdev *wmi_handle,
        pdev_cap->rx_chain_mask_shift =
                        find_first_bit((unsigned long *)&pdev_cap->rx_chain_mask, 32);
 
-       if (le32_to_cpu(mac_caps->supported_bands) & WMI_HOST_WLAN_2GHZ_CAP) {
+       if (supported_bands & WMI_HOST_WLAN_2GHZ_CAP) {
                cap_band = &pdev_cap->band[NL80211_BAND_2GHZ];
                cap_band->phy_id = le32_to_cpu(mac_caps->phy_id);
                cap_band->max_bw_supported = le32_to_cpu(mac_caps->max_bw_supported_2g);
@@ -488,7 +494,7 @@ ath12k_pull_mac_phy_cap_svc_ready_ext(struct ath12k_wmi_pdev *wmi_handle,
                                le32_to_cpu(mac_caps->he_ppet2g.ppet16_ppet8_ru3_ru0[i]);
        }
 
-       if (le32_to_cpu(mac_caps->supported_bands) & WMI_HOST_WLAN_5GHZ_CAP) {
+       if (supported_bands & WMI_HOST_WLAN_5GHZ_CAP) {
                cap_band = &pdev_cap->band[NL80211_BAND_5GHZ];
                cap_band->phy_id = le32_to_cpu(mac_caps->phy_id);
                cap_band->max_bw_supported =