From: Kang Yang <quic_kangyang@quicinc.com>
To: <ath12k@lists.infradead.org>
Cc: <linux-wireless@vger.kernel.org>, <quic_kangyang@quicinc.com>
Subject: [PATCH v10 1/4] wifi: ath12k: add configure country code for WCN7850
Date: Wed, 12 Feb 2025 14:31:57 +0800 [thread overview]
Message-ID: <20250212063200.1631-2-quic_kangyang@quicinc.com> (raw)
In-Reply-To: <20250212063200.1631-1-quic_kangyang@quicinc.com>
From: Wen Gong <quic_wgong@quicinc.com>
Currently, WMI_SET_INIT_COUNTRY_CMDID is used to set country code for
WCN7850 and QCN9274.
But WMI_SET_INIT_COUNTRY_CMDID is not the correct command for WCN7850.
Add handler to send WMI_SET_CURRENT_COUNTRY_CMDID to firmware, which
is used for WCN7850 to update country code.
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>
---
drivers/net/wireless/ath/ath12k/wmi.c | 36 +++++++++++++++++++++++++++
drivers/net/wireless/ath/ath12k/wmi.h | 13 ++++++++++
2 files changed, 49 insertions(+)
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index f934d49acee6..0794aaf9ca03 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -3313,6 +3313,42 @@ int ath12k_wmi_send_init_country_cmd(struct ath12k *ar,
return ret;
}
+int ath12k_wmi_send_set_current_country_cmd(struct ath12k *ar,
+ struct wmi_set_current_country_arg *arg)
+{
+ struct ath12k_wmi_pdev *wmi = ar->wmi;
+ struct wmi_set_current_country_cmd *cmd;
+ struct sk_buff *skb;
+ int ret;
+
+ skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (struct wmi_set_current_country_cmd *)skb->data;
+ cmd->tlv_header =
+ ath12k_wmi_tlv_cmd_hdr(WMI_TAG_SET_CURRENT_COUNTRY_CMD,
+ sizeof(*cmd));
+
+ cmd->pdev_id = cpu_to_le32(ar->pdev->pdev_id);
+ memcpy(&cmd->new_alpha2, &arg->alpha2, sizeof(arg->alpha2));
+ ret = ath12k_wmi_cmd_send(wmi, skb, WMI_SET_CURRENT_COUNTRY_CMDID);
+
+ ath12k_dbg(ar->ab, ATH12K_DBG_WMI,
+ "set current country pdev id %d alpha2 %c%c\n",
+ ar->pdev->pdev_id,
+ arg->alpha2[0],
+ arg->alpha2[1]);
+
+ if (ret) {
+ ath12k_warn(ar->ab,
+ "failed to send WMI_SET_CURRENT_COUNTRY_CMDID: %d\n", ret);
+ dev_kfree_skb(skb);
+ }
+
+ return ret;
+}
+
int
ath12k_wmi_send_twt_enable_cmd(struct ath12k *ar, u32 pdev_id)
{
diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 1ba33e30ddd2..8a8504ccdc02 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -4110,6 +4110,16 @@ struct ath12k_wmi_eht_rate_set_params {
#define REG_ALPHA2_LEN 2
#define MAX_6G_REG_RULES 5
+struct wmi_set_current_country_arg {
+ u8 alpha2[REG_ALPHA2_LEN];
+};
+
+struct wmi_set_current_country_cmd {
+ __le32 tlv_header;
+ __le32 pdev_id;
+ __le32 new_alpha2;
+} __packed;
+
enum wmi_start_event_param {
WMI_VDEV_START_RESP_EVENT = 0,
WMI_VDEV_RESTART_RESP_EVENT,
@@ -5990,6 +6000,9 @@ int ath12k_wmi_send_bcn_offload_control_cmd(struct ath12k *ar,
u32 vdev_id, u32 bcn_ctrl_op);
int ath12k_wmi_send_init_country_cmd(struct ath12k *ar,
struct ath12k_wmi_init_country_arg *arg);
+int
+ath12k_wmi_send_set_current_country_cmd(struct ath12k *ar,
+ struct wmi_set_current_country_arg *arg);
int ath12k_wmi_peer_rx_reorder_queue_setup(struct ath12k *ar,
int vdev_id, const u8 *addr,
dma_addr_t paddr, u8 tid,
--
2.34.1
next prev parent reply other threads:[~2025-02-12 6:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 6:31 [PATCH v10 0/4] wifi: ath12k: add 11d scan offload support and handle country code for WCN7850 Kang Yang
2025-02-12 6:31 ` Kang Yang [this message]
2025-02-19 4:37 ` [PATCH v10 1/4] wifi: ath12k: add configure " Vasanthakumar Thiagarajan
2025-02-12 6:31 ` [PATCH v10 2/4] wifi: ath12k: add 11d scan offload support Kang Yang
2025-02-12 11:19 ` ath_bot_tesseract
2025-02-19 4:47 ` Vasanthakumar Thiagarajan
2025-02-12 6:31 ` [PATCH v10 3/4] wifi: ath12k: use correct WMI command to set country code for WCN7850 Kang Yang
2025-02-12 11:19 ` ath_bot_tesseract
2025-02-19 4:35 ` Vasanthakumar Thiagarajan
2025-02-20 3:09 ` Kang Yang
2025-02-19 4:49 ` Vasanthakumar Thiagarajan
2025-02-19 4:50 ` Vasanthakumar Thiagarajan
2025-02-12 6:32 ` [PATCH v10 4/4] wifi: ath12k: store and send country code to firmware after recovery Kang Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250212063200.1631-2-quic_kangyang@quicinc.com \
--to=quic_kangyang@quicinc.com \
--cc=ath12k@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox