public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-mmc@vger.kernel.org
Cc: Piotr Sroka <piotrs@cadence.com>, Hu Ziji <huziji@marvell.com>,
	Christian Daudt <csd@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Zhangfei Gao <zhangfei.gao@marvell.com>,
	Kevin Hao <haokexin@gmail.com>, Olof Johansson <olof@lixom.net>,
	Al Cooper <alcooperx@gmail.com>,
	linux-kernel@vger.kernel.org,
	Brian Norris <computersforpeace@gmail.com>,
	bcm-kernel-feedback-list@broadcom.com,
	Barry Song <baohua@kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Gregory Fong <gregory.0xf0@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: [PATCH v4 3/4] mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
Date: Mon, 28 Aug 2017 13:34:09 +0300	[thread overview]
Message-ID: <a91d1893-997b-e132-3c5b-03adb81aaa6c@intel.com> (raw)
In-Reply-To: <1503461703-16225-4-git-send-email-yamada.masahiro@socionext.com>

On 23/08/17 07:15, Masahiro Yamada wrote:
> This commit provides similar cleanups as commit 83eacdfa2529 ("mmc:
> sdhci: disable the clock in sdhci_pltfm_unregister()") did for
> unregister hooks.
> 
> sdhci-brcmstb.c and sdhci-sirf.c implement their own suspend/resume
> hooks to handle pltfm_host->clk.  Move clock handling to sdhci_pltfm.c
> so that the drivers can reuse sdhci_pltfm_pmops.
> 
> The following drivers did not previously touch pltfm_host->clk during
> suspend/resume, but now do:
>   - sdhci-bcm-kona.c
>   - sdhci-dove.c
>   - sdhci-iproc.c
>   - sdhci-pxav2.c
>   - sdhci-tegra.c
>   - sdhci-xenon.c
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Would have been nice to see some more Acks on this but from sdhci point of view:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> 
> Changes in v4:
>   - Disable clk when resume fails
> 
> Changes in v3: None
> Changes in v2:
>   - Fix build error reported by kbuild test robot
> 
>  drivers/mmc/host/sdhci-brcmstb.c | 37 +------------------------------------
>  drivers/mmc/host/sdhci-pltfm.c   | 22 ++++++++++++++++++++--
>  drivers/mmc/host/sdhci-sirf.c    | 39 +--------------------------------------
>  3 files changed, 22 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
> index e2f638338e8f..6d461fcdd663 100644
> --- a/drivers/mmc/host/sdhci-brcmstb.c
> +++ b/drivers/mmc/host/sdhci-brcmstb.c
> @@ -21,41 +21,6 @@
>  
>  #include "sdhci-pltfm.h"
>  
> -#ifdef CONFIG_PM_SLEEP
> -
> -static int sdhci_brcmstb_suspend(struct device *dev)
> -{
> -	struct sdhci_host *host = dev_get_drvdata(dev);
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -	int res;
> -
> -	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
> -		mmc_retune_needed(host->mmc);
> -
> -	res = sdhci_suspend_host(host);
> -	if (res)
> -		return res;
> -	clk_disable_unprepare(pltfm_host->clk);
> -	return res;
> -}
> -
> -static int sdhci_brcmstb_resume(struct device *dev)
> -{
> -	struct sdhci_host *host = dev_get_drvdata(dev);
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -	int err;
> -
> -	err = clk_prepare_enable(pltfm_host->clk);
> -	if (err)
> -		return err;
> -	return sdhci_resume_host(host);
> -}
> -
> -#endif /* CONFIG_PM_SLEEP */
> -
> -static SIMPLE_DEV_PM_OPS(sdhci_brcmstb_pmops, sdhci_brcmstb_suspend,
> -			sdhci_brcmstb_resume);
> -
>  static const struct sdhci_ops sdhci_brcmstb_ops = {
>  	.set_clock = sdhci_set_clock,
>  	.set_bus_width = sdhci_set_bus_width,
> @@ -131,7 +96,7 @@ MODULE_DEVICE_TABLE(of, sdhci_brcm_of_match);
>  static struct platform_driver sdhci_brcmstb_driver = {
>  	.driver		= {
>  		.name	= "sdhci-brcmstb",
> -		.pm	= &sdhci_brcmstb_pmops,
> +		.pm	= &sdhci_pltfm_pmops,
>  		.of_match_table = of_match_ptr(sdhci_brcm_of_match),
>  	},
>  	.probe		= sdhci_brcmstb_probe,
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index e090d8c42ddb..4c0135e184e9 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -212,18 +212,36 @@ EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
>  static int sdhci_pltfm_suspend(struct device *dev)
>  {
>  	struct sdhci_host *host = dev_get_drvdata(dev);
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	int ret;
>  
>  	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
>  		mmc_retune_needed(host->mmc);
>  
> -	return sdhci_suspend_host(host);
> +	ret = sdhci_suspend_host(host);
> +	if (ret)
> +		return ret;
> +
> +	clk_disable_unprepare(pltfm_host->clk);
> +
> +	return 0;
>  }
>  
>  static int sdhci_pltfm_resume(struct device *dev)
>  {
>  	struct sdhci_host *host = dev_get_drvdata(dev);
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	int ret;
> +
> +	ret = clk_prepare_enable(pltfm_host->clk);
> +	if (ret)
> +		return ret;
>  
> -	return sdhci_resume_host(host);
> +	ret = sdhci_resume_host(host);
> +	if (ret)
> +		clk_disable_unprepare(pltfm_host->clk);
> +
> +	return ret;
>  }
>  #endif
>  
> diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
> index c251c6c0a112..0c7aa89df4e2 100644
> --- a/drivers/mmc/host/sdhci-sirf.c
> +++ b/drivers/mmc/host/sdhci-sirf.c
> @@ -230,43 +230,6 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
> -static int sdhci_sirf_suspend(struct device *dev)
> -{
> -	struct sdhci_host *host = dev_get_drvdata(dev);
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -	int ret;
> -
> -	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
> -		mmc_retune_needed(host->mmc);
> -
> -	ret = sdhci_suspend_host(host);
> -	if (ret)
> -		return ret;
> -
> -	clk_disable(pltfm_host->clk);
> -
> -	return 0;
> -}
> -
> -static int sdhci_sirf_resume(struct device *dev)
> -{
> -	struct sdhci_host *host = dev_get_drvdata(dev);
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -	int ret;
> -
> -	ret = clk_enable(pltfm_host->clk);
> -	if (ret) {
> -		dev_dbg(dev, "Resume: Error enabling clock\n");
> -		return ret;
> -	}
> -
> -	return sdhci_resume_host(host);
> -}
> -#endif
> -
> -static SIMPLE_DEV_PM_OPS(sdhci_sirf_pm_ops, sdhci_sirf_suspend, sdhci_sirf_resume);
> -
>  static const struct of_device_id sdhci_sirf_of_match[] = {
>  	{ .compatible = "sirf,prima2-sdhc" },
>  	{ }
> @@ -277,7 +240,7 @@ static struct platform_driver sdhci_sirf_driver = {
>  	.driver		= {
>  		.name	= "sdhci-sirf",
>  		.of_match_table = sdhci_sirf_of_match,
> -		.pm	= &sdhci_sirf_pm_ops,
> +		.pm	= &sdhci_pltfm_pmops,
>  	},
>  	.probe		= sdhci_sirf_probe,
>  	.remove		= sdhci_pltfm_unregister,
> 


  reply	other threads:[~2017-08-28 10:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23  4:14 [PATCH v4 0/4] mmc: sdhci: refactor PM in sdhci-pltfm add support PM for cadence port Masahiro Yamada
2017-08-23  4:15 ` [PATCH v4 1/4] mmc: sdhci-cadence: add suspend / resume support Masahiro Yamada
2017-08-28 10:11   ` Adrian Hunter
2017-08-23  4:15 ` [PATCH v4 2/4] mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister() Masahiro Yamada
2017-08-23  4:15 ` [PATCH v4 3/4] mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume Masahiro Yamada
2017-08-28 10:34   ` Adrian Hunter [this message]
2017-08-28 15:35     ` Alan Cooper
2017-08-23  4:15 ` [PATCH v4 4/4] mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume Masahiro Yamada
2017-08-28 10:36   ` Adrian Hunter
2017-08-30 13:13 ` [PATCH v4 0/4] mmc: sdhci: refactor PM in sdhci-pltfm add support PM for cadence port Ulf Hansson

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=a91d1893-997b-e132-3c5b-03adb81aaa6c@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=alcooperx@gmail.com \
    --cc=baohua@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=computersforpeace@gmail.com \
    --cc=csd@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregory.0xf0@gmail.com \
    --cc=haokexin@gmail.com \
    --cc=huziji@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=piotrs@cadence.com \
    --cc=sbranden@broadcom.com \
    --cc=ulf.hansson@linaro.org \
    --cc=yamada.masahiro@socionext.com \
    --cc=zhangfei.gao@marvell.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