Re: [PATCHv4 2/3] MMC: OMAP: HSMMC: add runtime pm support

S, Venkatraman
2011-07-13T15:34:14Z

On Wed, Jul 13, 2011 at 8:29 PM, Kevin Hilman <khilman@ti.com> wrote:
> "Dong, Chuanxiao" <chuanxiao.dong@intel.com> writes:
>
> [...]
>
>>>
>>> Basially, the question is: can the driver be reworked such that a system
>>> suspend does not need to runtime resume the device?  For most devices,
>>> we kind of expect that if the device is runtime suspended, a system
>>> suspend will have nothing extra to do, but this driver runtime resumes
>>> the device during system suspend in order to do "stuff", which I
>>> admitedly don't fully undestand.
>>>
>>> Ideally, the "stuff" needed for runtime suspend and system suspend could
>>> be made to be common such that a system suspend of a runtime suspended
>>> device would be a noop.
>>>
>>> Is this possible?
>>>
>>> Kevin
>>
>> During system suspended patch, a callback named .prepare will be first
>> done before .suspend is called, and .complete callback will be called
>> after .resume is called. These two callbacks are in pair. If driver
>> can implement the .prepare and hold the usage count in this callback,
>> then runtime pm suspend/resume will not happen during device
>> suspending. So there will be no need to add pm_runtime_get* and
>> pm_runtime_put* in .suspend/.resume.
>
> That doesn't avoid the problem, since the device is still runtime
> resumed and then re-suspended during system suspend.
>
> My basic question is this: why does this device need to be runtime
> resumed during system suspend?  Why can't it just stay runtime
> suspended?
>

From my understanding, the runtime suspend is usually implemented to not
lose the card 'context', i.e. transactions can continue after a
runtime suspend /
resume cycle.

For system suspend, the MMC core sends a sleep command (which, in itself,
is a transaction) to the card to go to sleep state, and for all
practical purposes,
the card is treated as 'removed'. When the system resumes, the card is rescanned
and re-initialized.

Hence, for system suspend, the MMC controller needs to be enabled to actually
send the command which puts the card to sleep (and hence the resume).

Best regards,
Venkat.