Skip to contentSkip to conversation

mmc: mmci: Gate the clock in runtime suspend to save power

PATCH New Kevin Liu 3 participants 8 messages Dec 13, 2012 – Jan 7, 2013 1 message not in the archive MMC, SD and SDIO

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Kevin Liu

author
#1 lore raw

PATCH 1/1 mmc: mmci: Gate the clock in runtime suspend to save power

Quoted 24 lines

-----Original Message-----
From: linux-mmc-owner at vger.kernel.org [mailto:linux-mmc-owner at vger.kernel.org] On Behalf Of Linus Walleij
Sent: Thursday, December 13, 2012 2:54 AM
To: Ulf Hansson
Cc: Russell King - ARM Linux; Ulf Hansson; linux-mmc at vger.kernel.org; Chris Ball; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH] mmc: mmci: Gate the clock in runtime suspend to save power

Quoted 7 lines · Ulf Hansson
Quoted 4 lines · Linus Walleij

1) Turn on MMC_CLKGATE for this driver (select from Kconfig) which means that the ios will be called with f=0 whenever the card is unused, taking into account the required number of clocks to the card.

Quoted 8 lines

I think MMC_CLKGATE was a good initiative in the past. But that was before runtime pm was there to use. Runtime pm suits much better for handling clock gating and other runtime power save actions that could be possible for a host driver to do.

I would even suggest the MMC_CLKGATE should be removed from the protocol layer, once we see that all host drivers that used it has switch to runtime pm.

Quoted 9 lines

Ah now I remember that you've actually even explained this to me ... memory is too short sometimes. But I follow this idea.

Then we have only the coordination between runtime suspend and suspend proper to iron out.

Russell's concern is valid if suspend() will not wait for runtime_suspend() to complete the last cycle before suspending.

pm_runtime_get_noresume is called before suspend and there are sdhci_runtime_pm_get/sdhci_runtime_pm_put within sdhci suspend/resume function. So the actual runtime_suspend won't be called after suspend finished. So it's same as original code without pm_runtime during suspend/resume.

Quoted 3 lines

Hm this sounds scaringly familiar to what we've discussed with Kevin Hilman et al recently...

#2 lore raw

PATCH 1/1 mmc: mmci: Gate the clock in runtime suspend to save power

Quoted 24 lines · Kevin Liu
Quoted 24 lines

-----Original Message-----
From: linux-mmc-owner at vger.kernel.org [mailto:linux-mmc-owner at vger.kernel.org] On Behalf Of Linus Walleij
Sent: Thursday, December 13, 2012 2:54 AM
To: Ulf Hansson
Cc: Russell King - ARM Linux; Ulf Hansson; linux-mmc at vger.kernel.org; Chris Ball; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH] mmc: mmci: Gate the clock in runtime suspend to save power

Quoted 15 lines · Ulf Hansson
Quoted 4 lines · Linus Walleij

1) Turn on MMC_CLKGATE for this driver (select from Kconfig) which means that the ios will be called with f=0 whenever the card is unused, taking into account the required number of clocks to the card.

I think MMC_CLKGATE was a good initiative in the past. But that was before runtime pm was there to use. Runtime pm suits much better for handling clock gating and other runtime power save actions that could be possible for a host driver to do.

I would even suggest the MMC_CLKGATE should be removed from the protocol layer, once we see that all host drivers that used it has switch to runtime pm.

Quoted 8 lines
Quoted 8 lines

Ah now I remember that you've actually even explained this to me ... memory is too short sometimes. But I follow this idea.

Then we have only the coordination between runtime suspend and suspend proper to iron out.

Russell's concern is valid if suspend() will not wait for runtime_suspend() to complete the last cycle before suspending.

A valid point, thanks for pointing this out clearly Linus!

Anyway, this need to be thought of as future step, since this patch is not changing anything to that sequence as Kevin also is pointing out.

So, the next step is to figure how we can properly do similar actions as in the runtime_suspend callback but as part of the suspend sequence instead and at the same time cope with 8 clock cycles. I will push a patch for this later, so then we can discuss more about that.

Quoted 11 lines
Quoted 1 line

pm_runtime_get_noresume is called before suspend and there are sdhci_runtime_pm_get/sdhci_runtime_pm_put within sdhci suspend/resume function. So the actual runtime_suspend won't be called after suspend finished. So it's same as original code without pm_runtime during suspend/resume.

Quoted 3 lines

Hm this sounds scaringly familiar to what we've discussed with Kevin Hilman et al recently...

May I have your Acks on this patch?

Kind regards
Ulf Hansson

author
#3 lore raw

PATCH 1/1 mmc: mmci: Gate the clock in runtime suspend to save power

2012/12/13 Ulf Hansson <[email protected]>:

Quoted 52 lines · Kevin Liu
Quoted 24 lines
Quoted 24 lines

-----Original Message-----
From: linux-mmc-owner at vger.kernel.org [mailto:linux-mmc-owner at vger.kernel.org] On Behalf Of Linus Walleij
Sent: Thursday, December 13, 2012 2:54 AM
To: Ulf Hansson
Cc: Russell King - ARM Linux; Ulf Hansson; linux-mmc at vger.kernel.org; Chris Ball; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH] mmc: mmci: Gate the clock in runtime suspend to save power

Quoted 15 lines · Ulf Hansson
Quoted 4 lines · Linus Walleij

1) Turn on MMC_CLKGATE for this driver (select from Kconfig) which means that the ios will be called with f=0 whenever the card is unused, taking into account the required number of clocks to the card.

I think MMC_CLKGATE was a good initiative in the past. But that was before runtime pm was there to use. Runtime pm suits much better for handling clock gating and other runtime power save actions that could be possible for a host driver to do.

