On Thu, 4 Jun 2020 at 14:17, Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> wrote: > > Hi again, > > > From: Yoshihiro Shimoda, Sent: Tuesday, May 19, 2020 8:33 PM > > > > The commit 432356793415 ("mmc: core: Enable power_off_notify for > > eMMC shutdown sequence") enabled the power off notification > > even if MMC_CAP2_POWEROFF_NOTIFY (MMC_CAP2_FULL_PWR_CYCLE now) is > > not set. However, the mmc core lacks to issue the power off > > notificaiton when Suspend-to-{RAM,Disk} happens on the system. > > > > So, add Suspend-to-RAM support at first because this is easy to > > check by using pm_suspend_target_state condition on _mmc_suspend(). > > > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> > > I'd like to add more detail why this patch is needed. > I think we should think some events (which are Shutdown, Suspend-to-idle, > Suspend-to-RAM) for the Power off Notification control. > I described these events like below. > > Assumption of the host : MMC_CAP2_FULL_PWR_CYCLE=false > Assumption of the eMMC : in POWERED_ON > > 1) Event : Shutdown > - power : going to VCC=OFF & VCCQ=OFF > - ideal : Either POWER_OFF_LONG or POWER_OFF_SHORT > - current : POWER_OFF_LONG --> Perfect > - Remarks : the commit 432356793415 > > 2) Event : Suspend-to-Idle > - power : Keep VCC=ON & VCCQ=ON > - ideal : issue MMC_SLEEP_AWAKE and keep the power (because the host could not change VCC=OFF) > - current : issue MMC_SLEEP_AWAKE and keep the power --> Perfect > - Remarks : IIUC, even if the eMMC is in POWERED_ON, a host can issue CMD5 (sleep). As a matter of fact, VCCQ *must* remain on in sleep state, while VCC can be powered off. > > 3) Event : Suspend-to-RAM > - power : going to VCC=OFF & VCCQ=OFF I don't understand why you think S2R should be treated differently from S2I? At least from the MMC subsystem point of view, there is no difference. No? > - ideal : Either POWER_OFF_LONG or POWER_OFF_SHORT (because the same as the "Shutdown" event) > - current : issue MMC_SLEEP_AWAKE --> NG > - Remarks : So, I tried to fix this by the patch. > > In addition, we should also think about the event of unbind. Yes, very good point. > > 4) Event : Unbind > - power : Keep VCC=ON & VCCQ=ON > - ideal : NO_POWER_NOTIFICATION because user is possible to turn the power off > - current : Keep POWERED_ON --> NG > - Remarks : But, I didn't try to fix this yet. I don't quite understand why we should keep VCC and VCCQ on? In principle I think we should treat "unbind" in the similar way as we treat S2R/S2I. Which means sending power-off-notification if the host supports MMC_CAP2_FULL_PWR_CYCLE, otherwise we should send sleep. Kind regards Uffe