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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: linux-mmc-owner@xxxxxxxxxxxxxxx
> [mailto:linux-mmc-owner@xxxxxxxxxxxxxxx] On Behalf Of Kevin Hilman
> Sent: Saturday, July 09, 2011 2:24 AM
> To: Balaji T K
> Cc: linux-omap@xxxxxxxxxxxxxxx; linux-mmc@xxxxxxxxxxxxxxx; cjb@xxxxxxxxxx;
> tony@xxxxxxxxxxx; madhu.cr@xxxxxx; b-cousson@xxxxxx; paul@xxxxxxxxx;
> kishore.kadiyala@xxxxxx
> Subject: Re: [PATCHv4 2/3] MMC: OMAP: HSMMC: add runtime pm support
> 
> Balaji T K <balajitk@xxxxxx> writes:
> 
> > add runtime pm support to HSMMC host controller
> > Use runtime pm API to enable/disable HSMMC clock
> > Use runtime autosuspend APIs to enable auto suspend delay
> >
> > Based on OMAP HSMMC runtime implementation by Kevin Hilman, Kishore
> Kadiyala
> >
> > Signed-off-by: Balaji T K <balajitk@xxxxxx>
> 
> It's not relevant for this merge window, but I'm exploring some future
> changes to our PM core code and have a question about how MMC works for
> system suspend.
> 
> 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.
BTW, if .prepare has hold the usage count, then .complete callback need to release the usage count and put device in runtime suspended mode.

Thanks
Chuanxiao

> 
> > @@ -2100,6 +2087,7 @@ static int omap_hsmmc_suspend(struct device *dev)
> >  		return 0;
> >
> >  	if (host) {
> > +		pm_runtime_get_sync(host->dev);
> >  		host->suspended = 1;
> >  		if (host->pdata->suspend) {
> >  			ret = host->pdata->suspend(&pdev->dev,
> > @@ -2114,13 +2102,11 @@ static int omap_hsmmc_suspend(struct device
> *dev)
> >  		}
> >  		cancel_work_sync(&host->mmc_carddetect_work);
> >  		ret = mmc_suspend_host(host->mmc);
> > -		mmc_host_enable(host->mmc);
> > +
> >  		if (ret == 0) {
> >  			omap_hsmmc_disable_irq(host);
> >  			OMAP_HSMMC_WRITE(host->base, HCTL,
> >  				OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
> > -			mmc_host_disable(host->mmc);
> > -			clk_disable(host->iclk);
> >  			if (host->got_dbclk)
> >  				clk_disable(host->dbclk);
> >  		} else {
> > @@ -2132,9 +2118,8 @@ static int omap_hsmmc_suspend(struct device *dev)
> >  					dev_dbg(mmc_dev(host->mmc),
> >  						"Unmask interrupt failed\n");
> >  			}
> > -			mmc_host_disable(host->mmc);
> >  		}
> > -
> > +		pm_runtime_put_sync(host->dev);
> >  	}
> >  	return ret;
> >  }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux