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 <quic_sumk@quicinc.com>
This commit is contained in:
Sumit Kumar 2024-11-07 11:31:17 +05:30 • committed by Sai Chaitanya Kaveti
commit b0eaa6a4e4

View file

@ -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);
}