Jelajahi Sumber

qcacld-3.0: Use sync method to awake device

Use sync wake when trying to awake device for register
accessing.
This can avoid device re-enter low power mode after
device_wake asserted.

Change-Id: I9ce421be0ecdf05a26388732cc8e15154c57a47a
CRs-Fixed: 2703608
Lin Bai 4 tahun lalu
induk
melakukan
299a322de1
3 mengubah file dengan 48 tambahan dan 0 penghapusan
  1. 10 0
      core/pld/inc/pld_common.h
  2. 26 0
      core/pld/src/pld_common.c
  3. 12 0
      core/pld/src/pld_pcie.h

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

@@ -644,6 +644,16 @@ void *pld_get_fw_ptr(struct device *dev);
 int pld_auto_suspend(struct device *dev);
 int pld_auto_resume(struct device *dev);
 int pld_force_wake_request(struct device *dev);
+
+/**
+ * pld_force_wake_request_sync() - Request to awake MHI synchronously
+ * @dev: device
+ * @timeout_us: timeout in micro-sec request to wake
+ *
+ * Return: 0 for success
+ *         Non zero failure code for errors
+ */
+int pld_force_wake_request_sync(struct device *dev, int timeout_us);
 int pld_is_device_awake(struct device *dev);
 int pld_force_wake_release(struct device *dev);
 int pld_ce_request_irq(struct device *dev, unsigned int ce_id,

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

@@ -1175,6 +1175,32 @@ int pld_force_wake_request(struct device *dev)
 	return ret;
 }
 
+int pld_force_wake_request_sync(struct device *dev, int timeout_us)
+{
+	int ret = 0;
+	enum pld_bus_type type = pld_get_bus_type(dev);
+
+	switch (type) {
+	case PLD_BUS_TYPE_PCIE:
+		ret = pld_pcie_force_wake_request_sync(dev, timeout_us);
+		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_SDIO:
+	case PLD_BUS_TYPE_USB:
+	case PLD_BUS_TYPE_IPCI:
+		break;
+	default:
+		pr_err("Invalid device type %d\n", type);
+		ret = -EINVAL;
+		break;
+	}
+
+	return ret;
+}
+
 /**
  * pld_is_device_awake() - Check if it's ready to access MMIO registers
  * @dev: device

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

@@ -274,6 +274,12 @@ static inline int pld_pcie_force_wake_request(struct device *dev)
 	return 0;
 }
 
+static inline int pld_pcie_force_wake_request_sync(struct device *dev,
+						   int timeout_us)
+{
+	return 0;
+}
+
 static inline int pld_pcie_is_device_awake(struct device *dev)
 {
 	return true;
@@ -512,6 +518,12 @@ static inline int pld_pcie_force_wake_request(struct device *dev)
 	return cnss_pci_force_wake_request(dev);
 }
 
+static inline int pld_pcie_force_wake_request_sync(struct device *dev,
+						   int timeout_us)
+{
+	return cnss_pci_force_wake_request_sync(dev, timeout_us);
+}
+
 static inline int pld_pcie_is_device_awake(struct device *dev)
 {
 	return cnss_pci_is_device_awake(dev);