mmc: host: Add device_prepare pm for mmc_host
mmc_host is a virtual device and it doesn't have any pm ops and so during pm registration of device, no_pm_callback gets set as true. The mmc_host device is not runtime enabled as it is a virtual device and mmc_host is the parent device of mmc_card. As the mmc_host is runtime disabled, mmc_card can runtime suspend/resume without depending on state of mmc_host during normal operations. During system suspend, the direct_complete flag of mmc_host device gets set as it has no pm_ops. When mmc_card successfully suspends, it clears the direct_complete flag of its parent (mmc_host). But in certain cases during dpm_suspend, an async error can occur after suspend work for mmc_card is scheduled and before it gets executed. In that case, mmc_card suspend work will not clear the direct_complete flag of mmc_host. When mmc_host suspend comes after that of mmc_card, it too will skip all actions. But by this time, the mmc_host device has been added to device_suspended list. So during resume, mmc_host resume will do dpm resume of mmc_host. In dpm_resume, all devices which has direct_complete flag set will be runtime_enabled. This is because, in dpm_suspend, any device with direct_complete flag will be runtime_disabled. Thus, mmc_host which has direct_complete flag set, will get runtime enabled during dpm_resume. This is a problem in pm framework with direct_complete flag (runtime enabling a device in resume when it was not runtime disabled in suspend path). Now that mmc_host device is runtime enabled, to runtime resume the mmc_card, the pm framework will try to runtime resume the mmc_host device as well and will fail. This prevents mmc_card from runtime resuming after a runtime_suspend. Fix this by adding a dummy suspend_prepare() fn for mmc_host. This prevents the direct_complete flag of mmc_host device from getting set. Change-Id: Ib739399027958d17e418e0240684b0b517a02941 Signed-off-by:Vijay Viswanath <vviswana@codeaurora.org> Signed-off-by:
Ram Prakash Gupta <rampraka@codeaurora.org>
Loading
Please register or sign in to comment