linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@stericsson.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Lee Jones <lee.jones@linaro.org>
Subject: Re: [PATCH 12/14] mmc: mmci: Decrease current consumption in	suspend
Date: Mon, 9 Jan 2012 15:12:45 +0100	[thread overview]
Message-ID: <4F0AF5DD.8080707@stericsson.com> (raw)
In-Reply-To: <20120108103823.GB21765@n2100.arm.linux.org.uk>

Russell King - ARM Linux wrote:
> On Mon, Dec 05, 2011 at 06:35:58PM +0100, Ulf Hansson wrote:
>> To decrease current consumption in suspend state the
>> VCORE regulator, the MCLK and PCLK for the ARM PL18x
>> are now disabled.
>>
>> When resuming the resourses are re-enabled and
>> register values for MMCICLOCK, MMCIPOWER and MMCIMASK0
>> are restored.
> 
> I still do not agree with this.  The MMC core driver should be shutting
> down the interface (turning off the MMC clock, disabling the MMC power).
> And indeed it does:
> 
> int mmc_suspend_host(struct mmc_host *host)
> {
> ...
>         if (!err && !mmc_card_keep_power(host))
>                 mmc_power_off(host);
> }
> 

If mmc_power_off gets called, this will mean cutting the power to the 
card. Either through the MMCIPOWER register(ARM rimecells) or by using 
the host->vcc regulator (ST-versions). Similar actions is done for 
MMCICLOCK register, which in the end means the clock to the card gets gated.

The MCLK (host->clk), the PCLK (amba_pclk) and the regulator 
(amba_vcore) is not disabled. This should only be handled during probe, 
suspend/resume and remove I believe.

> void mmc_power_off(struct mmc_host *host)
> {
> ...
>         host->ios.power_mode = MMC_POWER_OFF;
>         host->ios.bus_width = MMC_BUS_WIDTH_1;
>         host->ios.timing = MMC_TIMING_LEGACY;
>         mmc_set_ios(host);
> ...
> }
> 
> On ARM primecells we can _not_ go from power off to power on without
> first going through the power up state, so this simple save-and-restore
> will not do - we have to go through the proper power up sequence.

This will be handled when doing mmc_resume_host so there should be no 
problems for ARM Primecells. It might be the naming of these functions 
that kind of confuses you at this state. For runtime PM, these names 
(mmci_save and mmci_restore) make more sence. :-) Right now they are 
kind of only used for "enable"/"disable" clocks and regulators.

I can change the patch to only do the enable/disable part if you like 
that better at this stage. But since the earlier version of suspend 
function reset the MMCIMASK0 to zero, I thought reseting the other 
registers as well would be okay at this stage.

If you review the patch "mmci: Implement PM runtime callbacks to save 
power" together with this one, it should hopefully bring you more 
clarity how I have thought around this hole thing.

> 
> Why do you think that the MMC core is not shutting down the power and
> clock registers on suspend?
> 

Br
Ulf Hansson

  reply	other threads:[~2012-01-09 14:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05 17:35 [PATCH 00/14] mmc: mmci: Improved PM support, cleanup and bugfixes Ulf Hansson
2011-12-05 17:35 ` [PATCH 01/14] mmc: mmci: Support MMC_PM_KEEP_POWER Ulf Hansson
2011-12-05 17:35 ` [PATCH 02/14] mmc: mmci: Fixup handling of MCI_STARTBITERR Ulf Hansson
2011-12-18 23:15   ` Russell King - ARM Linux
2011-12-19  8:59     ` Ulf Hansson
2011-12-05 17:35 ` [PATCH 03/14] mmc: mmci: Increase max_segs from 16 to 128 Ulf Hansson
2011-12-05 17:35 ` [PATCH 04/14] mmc: mmci: Do not release spinlock in request_end Ulf Hansson
2011-12-05 17:35 ` [PATCH 05/14] mmc: mmci: Put power register deviations in variant data Ulf Hansson
2011-12-05 17:35 ` [PATCH 06/14] mmc: mmci: Provide option to configure bus signal direction Ulf Hansson
2011-12-05 17:35 ` [PATCH 07/14] mmc: mmci: Change vdd_handler to a generic ios_handler Ulf Hansson
2011-12-05 17:35 ` [PATCH 08/14] mmc: mmci: Fixup error handling for dma Ulf Hansson
2011-12-18 23:16   ` Russell King - ARM Linux
2011-12-19  8:59     ` Ulf Hansson
2011-12-05 17:35 ` [PATCH 09/14] mmc: mmci: Change from using legacy suspend Ulf Hansson
2011-12-05 17:35 ` [PATCH 10/14] mmc: mmci: Cache MMCICLOCK and MMCIPOWER register Ulf Hansson
2012-01-08 10:25   ` Russell King - ARM Linux
2012-01-09 11:46     ` Ulf Hansson
2012-01-09 15:12     ` Ulf Hansson
2011-12-05 17:35 ` [PATCH 11/14] mmc: mmci: Fixup use of runtime PM and use autosuspend Ulf Hansson
2011-12-05 17:35 ` [PATCH 12/14] mmc: mmci: Decrease current consumption in suspend Ulf Hansson
2012-01-08 10:38   ` Russell King - ARM Linux
2012-01-09 14:12     ` Ulf Hansson [this message]
2011-12-05 17:35 ` [PATCH 13/14] mmc: mmci: Implement PM runtime callbacks to save power Ulf Hansson
2011-12-05 17:36 ` [PATCH 14/14] mmc: mmci: Use ios_handler " Ulf Hansson
2011-12-07 12:06 ` [PATCH 00/14] mmc: mmci: Improved PM support, cleanup and bugfixes Linus Walleij
2011-12-13 16:17   ` 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=4F0AF5DD.8080707@stericsson.com \
    --to=ulf.hansson@stericsson.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /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).