public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: cjb@laptop•org (Chris Ball)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 2/2] mmc: sdhci-s3c: Enable runtime power management
Date: Thu, 08 Mar 2012 23:57:16 -0500	[thread overview]
Message-ID: <m2399ipe1f.fsf@bob.laptop.org> (raw)
In-Reply-To: <1330735602-22409-2-git-send-email-broonie@opensource.wolfsonmicro.com> (Mark Brown's message of "Sat, 3 Mar 2012 00:46:42 +0000")

Hi Mark,

On Fri, Mar 02 2012, Mark Brown wrote:
> Since most of the work is already done by the core we just need to add
> runtime suspend methods and tell the PM core that runtime PM is enabled
> for this device.
>
> Signed-off-by: Mark Brown <broonie@opensource•wolfsonmicro.com>
> ---
>  drivers/mmc/host/sdhci-s3c.c |   28 ++++++++++++++++++++++++++++
>  1 files changed, 28 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 46152d6..6926ac9 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -23,6 +23,7 @@
>  #include <linux/of.h>
>  #include <linux/of_gpio.h>
>  #include <linux/pm.h>
> +#include <linux/pm_runtime.h>
>  
>  #include <linux/mmc/host.h>
>  
> @@ -721,6 +722,11 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
>  	if (pdata->host_caps2)
>  		host->mmc->caps2 |= pdata->host_caps2;
>  
> +	pm_runtime_enable(&pdev->dev);
> +	pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
> +	pm_runtime_use_autosuspend(&pdev->dev);
> +	pm_suspend_ignore_children(&pdev->dev, 1);
> +
>  	ret = sdhci_add_host(host);
>  	if (ret) {
>  		dev_err(dev, "sdhci_add_host() failed\n");
> @@ -740,6 +746,8 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
>  
>   err_add_host:
>  	release_resource(sc->ioarea);
> +	pm_runtime_forbid(&pdev->dev);
> +	pm_runtime_get_noresume(&pdev->dev);
>  	kfree(sc->ioarea);
>  
>   err_req_regs:
> @@ -784,6 +792,8 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
>  
>  	sdhci_remove_host(host, 1);
>  
> +	pm_runtime_disable(&pdev->dev);
> +
>  	for (ptr = 0; ptr < 3; ptr++) {
>  		if (sc->clk_bus[ptr]) {
>  			clk_disable(sc->clk_bus[ptr]);
> @@ -824,9 +834,27 @@ static int sdhci_s3c_resume(struct device *dev)
>  }
>  #endif
>  
> +#ifdef CONFIG_PM_RUNTIME
> +static int sdhci_s3c_runtime_suspend(struct device *dev)
> +{
> +	struct sdhci_host *host = dev_get_drvdata(dev);
> +
> +	return sdhci_runtime_suspend_host(host);
> +}
> +
> +static int sdhci_s3c_runtime_resume(struct device *dev)
> +{
> +	struct sdhci_host *host = dev_get_drvdata(dev);
> +
> +	return sdhci_runtime_resume_host(host);
> +}
> +#endif
> +
>  #ifdef CONFIG_PM
>  static const struct dev_pm_ops sdhci_s3c_pmops = {
>  	SET_SYSTEM_SLEEP_PM_OPS(sdhci_s3c_suspend, sdhci_s3c_resume)
> +	SET_RUNTIME_PM_OPS(sdhci_s3c_runtime_suspend, sdhci_s3c_runtime_resume,
> +			   NULL)
>  };
>  
>  #define SDHCI_S3C_PMOPS (&sdhci_s3c_pmops)

Thanks, pushed to mmc-next for 3.4 with Jaehoon's ACK.

- Chris.
-- 
Chris Ball   <cjb@laptop•org>   <http://printf.net/>
One Laptop Per Child

  parent reply	other threads:[~2012-03-09  4:57 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31 17:56 [PATCH v3 0/6] mmc: sdhci-s3c: Rework platform data and add device tree support Thomas Abraham
2012-01-31 17:56 ` [PATCH v3 1/6] mmc: sdhci-s3c: Remove usage of clk_type member in platform data Thomas Abraham
2012-01-31 17:56 ` [PATCH v3 2/6] arm: exynos4: use 'exynos4-sdhci' as device name for sdhci controllers Thomas Abraham
2012-01-31 17:56 ` [PATCH v3 3/6] arm: samsung: remove all uses of clk_type member in sdhci platform data Thomas Abraham
2012-01-31 17:56 ` [PATCH v3 4/6] mmc: sdhci-s3c: derive transfer width host capability from max_width in " Thomas Abraham
2012-01-31 19:12   ` Sergei Shtylyov
2012-01-31 17:56 ` [PATCH v3 5/6] mmc: sdhci-s3c: Keep a copy of platform data and use it Thomas Abraham
2012-01-31 17:56 ` [PATCH v3 6/6] mmc: sdhci-s3c: Add device tree support Thomas Abraham
2012-01-31 20:08   ` Grant Likely
2012-02-01 18:21   ` Karol Lewandowski
2012-03-27 16:15   ` Arnd Bergmann
2012-03-27 16:19   ` Arnd Bergmann
2012-03-30  6:33     ` Viresh Kumar
2012-03-30 11:36       ` Arnd Bergmann
2012-03-30 15:48         ` Stephen Warren
2012-03-30 18:45           ` Arnd Bergmann
2012-04-01 11:29             ` Mark Brown
2012-05-13  4:14           ` [PATCH v2] mmc: dt: Consolidate DT bindings Chris Ball
2012-05-13 19:29             ` Guennadi Liakhovetski
2012-05-13 19:46             ` Arnd Bergmann
2012-05-13 20:10               ` Chris Ball
2012-05-14 19:53                 ` Arnd Bergmann
2012-04-09 14:48         ` [PATCH v3 6/6] mmc: sdhci-s3c: Add device tree support Chris Ball
2012-04-10 21:37         ` Chris Ball
2012-02-09 13:42 ` [PATCH v3 0/6] mmc: sdhci-s3c: Rework platform data and add " Kukjin Kim
2012-02-11 21:37   ` Chris Ball
2012-02-16 13:04     ` Kukjin Kim
2012-02-16 13:08       ` Chris Ball
2012-02-21 11:37         ` Kukjin Kim
2012-02-21 13:17           ` Chris Ball
2012-02-22 12:58             ` Mark Brown
2012-03-02 20:40               ` Chris Ball
2012-03-03  0:44                 ` Kukjin Kim
2012-03-03  0:46                   ` [PATCH 1/2] mmc: sdhci-s3c: Use CONFIG_PM_SLEEP to ifdef system suspend Mark Brown
2012-03-03  0:46                     ` [PATCH 2/2] mmc: sdhci-s3c: Enable runtime power management Mark Brown
2012-03-05 10:48                       ` Jaehoon Chung
2012-03-05 11:52                         ` Mark Brown
2012-03-06  6:40                           ` Jaehoon Chung
2012-03-09  4:57                       ` Chris Ball [this message]
2012-03-09  5:08                       ` Chris Ball
2012-03-09 12:26                         ` Mark Brown
2012-03-05 10:24                     ` [PATCH 1/2] mmc: sdhci-s3c: Use CONFIG_PM_SLEEP to ifdef system suspend Jaehoon Chung
2012-03-09  4:56                     ` Chris Ball
2012-03-27 15:50             ` [PATCH v3 0/6] mmc: sdhci-s3c: Rework platform data and add device tree support Chris Ball
2012-03-28  9:54               ` Mark Brown
2012-03-29  3:15                 ` Kukjin Kim
2012-04-01  1:12                   ` Chris Ball
2012-04-02 19:08                     ` Kukjin Kim

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=m2399ipe1f.fsf@bob.laptop.org \
    --to=cjb@laptop$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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