On Wed, May 18, 2016 at 12:12:40PM -0700, Tony Lindgren wrote: > * Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> [160518 11:47]: > > On Wed, 18 May 2016, Tony Lindgren wrote: > > > > > * Bin Liu <b-liu@xxxxxx> [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. > > In this case it seems that pm_runtime_put_sync_suspend() is needed > to save the DEVCTL session bit before it automagically clears.. > Would probably be best to handle the session bit separately and > not rely on save/restore for setting it. Yeah, that is what I am thinking for the fix - conditionally restore session bit. I am on something else now, will back on this issue later. Regards, -Bin. > > Regards, > > Tony -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html