From b0eaa6a4e4bb039700dd752bf8779121601dda80 Mon Sep 17 00:00:00 2001 From: Sumit Kumar Date: Thu, 7 Nov 2024 11:31:17 +0530 Subject: [PATCH] msm: ep_pcie: Wake host in D3cold handling if wake is pending In below sequence where device requested for inband pme but host still proceed with #PERST assertion the ep_pcie_core_wakeup_host_internal is called to toggle wake gpio. Event Sequence: - Received a wakeup_host event in D3hot. - wakeup host internal api called -> inband pme issued - host_wake_pending set to 1 - host is in process of issuing a perst assert before the inband pme is processed - disable endpoint is called -> checks for host wake pending and and calls ep_pcie_core_wakeup_host_internal. - ep_pcie_core_wakeup_host_internal will return without doing a wakeup because of host wake pending check in it. Set the host_wake_pending flag to 0 before calling to make sure ep_pcie_core_wakeup_host_internal is executed to toggle WAKE. Change-Id: I533b7ee58ea941d9a865fc560677aa9a8daa431c Signed-off-by: Sumit Kumar --- drivers/platform/msm/ep_pcie/ep_pcie_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/platform/msm/ep_pcie/ep_pcie_core.c b/drivers/platform/msm/ep_pcie/ep_pcie_core.c index c8e23ac53d2f..cef10b457073 100644 --- a/drivers/platform/msm/ep_pcie/ep_pcie_core.c +++ b/drivers/platform/msm/ep_pcie/ep_pcie_core.c @@ -2179,6 +2179,11 @@ int ep_pcie_core_disable_endpoint(void) if (atomic_read(&dev->host_wake_pending)) { EP_PCIE_DBG(dev, "PCIe V%d: wake pending, init wakeup\n", dev->rev); + /* + * Clear the wake pending otherwise ep_pcie_core_wakeup_host_internal + * will return without WAKE toggle + */ + atomic_set(&dev->host_wake_pending, 0); ep_pcie_core_wakeup_host_internal(EP_PCIE_EVENT_PM_D3_COLD); }