Prechádzať zdrojové kódy

qcacld-3.0: Add PLD API to check direct_link support

Add PLD API to check whether direct_link is supported
by FW or not. Call platform driver API to get direct_link
support from FW capability.

Change-Id: Iac16427a853a3548dd49ece7a2839792e7c87e84
CRs-Fixed: 3335266
Naman Padhiar 2 rokov pred
rodič
commit
c5fe12891f

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

@@ -825,6 +825,16 @@ int pld_auto_suspend(struct device *dev);
 int pld_auto_resume(struct device *dev);
 int pld_force_wake_request(struct device *dev);
 
+/**
+ * pld_is_direct_link_supported() - Get whether direct_link is supported
+ *                                  by FW or not
+ * @dev: device
+ *
+ * Return: true if supported
+ *         false on failure or if not supported
+ */
+bool pld_is_direct_link_supported(struct device *dev);
+
 /**
  * pld_force_wake_request_sync() - Request to awake MHI synchronously
  * @dev: device

+ 29 - 0
core/pld/src/pld_common.c

@@ -1111,6 +1111,35 @@ int pld_request_bus_bandwidth(struct device *dev, int bandwidth)
 	return ret;
 }
 
+/**
+ * pld_is_direct_link_supported() - Get whether direct_link is supported
+ *                                  by FW or not
+ * @dev: device
+ *
+ * Return: true if supported
+ *         false on failure or if not supported
+ */
+bool pld_is_direct_link_supported(struct device *dev)
+{
+	bool ret = false;
+
+	switch (pld_get_bus_type(dev)) {
+	case PLD_BUS_TYPE_PCIE:
+		ret = pld_pcie_is_direct_link_supported(dev);
+		break;
+	case PLD_BUS_TYPE_PCIE_FW_SIM:
+	case PLD_BUS_TYPE_IPCI_FW_SIM:
+	case PLD_BUS_TYPE_SNOC_FW_SIM:
+	case PLD_BUS_TYPE_SNOC:
+	case PLD_BUS_TYPE_IPCI:
+	case PLD_BUS_TYPE_SDIO:
+	default:
+		break;
+	}
+
+	return ret;
+}
+
 /**
  * pld_get_platform_cap() - Get platform capabilities
  * @dev: device

+ 17 - 0
core/pld/src/pld_pcie.h

@@ -433,6 +433,11 @@ static inline bool pld_pcie_platform_driver_support(void)
 {
 	return false;
 }
+
+static inline bool pld_pcie_is_direct_link_supported(struct device *dev)
+{
+	return false;
+}
 #else
 int pld_pcie_get_fw_files_for_target(struct device *dev,
 				     struct pld_fw_files *pfw_files,
@@ -735,5 +740,17 @@ static inline bool pld_pcie_platform_driver_support(void)
 {
 	return true;
 }
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0))
+static inline bool pld_pcie_is_direct_link_supported(struct device *dev)
+{
+	return cnss_get_fw_cap(dev, CNSS_FW_CAP_DIRECT_LINK_SUPPORT);
+}
+#else
+static inline bool pld_pcie_is_direct_link_supported(struct device *dev)
+{
+	return false;
+}
+#endif
 #endif
 #endif