linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: BOUGH CHEN <haibo.chen@nxp.com>
To: "Hunter, Adrian" <adrian.hunter@intel.com>,
	"ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Cc: dl-linux-imx <linux-imx@nxp.com>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>
Subject: RE: [PATCH v3 12/14] mmc: sdhci-esdhc-imx: restore pin state when resume back
Date: Wed, 19 Feb 2020 07:37:48 +0000	[thread overview]
Message-ID: <VI1PR04MB504033CAD028EBE1784E997390100@VI1PR04MB5040.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <363DA0ED52042842948283D2FC38E4649C6FFB24@IRSMSX106.ger.corp.intel.com>

> -----Original Message-----
> From: Hunter, Adrian <adrian.hunter@intel.com>
> Sent: 2020年2月19日 15:29
> To: BOUGH CHEN <haibo.chen@nxp.com>; ulf.hansson@linaro.org;
> linux-mmc@vger.kernel.org
> Cc: dl-linux-imx <linux-imx@nxp.com>; linus.walleij@linaro.org
> Subject: RE: [PATCH v3 12/14] mmc: sdhci-esdhc-imx: restore pin state when
> resume back
> 
> 
> 
> > -----Original Message-----
> > From: BOUGH CHEN <haibo.chen@nxp.com>
> > Sent: Wednesday, February 19, 2020 9:16 AM
> > To: Hunter, Adrian <adrian.hunter@intel.com>; ulf.hansson@linaro.org;
> > linux-mmc@vger.kernel.org
> > Cc: dl-linux-imx <linux-imx@nxp.com>; linus.walleij@linaro.org
> > Subject: RE: [PATCH v3 12/14] mmc: sdhci-esdhc-imx: restore pin state
> > when resume back
> >
> > > -----Original Message-----
> > > From: linux-mmc-owner@vger.kernel.org
> > > <linux-mmc-owner@vger.kernel.org> On Behalf Of Adrian Hunter
> > > Sent: 2020年2月18日 15:58
> > > To: BOUGH CHEN <haibo.chen@nxp.com>; ulf.hansson@linaro.org;
> > > linux-mmc@vger.kernel.org
> > > Cc: dl-linux-imx <linux-imx@nxp.com>; linus.walleij@linaro.org
> > > Subject: Re: [PATCH v3 12/14] mmc: sdhci-esdhc-imx: restore pin
> > > state when resume back
> > >
> > > On 10/02/20 10:49 am, haibo.chen@nxp.com wrote:
> > > > From: Haibo Chen <haibo.chen@nxp.com>
> > > >
> > > > In some low power mode, SoC will lose the pin state, so need to
> > > > restore the pin state when resume back.
> > > >
> > > > Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> > > > ---
> > > >  drivers/mmc/host/sdhci-esdhc-imx.c | 12 +++++++++++-
> > > >  1 file changed, 11 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
> > > > b/drivers/mmc/host/sdhci-esdhc-imx.c
> > > > index 106097cbd0d4..dedc067cd0dd 100644
> > > > --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> > > > +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> > > > @@ -1717,7 +1717,13 @@ static int sdhci_esdhc_suspend(struct
> > > > device
> > > *dev)
> > > >  	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)
> > > > +		if (pinctrl_pm_select_sleep_state(dev))
> > > > +			dev_warn(mmc_dev(host->mmc),
> > > > +			 "%s, failed to select sleep pin state!\n", __func__);
> > >
> > > It looks to me like pinctrl_pm_select_sleep_state() prints an error
> > > anyway if it fails, so the warning here is redundant.
> >
> > Okay, thanks for point out that!
> >
> > >
> > > Also a comment about why it is OK to ignore an error could be added.
> >
> > Yes, I will add a comment like below, should it be okay?
> 
> I meant why it is ok to ignore the pinctrl error

Okay, I know your point. 
So I think this patch can change like below:

