* [PATCH next 0/2] mmc: sdhci-pxav3: fix unbalanced pm and clock issues
@ 2015-01-04 15:15 Jisheng Zhang
2015-01-04 15:15 ` [PATCH next 1/2] mmc: sdhci-pxav3: fix unbalanced clock issues during probe Jisheng Zhang
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jisheng Zhang @ 2015-01-04 15:15 UTC (permalink / raw)
To: linux-arm-kernel
These two patches fix unbalanced pm and clock issues. The clock unbalance
issue would cause power consumption regression because the clock will never
be gated at runtime PM suspend.
Jisheng Zhang (2):
mmc: sdhci-pxav3: fix unbalanced clock issues during probe
mmc: sdhci-pxav3: fix pm unbalanced issue in -> remove()
drivers/mmc/host/sdhci-pxav3.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH next 1/2] mmc: sdhci-pxav3: fix unbalanced clock issues during probe
2015-01-04 15:15 [PATCH next 0/2] mmc: sdhci-pxav3: fix unbalanced pm and clock issues Jisheng Zhang
@ 2015-01-04 15:15 ` Jisheng Zhang
2015-01-04 15:15 ` [PATCH next 2/2] mmc: sdhci-pxav3: fix pm unbalanced issue in -> remove() Jisheng Zhang
2015-01-13 12:30 ` [PATCH next 0/2] mmc: sdhci-pxav3: fix unbalanced pm and clock issues Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Jisheng Zhang @ 2015-01-04 15:15 UTC (permalink / raw)
To: linux-arm-kernel
Commit 0dcaa2499b7d ("sdhci-pxav3: Fix runtime PM initialization") tries
to fix one hang issue caused by calling sdhci_add_host() on a suspended
device. The fix enables the clock twice, once by clk_prepare_enable() and
another by pm_runtime_get_sync(), meaning that the clock will never be
gated at runtime PM suspend. I observed the power consumption regression on
Marvell BG2Q SoCs.
In fact, the fix is not correct. There still be a very small window
during which a runtime suspend might somehow occur after pm_runtime_enable()
but before pm_runtime_get_sync().
This patch fixes all of the two problems by just incrementing the usage
counter before pm_runtime_enable(). It also adjust the order of disabling
runtime pm and storing the usage count in the error path to handle clock
gating properly.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Cc: <stable@vger.kernel.org> # v3.11+
---
drivers/mmc/host/sdhci-pxav3.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index ca3424e..1255dd2 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -365,10 +365,11 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
}
}
- pm_runtime_enable(&pdev->dev);
- pm_runtime_get_sync(&pdev->dev);
+ pm_runtime_get_noresume(&pdev->dev);
+ pm_runtime_set_active(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, PXAV3_RPM_DELAY_MS);
pm_runtime_use_autosuspend(&pdev->dev);
+ pm_runtime_enable(&pdev->dev);
pm_suspend_ignore_children(&pdev->dev, 1);
ret = sdhci_add_host(host);
@@ -391,8 +392,8 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
return 0;
err_add_host:
- pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
+ pm_runtime_put_noidle(&pdev->dev);
err_of_parse:
err_cd_req:
err_mbus_win:
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH next 2/2] mmc: sdhci-pxav3: fix pm unbalanced issue in -> remove()
2015-01-04 15:15 [PATCH next 0/2] mmc: sdhci-pxav3: fix unbalanced pm and clock issues Jisheng Zhang
2015-01-04 15:15 ` [PATCH next 1/2] mmc: sdhci-pxav3: fix unbalanced clock issues during probe Jisheng Zhang
@ 2015-01-04 15:15 ` Jisheng Zhang
2015-01-13 12:30 ` [PATCH next 0/2] mmc: sdhci-pxav3: fix unbalanced pm and clock issues Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Jisheng Zhang @ 2015-01-04 15:15 UTC (permalink / raw)
To: linux-arm-kernel
This patch calls pm_runtime_put_noidle() to restore the device's usage
counter in the ->remove() implementation.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
drivers/mmc/host/sdhci-pxav3.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 1255dd2..4de39fb 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -412,8 +412,10 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
struct sdhci_pxa *pxa = pltfm_host->priv;
pm_runtime_get_sync(&pdev->dev);
- sdhci_remove_host(host, 1);
pm_runtime_disable(&pdev->dev);
+ pm_runtime_put_noidle(&pdev->dev);
+
+ sdhci_remove_host(host, 1);
clk_disable_unprepare(pxa->clk_io);
if (!IS_ERR(pxa->clk_core))
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH next 0/2] mmc: sdhci-pxav3: fix unbalanced pm and clock issues
2015-01-04 15:15 [PATCH next 0/2] mmc: sdhci-pxav3: fix unbalanced pm and clock issues Jisheng Zhang
2015-01-04 15:15 ` [PATCH next 1/2] mmc: sdhci-pxav3: fix unbalanced clock issues during probe Jisheng Zhang
2015-01-04 15:15 ` [PATCH next 2/2] mmc: sdhci-pxav3: fix pm unbalanced issue in -> remove() Jisheng Zhang
@ 2015-01-13 12:30 ` Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2015-01-13 12:30 UTC (permalink / raw)
To: linux-arm-kernel
On 4 January 2015 at 16:15, Jisheng Zhang <jszhang@marvell.com> wrote:
> These two patches fix unbalanced pm and clock issues. The clock unbalance
> issue would cause power consumption regression because the clock will never
> be gated at runtime PM suspend.
>
> Jisheng Zhang (2):
> mmc: sdhci-pxav3: fix unbalanced clock issues during probe
> mmc: sdhci-pxav3: fix pm unbalanced issue in -> remove()
>
> drivers/mmc/host/sdhci-pxav3.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> --
> 2.1.4
>
Thanks! Applied for next.
Kind regards
Uffe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-13 12:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-04 15:15 [PATCH next 0/2] mmc: sdhci-pxav3: fix unbalanced pm and clock issues Jisheng Zhang
2015-01-04 15:15 ` [PATCH next 1/2] mmc: sdhci-pxav3: fix unbalanced clock issues during probe Jisheng Zhang
2015-01-04 15:15 ` [PATCH next 2/2] mmc: sdhci-pxav3: fix pm unbalanced issue in -> remove() Jisheng Zhang
2015-01-13 12:30 ` [PATCH next 0/2] mmc: sdhci-pxav3: fix unbalanced pm and clock issues Ulf Hansson
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).