Re: [PATCHv2 00/15] Get MUSB PM runtime working again

Alan Stern
2016-05-18T18:45:37Z

On Wed, 18 May 2016, Tony Lindgren wrote:

> * Bin Liu <b-liu-l0cyMroinI0@public.gmane.org> [160518 10:37]:
> > I think I found the problem. Before having the offending patch,
> > musb_gadget_pullup() got called by musb_gadget_start(), then pm_suspend
> > immediately (~2us) happens, and musb_save_context() backs up DEVCTL register
> > which has session bit set.
> >
> > But with the offending patch, pm_suspend happends much later (~200ms)
> > after musb_gadget_pullup() is called, so by this time when
> > musb_save_context() is called, session bit is already cleared by the
> > controller, so the backup of DEVCTL register does not have session bit
> > set. Later when pm_resume, musb_restore_context() cleared the seesion
> > bit.
>
> OK sounds like that's expected as that's the current autosuspend
> timeout. See for example e6244deed843 ("i2c: omap: Fix PM regression
> with deferred probe for pm_runtime_reinit") for references why
> pm_runtime_put_sync_suspend() needs to be used if autosuspend has
> been set.
>
> So you doing pm_runtime_put_sync_suspend() probably fixes your
> issue. (Sorry I think I mentioned just pm_runtime_put_sync()
> earlier..)

Actually it may be the other way around.
pm_runtime_put_sync_suspend() will do an immediate suspend regardless
of the autosuspend timer, whereas pm_runtime_put_sync() will not
suspend the device until the autosuspend timer expires.

Alan Stern