Browse Source

qcacld-3.0: Add pld support to get WLAN H.W capabilities

Add pld support support to get WLAN H.W capabilities
using pld_get_soc_info API.

Change-Id: Ia3c719d59f88c30cb78b6321f96a894c08e8c693
CRs-Fixed: 3502672
Karthik Kantamneni 1 year ago
parent
commit
b7cec37072
2 changed files with 71 additions and 0 deletions
  1. 50 0
      core/pld/inc/pld_common.h
  2. 21 0
      core/pld/src/pld_ipci.c

+ 50 - 0
core/pld/inc/pld_common.h

@@ -423,6 +423,54 @@ struct pld_dev_mem_info {
 	u64 size;
 };
 
+/**
+ * enum pld_wlan_hw_nss_info - WLAN HW nss info
+ * @PLD_WLAN_HW_CAP_NSS_UNSPECIFIED: nss info not specified
+ * @PLD_WLAN_HW_CAP_NSS_1x1: supported nss link 1x1
+ * @PLD_WLAN_HW_CAP_NSS_2x2: supported nss link 2x2
+ */
+enum pld_wlan_hw_nss_info {
+	PLD_WLAN_HW_CAP_NSS_UNSPECIFIED,
+	PLD_WLAN_HW_CAP_NSS_1x1,
+	PLD_WLAN_HW_CAP_NSS_2x2
+};
+
+/**
+ * enum pld_wlan_hw_channel_bw_info - WLAN HW channel bw info
+ * @PLD_WLAN_HW_CHANNEL_BW_UNSPECIFIED: bw info not specified
+ * @PLD_WLAN_HW_CHANNEL_BW_80MHZ: supported bw 80MHZ
+ * @PLD_WLAN_HW_CHANNEL_BW_160MHZ: supported bw 160MHZ
+ */
+enum pld_wlan_hw_channel_bw_info  {
+	PLD_WLAN_HW_CHANNEL_BW_UNSPECIFIED,
+	PLD_WLAN_HW_CHANNEL_BW_80MHZ,
+	PLD_WLAN_HW_CHANNEL_BW_160MHZ
+};
+
+/**
+ * enum pld_wlan_hw_qam_info - WLAN HW qam info
+ * @PLD_WLAN_HW_QAM_UNSPECIFIED: QAM info not specified
+ * @PLD_WLAN_HW_QAM_1K: 1K QAM supported
+ * @PLD_WLAN_HW_QAM_4K: 4K QAM supported
+ */
+enum pld_wlan_hw_qam_info  {
+	PLD_WLAN_HW_QAM_UNSPECIFIED,
+	PLD_WLAN_HW_QAM_1K,
+	PLD_WLAN_HW_QAM_4K
+};
+
+/**
+ * struct pld_wlan_hw_cap_info - WLAN HW cap info
+ * @nss: nss info
+ * @bw: bw info
+ * @qam: qam info
+ */
+struct pld_wlan_hw_cap_info {
+	enum pld_wlan_hw_nss_info nss;
+	enum pld_wlan_hw_channel_bw_info bw;
+	enum pld_wlan_hw_qam_info qam;
+};
+
 #define PLD_MAX_TIMESTAMP_LEN 32
 #define PLD_WLFW_MAX_BUILD_ID_LEN 128
 #define PLD_MAX_DEV_MEM_NUM 4
@@ -440,6 +488,7 @@ struct pld_dev_mem_info {
  * @device_version: WLAN device version info
  * @dev_mem_info: WLAN device memory info
  * @fw_build_id: Firmware build identifier
+ * @hw_cap_info: WLAN HW capabilities info
  *
  * pld_soc_info is used to store WLAN SOC information.
  */
@@ -455,6 +504,7 @@ struct pld_soc_info {
 	struct pld_device_version device_version;
 	struct pld_dev_mem_info dev_mem_info[PLD_MAX_DEV_MEM_NUM];
 	char fw_build_id[PLD_WLFW_MAX_BUILD_ID_LEN + 1];
+	struct pld_wlan_hw_cap_info hw_cap_info;
 };
 
 /**

+ 21 - 0
core/pld/src/pld_ipci.c

@@ -595,6 +595,25 @@ int pld_ipci_wlan_disable(struct device *dev, enum pld_driver_mode mode)
 	return icnss_wlan_disable(dev, ICNSS_OFF);
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0))
+static void pld_ipci_populate_hw_cap_info(struct icnss_soc_info *icnss_info,
+					  struct pld_soc_info *info)
+{
+	/*WLAN HW cap info*/
+	info->hw_cap_info.nss =
+		(enum pld_wlan_hw_nss_info)icnss_info->rd_card_chain_cap;
+	info->hw_cap_info.bw =
+	(enum pld_wlan_hw_channel_bw_info)icnss_info->phy_he_channel_width_cap;
+	info->hw_cap_info.qam =
+		(enum pld_wlan_hw_qam_info)icnss_info->phy_qam_cap;
+}
+#else
+static void pld_ipci_populate_hw_cap_info(struct icnss_soc_info *icnss_info,
+					  struct pld_soc_info *info)
+{
+}
+#endif
+
 int pld_ipci_get_soc_info(struct device *dev, struct pld_soc_info *info)
 {
 	int errno;
@@ -619,6 +638,8 @@ int pld_ipci_get_soc_info(struct device *dev, struct pld_soc_info *info)
 	strlcpy(info->fw_build_id, icnss_info.fw_build_id,
 		sizeof(info->fw_build_id));
 
+	pld_ipci_populate_hw_cap_info(&icnss_info, info);
+
 	return 0;
 }