Re: [PATCH 1/2] bus: mhi: host: Add mhi_pm_suspend_force() API

From: Manivannan Sadhasivam

Date: Wed Dec 02 2026 - 08:19:59 EST


On 2026-12-02 11:15 +0100, Loic Poulain wrote:
> On Wed, Dec 2, 2026 at 9:44 AM Manivannan Sadhasivam via B4 Relay
> <devnull+manivannan.sadhasivam.oss.qualcomm.com@xxxxxxxxxx> wrote:
> >
> > From: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
> >
> > Currently, mhi_pm_suspend() returns -EBUSY when suspend is not completed
> > due to device asserting WAKE or packets pending to be transferred to the
> > device. While this suspend abort works fine for runtime suspend, it is a
> > disaster for system suspend, because a single driver aborting suspend
> > aborts the entire suspend process.
> >
> > So to fix this issue, introduce a new API mhi_pm_suspend_force(), which
> > forces the MHI stack to trigger suspend instead of bailing out. It does so
> > by waiting 100ms for the pending packets to be drained and ignoring device
> > WAKE. Even if the device is wakeup capable, suspend can proceed and the
> > device can wakeup the system later.
>
> Why ignoring device wake? can we have more info on this.
>

My wording was slightly off in the above paragraph. I wrote it in such a way to
sound like the API deals with device's wakeup capability, but it is just the
wakeup count of the device enforced by the MHI host.

To your question, we should not see any driver holding dev_wake during system
suspend as all of them just do mhi_device_get_sync() to access the device and
make sure it stays in M0 and call mhi_device_put() to allow it to enter M3.
But userspace can hold the device_wake through debugfs. So if device_wake is set
during system suspend, most likely it would come from userspace vote and the MHI
stack can do nothing about it, other than forcing system suspend.

- Mani