Jelajahi Sumber

qcacld-3.0: Add PLD API to check if ipa offload is disabled

Add PLD API to check if ipa offload is disabled or not in PLD
layer.

Change-Id: If2ef19cdc16a399cf5abfa495e01bab6da799c8d
CRs-Fixed: 3148041
Vijay Patil 3 tahun lalu
induk
melakukan
bdb2ed60ca
3 mengubah file dengan 74 tambahan dan 0 penghapusan
  1. 25 0
      core/pld/inc/pld_common.h
  2. 39 0
      core/pld/src/pld_common.c
  3. 10 0
      core/pld/src/pld_snoc.h

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

@@ -204,6 +204,16 @@ enum pld_bus_event {
 	PLD_BUS_EVENT_INVALID = 0xFFFF,
 };
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
+/**
+ * enum pld_device_config - Get PLD device config
+ * @PLD_IPA_DISABLD: IPA is disabled
+ */
+enum pld_device_config {
+	PLD_IPA_DISABLED,
+};
+#endif
+
 /**
  * struct pld_uevent_data - uevent status received from platform driver
  * @uevent: uevent type
@@ -1133,6 +1143,21 @@ const char *pld_bus_width_type_to_str(enum pld_bus_width_type level);
 int pld_get_thermal_state(struct device *dev, unsigned long *thermal_state,
 			  int mon_id);
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
+/**
+ * pld_is_ipa_offload_disabled() - Check if IPA offload is enabled or not
+ * @dev: The device structure
+ *
+ * Return: Non-zero code for IPA offload disable; zero for IPA offload enable
+ */
+int pld_is_ipa_offload_disabled(struct device *dev);
+#else
+int pld_is_ipa_offload_disabled(struct device *dev);
+{
+	return 0;
+}
+#endif
+
 #if defined(CNSS_MEM_PRE_ALLOC) && defined(FEATURE_SKB_PRE_ALLOC)
 
 /**

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

@@ -3376,6 +3376,45 @@ int pld_get_wlan_unsafe_channel_sap(
 }
 #endif
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
+/**
+ * pld_is_ipa_offload_disabled() - Check if IPA offload is disabled or not
+ *
+ * @dev: device
+ *
+ * This API will be called to check if IPA offload is disabled or not.
+ *
+ *  Return: Non-zero for IPA offload is disabled
+ *          Otherwise IPA offload is enabled
+ */
+int pld_is_ipa_offload_disabled(struct device *dev)
+{
+	unsigned long dev_cfg = 0;
+
+	enum pld_bus_type type = pld_get_bus_type(dev);
+
+	switch (type) {
+	case PLD_BUS_TYPE_SNOC:
+		dev_cfg = pld_snoc_get_device_config();
+		break;
+	case PLD_BUS_TYPE_IPCI:
+	case PLD_BUS_TYPE_PCIE:
+	case PLD_BUS_TYPE_SDIO:
+	case PLD_BUS_TYPE_USB:
+	case PLD_BUS_TYPE_SNOC_FW_SIM:
+	case PLD_BUS_TYPE_PCIE_FW_SIM:
+	case PLD_BUS_TYPE_IPCI_FW_SIM:
+		pr_err("Not supported on type %d\n", type);
+		break;
+	default:
+		pr_err("Invalid device type %d\n", type);
+		break;
+	}
+
+	return test_bit(PLD_IPA_DISABLED, &dev_cfg);
+}
+#endif
+
 #ifdef FEATURE_WLAN_TIME_SYNC_FTM
 /**
  * pld_get_audio_wlan_timestamp() - Get audio timestamp

+ 10 - 0
core/pld/src/pld_snoc.h

@@ -135,6 +135,11 @@ static inline int pld_snoc_idle_shutdown(struct device *dev)
 	return 0;
 }
 
+static inline unsigned long pld_snoc_get_device_config(void)
+{
+	return 0;
+}
+
 static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr,
 				    uint32_t *iova_addr, size_t size)
 {
@@ -404,5 +409,10 @@ static inline int pld_snoc_idle_shutdown(struct device *dev)
 {
 	return icnss_idle_shutdown(dev);
 }
+
+static inline unsigned long pld_snoc_get_device_config(void)
+{
+	return icnss_get_device_config();
+}
 #endif
 #endif