mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-20 10:51:27 +00:00
196 lines
5.4 KiB
Diff
196 lines
5.4 KiB
Diff
From 3d50ec5a539a73deecb81591c482f76460fd5ea6 Mon Sep 17 00:00:00 2001
|
|
From: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
|
|
Date: Wed, 26 Oct 2022 06:57:24 +0530
|
|
Subject: [PATCH 3/3] wifi: ath12k: add phy count capability learn
|
|
|
|
Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
|
|
---
|
|
drivers/net/wireless/ath/ath12k/qmi.c | 108 +++++++++++++++++++++++++-
|
|
drivers/net/wireless/ath/ath12k/qmi.h | 17 ++++
|
|
2 files changed, 124 insertions(+), 1 deletion(-)
|
|
|
|
--- a/drivers/net/wireless/ath/ath12k/qmi.c
|
|
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
|
|
@@ -716,6 +716,67 @@ static struct qmi_elem_info qmi_wlanfw_h
|
|
},
|
|
};
|
|
|
|
+static struct qmi_elem_info qmi_wlanfw_phy_cap_req_msg_v01_ei[] = {
|
|
+ {
|
|
+ .data_type = QMI_EOTI,
|
|
+ .array_type = NO_ARRAY,
|
|
+ .tlv_type = QMI_COMMON_TLV_TYPE,
|
|
+ },
|
|
+};
|
|
+
|
|
+static struct qmi_elem_info qmi_wlanfw_phy_cap_resp_msg_v01_ei[] = {
|
|
+ {
|
|
+ .data_type = QMI_STRUCT,
|
|
+ .elem_len = 1,
|
|
+ .elem_size = sizeof(struct qmi_response_type_v01),
|
|
+ .array_type = NO_ARRAY,
|
|
+ .tlv_type = 0x02,
|
|
+ .offset = offsetof(struct qmi_wlanfw_phy_cap_resp_msg_v01, resp),
|
|
+ .ei_array = qmi_response_type_v01_ei,
|
|
+ },
|
|
+ {
|
|
+ .data_type = QMI_OPT_FLAG,
|
|
+ .elem_len = 1,
|
|
+ .elem_size = sizeof(u8),
|
|
+ .array_type = NO_ARRAY,
|
|
+ .tlv_type = 0x10,
|
|
+ .offset = offsetof(struct qmi_wlanfw_phy_cap_resp_msg_v01,
|
|
+ num_phy_valid),
|
|
+ },
|
|
+ {
|
|
+ .data_type = QMI_UNSIGNED_1_BYTE,
|
|
+ .elem_len = 1,
|
|
+ .elem_size = sizeof(u8),
|
|
+ .array_type = NO_ARRAY,
|
|
+ .tlv_type = 0x10,
|
|
+ .offset = offsetof(struct qmi_wlanfw_phy_cap_resp_msg_v01,
|
|
+ num_phy),
|
|
+ },
|
|
+ {
|
|
+ .data_type = QMI_OPT_FLAG,
|
|
+ .elem_len = 1,
|
|
+ .elem_size = sizeof(u8),
|
|
+ .array_type = NO_ARRAY,
|
|
+ .tlv_type = 0x11,
|
|
+ .offset = offsetof(struct qmi_wlanfw_phy_cap_resp_msg_v01,
|
|
+ board_id_valid),
|
|
+ },
|
|
+ {
|
|
+ .data_type = QMI_UNSIGNED_4_BYTE,
|
|
+ .elem_len = 1,
|
|
+ .elem_size = sizeof(u32),
|
|
+ .array_type = NO_ARRAY,
|
|
+ .tlv_type = 0x11,
|
|
+ .offset = offsetof(struct qmi_wlanfw_phy_cap_resp_msg_v01,
|
|
+ board_id),
|
|
+ },
|
|
+ {
|
|
+ .data_type = QMI_EOTI,
|
|
+ .array_type = NO_ARRAY,
|
|
+ .tlv_type = QMI_COMMON_TLV_TYPE,
|
|
+ },
|
|
+};
|
|
+
|
|
static struct qmi_elem_info qmi_wlanfw_ind_register_req_msg_v01_ei[] = {
|
|
{
|
|
.data_type = QMI_OPT_FLAG,
|
|
@@ -2772,7 +2833,7 @@ static int ath12k_qmi_fill_mlo_host_caps
|
|
|
|
mutex_lock(&ag->mutex_lock);
|
|
|
|
- if (ag->id == ATH12K_INVALID_GRP_ID) {
|
|
+ if (ag->id == ATH12K_INVALID_GRP_ID || !ab->qmi.num_radios) {
|
|
ath12k_dbg(ab, ATH12K_DBG_QMI, "Skip MLO cap send for chip id %d\n",
|
|
ab->chip_id);
|
|
mutex_unlock(&ag->mutex_lock);
|
|
@@ -2941,6 +3002,49 @@ out:
|
|
return ret;
|
|
}
|
|
|
|
+static int ath12k_qmi_phy_cap_send(struct ath12k_base *ab)
|
|
+{
|
|
+ struct qmi_wlanfw_phy_cap_req_msg_v01 req = { };
|
|
+ struct qmi_wlanfw_phy_cap_resp_msg_v01 resp = { };
|
|
+ struct qmi_txn txn = { };
|
|
+ int ret;
|
|
+
|
|
+ ret = qmi_txn_init(&ab->qmi.handle, &txn,
|
|
+ qmi_wlanfw_phy_cap_resp_msg_v01_ei, &resp);
|
|
+ if (ret < 0)
|
|
+ goto out;
|
|
+
|
|
+ ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
|
|
+ QMI_WLANFW_PHY_CAP_REQ_V01,
|
|
+ QMI_WLANFW_PHY_CAP_REQ_MSG_V01_MAX_LEN,
|
|
+ qmi_wlanfw_phy_cap_req_msg_v01_ei, &req);
|
|
+ if (ret < 0) {
|
|
+ ath12k_warn(ab, "failed to send phy capability request, err = %d\n", ret);
|
|
+ goto out;
|
|
+ }
|
|
+
|
|
+ ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS));
|
|
+ if (ret < 0)
|
|
+ goto out;
|
|
+
|
|
+ if (resp.resp.result != QMI_RESULT_SUCCESS_V01)
|
|
+ goto out;
|
|
+
|
|
+ if (!resp.num_phy_valid)
|
|
+ goto out;
|
|
+
|
|
+ ab->qmi.num_radios = resp.num_phy;
|
|
+
|
|
+ ath12k_dbg(ab, ATH12K_DBG_QMI, "PHY capability resp valid %d num_phy %d valid %d board_id %d\n",
|
|
+ resp.num_phy_valid, resp.num_phy,
|
|
+ resp.board_id_valid, resp.board_id);
|
|
+ return 0;
|
|
+
|
|
+out:
|
|
+ ab->qmi.num_radios = ab->hw_params->num_local_link;
|
|
+ return ret;
|
|
+}
|
|
+
|
|
static int ath12k_qmi_fw_ind_register_send(struct ath12k_base *ab)
|
|
{
|
|
struct qmi_wlanfw_ind_register_req_msg_v01 *req;
|
|
@@ -4238,7 +4342,7 @@ static int ath12k_qmi_event_server_arriv
|
|
return ret;
|
|
}
|
|
|
|
- qmi->num_radios = ab->hw_params->num_local_link;
|
|
+ ath12k_qmi_phy_cap_send(ab);
|
|
|
|
spin_lock(&qmi->event_lock);
|
|
ath12k_qmi_set_event_block(&ab->qmi, true);
|
|
--- a/drivers/net/wireless/ath/ath12k/qmi.h
|
|
+++ b/drivers/net/wireless/ath/ath12k/qmi.h
|
|
@@ -334,6 +334,23 @@ struct qmi_wlanfw_host_cap_resp_msg_v01
|
|
struct qmi_response_type_v01 resp;
|
|
};
|
|
|
|
+#define QMI_WLANFW_PHY_CAP_REQ_MSG_V01_MAX_LEN 0
|
|
+#define QMI_WLANFW_PHY_CAP_REQ_V01 0x0057
|
|
+#define QMI_WLANFW_PHY_CAP_RESP_MSG_V01_MAX_LEN 18
|
|
+#define QMI_WLANFW_PHY_CAP_RESP_V01 0x0057
|
|
+
|
|
+struct qmi_wlanfw_phy_cap_req_msg_v01 {
|
|
+ char placeholder;
|
|
+};
|
|
+
|
|
+struct qmi_wlanfw_phy_cap_resp_msg_v01 {
|
|
+ struct qmi_response_type_v01 resp;
|
|
+ u8 num_phy_valid;
|
|
+ u8 num_phy;
|
|
+ u8 board_id_valid;
|
|
+ u32 board_id;
|
|
+};
|
|
+
|
|
#define QMI_WLANFW_IND_REGISTER_REQ_MSG_V01_MAX_LEN 54
|
|
#define QMI_WLANFW_IND_REGISTER_REQ_V01 0x0020
|
|
#define QMI_WLANFW_IND_REGISTER_RESP_MSG_V01_MAX_LEN 18
|
|
--- a/drivers/net/wireless/ath/ath12k/hw.c
|
|
+++ b/drivers/net/wireless/ath/ath12k/hw.c
|
|
@@ -1014,7 +1014,7 @@ static const struct ath12k_hw_params ath
|
|
.wakeup_mhi = false,
|
|
.alloc_cacheable_memory = true,
|
|
.max_mlo_peer = ATH12K_MAX_MLO_PEER,
|
|
- .num_local_link = 1,
|
|
+ .num_local_link = 0,
|
|
},
|
|
{
|
|
.name = "wcn7850 hw2.0",
|
|
@@ -1144,7 +1144,7 @@ static const struct ath12k_hw_params ath
|
|
.wakeup_mhi = false,
|
|
.alloc_cacheable_memory = true,
|
|
.max_mlo_peer = ATH12K_MAX_MLO_PEER,
|
|
- .num_local_link = 1,
|
|
+ .num_local_link = 0,
|
|
},
|
|
};
|
|
|