For some MHI devices in some specific scenarios, the default value of autosuspend_delay_ms may not be enough to handle the last wake event, potentially leading to device timeout or link drop issues. This can lead to a runtime resume failure and a subsequent system error: [ 8749.089545] mhi mhi0: Resuming from non M3 state (SYS ERROR) [ 8749.089573] mhi-pci-generic 0000:73:00.0: failed to resume device: -22 [ 8749.090218] mhi-pci-generic 0000:73:00.0: device recovery started ... [ 8752.940324] mhi-pci-generic 0000:73:00.0: reset failed Following Qualcomm's recommended settings from Windows and their suggestion during case discussions, update the default autosuspend delay to 5000ms for MHI devices. Fixes: d3800c1dce24 ("bus: mhi: pci_generic: Add support for runtime PM") Cc: stable@vger.kernel.org Signed-off-by: Slark Xiao --- v3: update the commit message and the comment of the define v2: define a autosuspend delay timeout and explain the reason --- drivers/bus/mhi/host/pci_generic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c index 7193a384cca4..17d51964b55f 100644 --- a/drivers/bus/mhi/host/pci_generic.c +++ b/drivers/bus/mhi/host/pci_generic.c @@ -21,6 +21,9 @@ #define MHI_POST_RESET_DELAY_MS 2000 +/* Timeout to accommodate a potential 'late wake-event' issue */ +#define MHI_AUTOSUSPEND_DELAY_MS 5000 + #define HEALTH_CHECK_PERIOD (HZ * 2) /* PCI VID definitions */ @@ -1483,7 +1486,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* Allow runtime suspend only if both PME from D3Hot and M3 are supported */ if (pci_pme_capable(pdev, PCI_D3hot) && !(info->no_m3)) { - pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); + pm_runtime_set_autosuspend_delay(&pdev->dev, MHI_AUTOSUSPEND_DELAY_MS); pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); -- 2.53.0