I would even suggest the MMC_CLKGATE should be removed from the protocol layer, once we see that all host drivers that used it has switch to runtime pm.

Quoted 8 lines
Quoted 8 lines

Ah now I remember that you've actually even explained this to me ... memory is too short sometimes. But I follow this idea.

Then we have only the coordination between runtime suspend and suspend proper to iron out.

Russell's concern is valid if suspend() will not wait for runtime_suspend() to complete the last cycle before suspending.

A valid point, thanks for pointing this out clearly Linus!

Anyway, this need to be thought of as future step, since this patch is not changing anything to that sequence as Kevin also is pointing out.

So, the next step is to figure how we can properly do similar actions as in the runtime_suspend callback but as part of the suspend sequence instead and at the same time cope with 8 clock cycles. I will push a patch for this later, so then we can discuss more about that.

Quoted 8 lines
Quoted 1 line

pm_runtime_get_noresume is called before suspend and there are sdhci_runtime_pm_get/sdhci_runtime_pm_put within sdhci suspend/resume function. So the actual runtime_suspend won't be called after suspend finished. So it's same as original code without pm_runtime during suspend/resume.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Hm this sounds scaringly familiar to what we've discussed with Kevin Hilman et al recently...

May I have your Acks on this patch?

Sure, my pleasure.

Quoted 2 lines

Kind regards
Ulf Hansson

#4 lore raw

PATCH 1/1 mmc: mmci: Gate the clock in runtime suspend to save power

In reply to Ulf Hansson
Quoted 2 lines · Ulf Hansson

Anyway, this need to be thought of as future step, since this patch is not changing anything to that sequence as Kevin also is pointing out.

Given that Kevin is talking about stuff in sdhci as if it affects MMCI, and that neither of you have picked that up, you're *still* not gaining any confidence from me that you're actually thinking about the changes you're making. So I'm not really caring about how many acks your patches get, I'm still going to be reluctant to apply them without thinking about them for a bit.

#5 lore raw

PATCH 1/1 mmc: mmci: Gate the clock in runtime suspend to save power

Quoted 10 lines · Russell King - ARM Linux
Quoted 2 lines · Ulf Hansson

Anyway, this need to be thought of as future step, since this patch is not changing anything to that sequence as Kevin also is pointing out.

Given that Kevin is talking about stuff in sdhci as if it affects MMCI, and that neither of you have picked that up, you're *still* not gaining any confidence from me that you're actually thinking about the changes you're making. So I'm not really caring about how many acks your patches get, I'm still going to be reluctant to apply them without thinking about them for a bit.

MMCI is doing "pm_runtime_get_sync" in it suspend. So the same principles as Kevin is describing for sdhci goes for MMCI. Sorry if this was not clearly pointed out.

Kind regards
Ulf Hansson

author
#6 lore raw

PATCH 1/1 mmc: mmci: Gate the clock in runtime suspend to save power

2012/12/13 Ulf Hansson <[email protected]>:

Quoted 13 lines
Quoted 10 lines · Russell King - ARM Linux
Quoted 2 lines · Ulf Hansson

Anyway, this need to be thought of as future step, since this patch is not changing anything to that sequence as Kevin also is pointing out.

Given that Kevin is talking about stuff in sdhci as if it affects MMCI, and that neither of you have picked that up, you're *still* not gaining any confidence from me that you're actually thinking about the changes you're making. So I'm not really caring about how many acks your patches get, I'm still going to be reluctant to apply them without thinking about them for a bit.

Quoted 4 lines

MMCI is doing "pm_runtime_get_sync" in it suspend. So the same principles as Kevin is describing for sdhci goes for MMCI. Sorry if this was not clearly pointed out.

sorry for my unclear words. I just use sdhci directly to explain this. It's similar for sdhci and mmci on this point. pm_runtime is temporarily disabled during suspend/resume.

Thanks
Kevin

#7 lore raw

PATCH 1/1 mmc: mmci: Gate the clock in runtime suspend to save power

Quoted 18 lines · Kevin Liu

2012/12/13 Ulf Hansson <[email protected]>:

Quoted 13 lines
Quoted 10 lines · Russell King - ARM Linux
Quoted 2 lines · Ulf Hansson

Anyway, this need to be thought of as future step, since this patch is not changing anything to that sequence as Kevin also is pointing out.

Given that Kevin is talking about stuff in sdhci as if it affects MMCI, and that neither of you have picked that up, you're *still* not gaining any confidence from me that you're actually thinking about the changes you're making. So I'm not really caring about how many acks your patches get, I'm still going to be reluctant to apply them without thinking about them for a bit.

Quoted 4 lines

MMCI is doing "pm_runtime_get_sync" in it suspend. So the same principles as Kevin is describing for sdhci goes for MMCI. Sorry if this was not clearly pointed out.

Quoted 6 lines

sorry for my unclear words. I just use sdhci directly to explain this. It's similar for sdhci and mmci on this point. pm_runtime is temporarily disabled during suspend/resume.

Thanks
Kevin

Russell, is this enough for convincing you that everything has been thought of in this patch? Can we merge this?

Kind regards
Ulf Hansson

#8 lore raw

PATCH 1/1 mmc: mmci: Gate the clock in runtime suspend to save power

In reply to Kevin Liu
Quoted 6 lines · Kevin Liu
Quoted 2 lines

Russell's concern is valid if suspend() will not wait for runtime_suspend() to complete the last cycle before suspending.

pm_runtime_get_noresume is called before suspend and there are sdhci_runtime_pm_get/sdhci_runtime_pm_put within sdhci suspend/resume function.

What has the sdhci host driver code got to do with the MMCI host driver?