index 786305309eb0..b38b9d7f0a0d 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1731,7 +1731,11 @@ static int sdhci_esdhc_suspend(struct device *dev)
        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 pinctrl_pm_select_sleep_state(dev);
+
+       return ret;
 }

 static int sdhci_esdhc_resume(struct device *dev)
@@ -1739,6 +1743,10 @@ static int sdhci_esdhc_resume(struct device *dev)
        struct sdhci_host *host = dev_get_drvdata(dev);
        int ret;

+       ret = pinctrl_pm_select_default_state(dev);
+       if (ret)
+               return ret;
+
        /* re-initialize hw state in case it's lost in low power mode */
        sdhci_esdhc_imx_hwinit(host);

> 
> >
> > /*
> >  * here ignore the error return, because current API
> > sdhci_suspend_host always return zero,
> >  * When the API sdhci_suspend_host change the return policy, need to
> > change at here too.
> >  */
> >
> > Best Regards
> > Bough chen
> > >
> > > > +
> > > > +	return ret;
> > > >  }
> > > >
> > > >  static int sdhci_esdhc_resume(struct device *dev) @@ -1725,6
> > > > +1731,10 @@ static int sdhci_esdhc_resume(struct device *dev)
> > > >  	struct sdhci_host *host = dev_get_drvdata(dev);
> > > >  	int ret;
> > > >
> > > > +	if (pinctrl_pm_select_default_state(dev))
> > > > +		dev_warn(mmc_dev(host->mmc),
> > > > +		 "%s, failed to select default pin state!\n", __func__);
> > >
> > > Same as above
> > >
> > > > +
> > > >  	/* re-initialize hw state in case it's lost in low power mode */
> > > >  	sdhci_esdhc_imx_hwinit(host);
> > > >
> > > >


  reply	other threads:[~2020-02-19  7:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10  8:49 [PATCH v3 06/14] mmc: sdhci-esdhc-imx: add strobe-dll-delay-target support haibo.chen
2020-02-10  8:49 ` [PATCH v3 07/14] mmc: sdhci-esdhc-imx: optimize the clock setting haibo.chen
2020-02-10  8:49 ` [PATCH v3 08/14] mmc: sdhci-esdhc-imx: optimize the strobe dll setting haibo.chen
2020-02-10  8:49 ` [PATCH v3 09/14] mmc: sdhci-esdhc-imx: add flag ESDHC_FLAG_BROKEN_AUTO_CMD23 haibo.chen
2020-02-18  7:42   ` Adrian Hunter
2020-02-10  8:49 ` [PATCH v3 10/14] mmc: sdhci-esdhc-imx: Add an new esdhc_soc_data for i.MX8MM haibo.chen
2020-02-18  7:42   ` Adrian Hunter
2020-02-10  8:49 ` [PATCH v3 11/14] mmc: sdhci-esdhc-imx: clear pending interrupt and halt cqhci haibo.chen
2020-02-18  7:47   ` Adrian Hunter
2020-02-10  8:49 ` [PATCH v3 12/14] mmc: sdhci-esdhc-imx: restore pin state when resume back haibo.chen
2020-02-18  7:58   ` Adrian Hunter
2020-02-19  7:16     ` BOUGH CHEN
2020-02-19  7:29       ` Hunter, Adrian
2020-02-19  7:37         ` BOUGH CHEN [this message]
2020-02-10  8:49 ` [PATCH v3 13/14] mmc: sdhci-esdhc-imx: clear DMA_SEL when disable DMA mode haibo.chen
2020-02-18  8:00   ` Adrian Hunter
2020-02-10  8:49 ` [PATCH v3 14/14] mmc: queue: create dev->dma_parms before call dma_set_max_seg_size() haibo.chen
2020-02-18  8:15   ` Adrian Hunter
2020-02-19  7:20     ` BOUGH CHEN

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=VI1PR04MB504033CAD028EBE1784E997390100@VI1PR04MB5040.eurprd04.prod.outlook.com \
    --to=haibo.chen@nxp.com \
    --cc=adrian.hunter@intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).