]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath12k: store and send country code to firmware after recovery
authorWen Gong <quic_wgong@quicinc.com>
Tue, 1 Apr 2025 02:08:40 +0000 (10:08 +0800)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Wed, 2 Apr 2025 15:04:32 +0000 (08:04 -0700)
Currently ath12k does not send the country code to firmware after device
recovery. As a result the country code will be the default one which
is reported from firmware. Country code is important, so ath12k also
need to restore it to the value which was used before recovery.

This is only needed for platforms which support the current_cc_support
hardware parameter.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20250401020840.357-5-quic_kangyang@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/core.c
drivers/net/wireless/ath/ath12k/core.h
drivers/net/wireless/ath/ath12k/mac.c
drivers/net/wireless/ath/ath12k/reg.c

index c2cd8c431dbcc5824138b5c3a0ac4061bd8fcae0..0e71935b272033c5322e76a01e931087ced875ca 100644 (file)
@@ -1420,6 +1420,7 @@ static void ath12k_update_11d(struct work_struct *work)
                pdev = &ab->pdevs[i];
                ar = pdev->ar;
 
+               memcpy(&ar->alpha2, &arg.alpha2, 2);
                ret = ath12k_wmi_send_set_current_country_cmd(ar, &arg);
                if (ret)
                        ath12k_warn(ar->ab,
index a3f75744ce6ff12468323f6d01d873f114433b1f..e8d2a0c859f6260d48c4c636793cf3a24c1c61b6 100644 (file)
@@ -761,6 +761,7 @@ struct ath12k {
        u32 vdev_id_11d_scan;
        struct completion completed_11d_scan;
        enum ath12k_11d_state state_11d;
+       u8 alpha2[REG_ALPHA2_LEN];
        bool regdom_set_by_user;
 
        struct completion fw_stats_complete;
index dcc8358fa8d436b4948e4ab275861bfd4bab75da..74b9e956c68d9a17d6d84e9bf95b47b66e2d3be9 100644 (file)
@@ -10347,6 +10347,14 @@ ath12k_mac_op_reconfig_complete(struct ieee80211_hw *hw,
                ath12k_warn(ar->ab, "pdev %d successfully recovered\n",
                            ar->pdev->pdev_id);
 
+               if (ar->ab->hw_params->current_cc_support &&
+                   ar->alpha2[0] != 0 && ar->alpha2[1] != 0) {
+                       struct wmi_set_current_country_arg arg = {};
+
+                       memcpy(&arg.alpha2, ar->alpha2, 2);
+                       ath12k_wmi_send_set_current_country_cmd(ar, &arg);
+               }
+
                if (ab->is_reset) {
                        recovery_count = atomic_inc_return(&ab->recovery_count);
 
index e6f0f563d3702b6abef90ec2c8aa807e6180c3ab..893650f76fb2d9f24177d524c5a979693b543657 100644 (file)
@@ -85,6 +85,7 @@ ath12k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
        for_each_ar(ah, ar, i) {
                if (ar->ab->hw_params->current_cc_support) {
                        memcpy(&current_arg.alpha2, request->alpha2, 2);
+                       memcpy(&ar->alpha2, &current_arg.alpha2, 2);
                        ret = ath12k_wmi_send_set_current_country_cmd(ar, &current_arg);
                        if (ret)
                                ath12k_warn(ar->ab,