diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h index 62f57cd3989d..a75b6322d1f3 100644 --- a/core/pld/inc/pld_common.h +++ b/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, diff --git a/core/pld/src/pld_common.c b/core/pld/src/pld_common.c index 4a6292808e16..0540755079bb 100644 --- a/core/pld/src/pld_common.c +++ b/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 diff --git a/core/pld/src/pld_pcie.h b/core/pld/src/pld_pcie.h index 970f0a16aa3a..d6ce4dc7d49a 100644 --- a/core/pld/src/pld_pcie.h +++ b/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);