public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: Madhusudhan <madhu.cr@ti.com>
Cc: linux-omap@vger.kernel.org, 'Paul Walmsley' <paul@pwsan.com>
Subject: Re: [PATCH/RFC 4/4] OMAP2/3 MMC: initial conversion to runtime PM
Date: Tue, 23 Feb 2010 15:14:30 -0800	[thread overview]
Message-ID: <87635nwnmx.fsf@deeprootsystems.com> (raw)
In-Reply-To: <004501caaf57$480e1b20$544ff780@am.dhcp.ti.com> (Madhusudhan's message of "Tue\, 16 Feb 2010 16\:27\:53 -0600")

"Madhusudhan" <madhu.cr@ti.com> writes:

> <snip>
>
>>  err_irq:
>>  	mmc_host_disable(host->mmc);
>> -	clk_disable(host->iclk);
>> +	pm_runtime_suspend(host->dev);
>
> Why not pm_runtime_put_sync() here? It can replace the calls:
> mmc_host_disable(host->mmc);
> clk_disable(host->iclk);

Not knowing a ton about this driver, I'd rather keep the
mmc_host_disable() since it matches the mmc_host_enable() earlier.

>>  	clk_put(host->fclk);
>>  	clk_put(host->iclk);
>> +
>>  	if (host->got_dbclk) {
>>  		clk_disable(host->dbclk);
>>  		clk_put(host->dbclk);
>> @@ -2216,7 +2164,8 @@ static int omap_hsmmc_remove(struct platform_device
>> *pdev)
>>  		flush_scheduled_work();
>> 
>>  		mmc_host_disable(host->mmc);
>> -		clk_disable(host->iclk);
>> +		pm_runtime_suspend(host->dev);
>> +
>
> Ditto
>
>
>>  		clk_put(host->fclk);
>>  		clk_put(host->iclk);
>>  		if (host->got_dbclk) {
>> @@ -2272,7 +2221,7 @@ static int omap_hsmmc_suspend(struct device *dev)
>>  			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 {
>> @@ -2287,6 +2236,11 @@ static int omap_hsmmc_suspend(struct device *dev)
>>  			mmc_host_disable(host->mmc);
>>  		}
>> 
>> +		/*
>> +		 * HACK: "extra" put to compensate for DPM core keeping
>> +		 *       runtime PM disabled.  -- khilman
>> +		 */
>> +		pm_runtime_put_sync(host->dev);
>>  	}
>>  	return ret;
>>  }
>> @@ -2302,12 +2256,14 @@ static int omap_hsmmc_resume(struct device *dev)
>>  		return 0;
>> 
>>  	if (host) {
>> -		ret = clk_enable(host->iclk);
>> -		if (ret)
>> -			goto clk_en_err;
>> +		/*
>> +		 * HACK: "extra" get to compensate for DPM core keeping
>> +		 *       runtime PM disabled.  -- khilman
>> +		 */
>> +		pm_runtime_get_sync(host->dev);
>> 
>>  		if (mmc_host_enable(host->mmc) != 0) {
>> -			clk_disable(host->iclk);
>> +			pm_runtime_suspend(host->dev);
>>  			goto clk_en_err;
>>  		}
>> 
>> @@ -2346,9 +2302,37 @@ clk_en_err:
>>  #define omap_hsmmc_resume		NULL
>>  #endif
>> 
>> +/* called just before device is disabled */
>> +static int omap_hsmmc_runtime_suspend(struct device *dev)
>> +{
>> +	struct omap_hsmmc_host *host;
>> +
>> +	dev_dbg(dev, "%s\n", __func__);
>> +
>> +	host = platform_get_drvdata(to_platform_device(dev));
>> +	omap_hsmmc_context_save(host);
>
> The context_save fn is now empty. How does it help here?

It doesn't add anything, but I put it there to show that this is the
only place that context save would be needed, and as an example to other
drivers.

Kevin

>> +
>> +	return 0;
>> +}
>> +
>> +/* called after device is (re)enabled, ONLY if context was lost */
>> +static int omap_hsmmc_runtime_resume(struct device *dev)
>> +{
>> +	struct omap_hsmmc_host *host;
>> +
>> +	dev_dbg(dev, "%s\n", __func__);
>> +
>> +	host = platform_get_drvdata(to_platform_device(dev));
>> +	omap_hsmmc_context_restore(host);
>> +
>> +	return 0;
>> +}
>> +
>>  static struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
>>  	.suspend	= omap_hsmmc_suspend,
>>  	.resume		= omap_hsmmc_resume,
>> +	.runtime_suspend = omap_hsmmc_runtime_suspend,
>> +	.runtime_resume = omap_hsmmc_runtime_resume,
>>  };
>> 
>>  static struct platform_driver omap_hsmmc_driver = {
>> --
>> 1.6.6
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-02-23 23:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-04  0:51 [PATCH/RFC 0/4] convert HS-MMC driver to hwmod + runtime PM Kevin Hilman
2010-02-04  0:51 ` [PATCH/RFC 1/4] MMC: OMAP HS-MMC: convert to dev_pm_ops Kevin Hilman
2010-02-04  0:51 ` [PATCH/RFC 2/4] OMAP3EVM: MMC: enable power-saving mode Kevin Hilman
2010-02-04  0:51 ` [PATCH/RFC 3/4] OMAP: MMC (core): split device registration by OMAP Kevin Hilman
2010-02-04  0:51 ` [PATCH/RFC 4/4] OMAP2/3 MMC: initial conversion to runtime PM Kevin Hilman
2010-02-05  8:12   ` Adrian Hunter
2010-02-16 22:50     ` Kevin Hilman
2010-02-16 22:27   ` Madhusudhan
2010-02-23 23:14     ` Kevin Hilman [this message]
2010-02-04 22:51 ` [PATCH/RFC 0/4] convert HS-MMC driver to hwmod + " Kevin Hilman
2010-02-24  0:51 ` Kevin Hilman
2010-02-24 16:33   ` Madhusudhan
2010-02-25  0:23     ` Kevin Hilman
2010-02-25  8:22       ` Adrian Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87635nwnmx.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=madhu.cr@ti.com \
    --cc=paul@pwsan.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox