* [RFC PATCH 2/5] mmc: host: add runtime PM for host class dev
@ 2014-12-19 8:05 Chuanxiao Dong
0 siblings, 0 replies; only message in thread
From: Chuanxiao Dong @ 2014-12-19 8:05 UTC (permalink / raw)
To: linux-mmc
mmc host has a class device which is parent of the card device, also
a children of the low level host device. Right now we have runtime pm
for card device and low level host device, but nothing for this host class
device. So it is impossible to connect the card runtime pm to low level host
runtime pm together.
We implement runtime pm to mmc host class device, so that when the card device
doesn't want to be ignored by the low level host runtime pm, card device driver
can talk to class device, so class device can talk to his parent.
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
---
drivers/mmc/core/host.c | 14 ++++++++++++++
drivers/mmc/host/sdhci-acpi.c | 1 -
drivers/mmc/host/sdhci-pci.c | 1 -
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 270d58a..a81ce09 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -22,6 +22,7 @@
#include <linux/leds.h>
#include <linux/slab.h>
#include <linux/suspend.h>
+#include <linux/pm_runtime.h>
#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
@@ -39,9 +40,15 @@ static void mmc_host_classdev_release(struct device *dev)
kfree(host);
}
+static const struct dev_pm_ops mmc_host_class_pm_ops = {
+ SET_RUNTIME_PM_OPS(pm_generic_runtime_suspend,
+ pm_generic_runtime_resume, NULL)
+};
+
static struct class mmc_host_class = {
.name = "mmc_host",
.dev_release = mmc_host_classdev_release,
+ .pm = &mmc_host_class_pm_ops,
};
int mmc_register_host_class(void)
@@ -524,6 +531,13 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
host->max_blk_size = 512;
host->max_blk_count = PAGE_CACHE_SIZE / 512;
+ pm_runtime_set_active(&host->class_dev);
+ pm_runtime_enable(&host->class_dev);
+ /*
+ * ignore the children by default
+ */
+ pm_suspend_ignore_children(&host->class_dev, true);
+
return host;
free:
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index e3e56d3..caefad6 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -372,7 +372,6 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
if (c->use_runtime_pm) {
pm_runtime_set_active(dev);
- pm_suspend_ignore_children(dev, 1);
pm_runtime_set_autosuspend_delay(dev, 50);
pm_runtime_use_autosuspend(dev);
pm_runtime_enable(dev);
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 0342775..ed8b0e4 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -1548,7 +1548,6 @@ static void sdhci_pci_runtime_pm_allow(struct device *dev)
pm_runtime_allow(dev);
pm_runtime_set_autosuspend_delay(dev, 50);
pm_runtime_use_autosuspend(dev);
- pm_suspend_ignore_children(dev, 1);
}
static void sdhci_pci_runtime_pm_forbid(struct device *dev)
--
1.7.10.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-12-19 8:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-19 8:05 [RFC PATCH 2/5] mmc: host: add runtime PM for host class dev Chuanxiao Dong
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).