* [PATCH v1 1/8] mmc: sdio: fully reconfigure oldcard on resume
2010-09-07 11:29 ` Ohad Ben-Cohen
@ 2010-09-07 11:29 ` Ohad Ben-Cohen
-1 siblings, 0 replies; 29+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-07 11:29 UTC (permalink / raw)
To: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-mmc-u79uwXL29TY76Z2rM5mHXA
Cc: Luciano Coelho, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, San Mehat,
Roger Quadros, Nicolas Pitre, Gao Yunpeng, Ohad Ben-Cohen
On resume, let mmc_sdio_init_card go all the way, instead
of skipping the reconfiguration of the card's speed and width.
This is needed to ensure cards wake up with their clock
reconfigured (otherwise it's kept low).
This patch also removes the explicit bus width reconfiguration
on resume, since now this is part of mmc_sdio_init_card.
Signed-off-by: Ohad Ben-Cohen <ohad-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org>
---
drivers/mmc/core/sdio.c | 9 ---------
1 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index bd2755e..8a34945 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -457,7 +457,6 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
return -ENOENT;
card = oldcard;
- return 0;
}
if (card->type == MMC_TYPE_SD_COMBO) {
@@ -615,14 +614,6 @@ static int mmc_sdio_resume(struct mmc_host *host)
mmc_claim_host(host);
err = mmc_sdio_init_card(host, host->ocr, host->card,
(host->pm_flags & MMC_PM_KEEP_POWER));
- if (!err) {
- /* We may have switched to 1-bit mode during suspend. */
- err = sdio_enable_4bit_bus(host->card);
- if (err > 0) {
- mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
- err = 0;
- }
- }
if (!err && host->sdio_irqs)
mmc_signal_sdio_irq(host);
mmc_release_host(host);
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 29+ messages in thread* [PATCH v1 1/8] mmc: sdio: fully reconfigure oldcard on resume
@ 2010-09-07 11:29 ` Ohad Ben-Cohen
0 siblings, 0 replies; 29+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-07 11:29 UTC (permalink / raw)
To: linux-wireless, linux-mmc
Cc: Luciano Coelho, akpm, San Mehat, Roger Quadros, Nicolas Pitre,
Gao Yunpeng, Ohad Ben-Cohen
On resume, let mmc_sdio_init_card go all the way, instead
of skipping the reconfiguration of the card's speed and width.
This is needed to ensure cards wake up with their clock
reconfigured (otherwise it's kept low).
This patch also removes the explicit bus width reconfiguration
on resume, since now this is part of mmc_sdio_init_card.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
---
drivers/mmc/core/sdio.c | 9 ---------
1 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index bd2755e..8a34945 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -457,7 +457,6 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
return -ENOENT;
card = oldcard;
- return 0;
}
if (card->type == MMC_TYPE_SD_COMBO) {
@@ -615,14 +614,6 @@ static int mmc_sdio_resume(struct mmc_host *host)
mmc_claim_host(host);
err = mmc_sdio_init_card(host, host->ocr, host->card,
(host->pm_flags & MMC_PM_KEEP_POWER));
- if (!err) {
- /* We may have switched to 1-bit mode during suspend. */
- err = sdio_enable_4bit_bus(host->card);
- if (err > 0) {
- mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
- err = 0;
- }
- }
if (!err && host->sdio_irqs)
mmc_signal_sdio_irq(host);
mmc_release_host(host);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v1 2/8] mmc: propagate power save/restore ops return value
2010-09-07 11:29 ` Ohad Ben-Cohen
@ 2010-09-07 11:29 ` Ohad Ben-Cohen
-1 siblings, 0 replies; 29+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-07 11:29 UTC (permalink / raw)
To: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-mmc-u79uwXL29TY76Z2rM5mHXA
Cc: Luciano Coelho, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, San Mehat,
Roger Quadros, Nicolas Pitre, Gao Yunpeng, Ohad Ben-Cohen
Allow power save/restore and their relevant mmc_bus_ops handlers exit with a return value.
Signed-off-by: Ohad Ben-Cohen <ohad-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org>
---
drivers/mmc/core/core.c | 20 ++++++++++++++------
drivers/mmc/core/core.h | 4 ++--
drivers/mmc/core/mmc.c | 8 ++++++--
drivers/mmc/core/sd.c | 8 ++++++--
include/linux/mmc/host.h | 4 ++--
5 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 5db49b1..73575c4 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1538,37 +1538,45 @@ void mmc_stop_host(struct mmc_host *host)
mmc_power_off(host);
}
-void mmc_power_save_host(struct mmc_host *host)
+int mmc_power_save_host(struct mmc_host *host)
{
+ int ret = 0;
+
mmc_bus_get(host);
if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) {
mmc_bus_put(host);
- return;
+ return -EINVAL;
}
if (host->bus_ops->power_save)
- host->bus_ops->power_save(host);
+ ret = host->bus_ops->power_save(host);
mmc_bus_put(host);
mmc_power_off(host);
+
+ return ret;
}
EXPORT_SYMBOL(mmc_power_save_host);
-void mmc_power_restore_host(struct mmc_host *host)
+int mmc_power_restore_host(struct mmc_host *host)
{
+ int ret;
+
mmc_bus_get(host);
if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) {
mmc_bus_put(host);
- return;
+ return -EINVAL;
}
mmc_power_up(host);
- host->bus_ops->power_restore(host);
+ ret = host->bus_ops->power_restore(host);
mmc_bus_put(host);
+
+ return ret;
}
EXPORT_SYMBOL(mmc_power_restore_host);
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index 9d9eef5..fff58fa 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -22,8 +22,8 @@ struct mmc_bus_ops {
void (*detect)(struct mmc_host *);
int (*suspend)(struct mmc_host *);
int (*resume)(struct mmc_host *);
- void (*power_save)(struct mmc_host *);
- void (*power_restore)(struct mmc_host *);
+ int (*power_save)(struct mmc_host *);
+ int (*power_restore)(struct mmc_host *);
};
void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 6909a54..1f69f5a 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -623,12 +623,16 @@ static int mmc_resume(struct mmc_host *host)
return err;
}
-static void mmc_power_restore(struct mmc_host *host)
+static int mmc_power_restore(struct mmc_host *host)
{
+ int ret;
+
host->card->state &= ~MMC_STATE_HIGHSPEED;
mmc_claim_host(host);
- mmc_init_card(host, host->ocr, host->card);
+ ret = mmc_init_card(host, host->ocr, host->card);
mmc_release_host(host);
+
+ return ret;
}
static int mmc_sleep(struct mmc_host *host)
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 0f52410..32c58b4 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -722,12 +722,16 @@ static int mmc_sd_resume(struct mmc_host *host)
return err;
}
-static void mmc_sd_power_restore(struct mmc_host *host)
+static int mmc_sd_power_restore(struct mmc_host *host)
{
+ int ret;
+
host->card->state &= ~MMC_STATE_HIGHSPEED;
mmc_claim_host(host);
- mmc_sd_init_card(host, host->ocr, host->card);
+ ret = mmc_sd_init_card(host, host->ocr, host->card);
mmc_release_host(host);
+
+ return ret;
}
static const struct mmc_bus_ops mmc_sd_ops = {
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 1575b52..0935841 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -236,8 +236,8 @@ static inline void *mmc_priv(struct mmc_host *host)
extern int mmc_suspend_host(struct mmc_host *);
extern int mmc_resume_host(struct mmc_host *);
-extern void mmc_power_save_host(struct mmc_host *host);
-extern void mmc_power_restore_host(struct mmc_host *host);
+extern int mmc_power_save_host(struct mmc_host *host);
+extern int mmc_power_restore_host(struct mmc_host *host);
extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 29+ messages in thread* [PATCH v1 2/8] mmc: propagate power save/restore ops return value
@ 2010-09-07 11:29 ` Ohad Ben-Cohen
0 siblings, 0 replies; 29+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-07 11:29 UTC (permalink / raw)
To: linux-wireless, linux-mmc
Cc: Luciano Coelho, akpm, San Mehat, Roger Quadros, Nicolas Pitre,
Gao Yunpeng, Ohad Ben-Cohen
Allow power save/restore and their relevant mmc_bus_ops handlers exit with a return value.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
---
drivers/mmc/core/core.c | 20 ++++++++++++++------
drivers/mmc/core/core.h | 4 ++--
drivers/mmc/core/mmc.c | 8 ++++++--
drivers/mmc/core/sd.c | 8 ++++++--
include/linux/mmc/host.h | 4 ++--
5 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 5db49b1..73575c4 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1538,37 +1538,45 @@ void mmc_stop_host(struct mmc_host *host)
mmc_power_off(host);
}
-void mmc_power_save_host(struct mmc_host *host)
+int mmc_power_save_host(struct mmc_host *host)
{
+ int ret = 0;
+
mmc_bus_get(host);
if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) {
mmc_bus_put(host);
- return;
+ return -EINVAL;
}
if (host->bus_ops->power_save)
- host->bus_ops->power_save(host);
+ ret = host->bus_ops->power_save(host);
mmc_bus_put(host);
mmc_power_off(host);
+
+ return ret;
}
EXPORT_SYMBOL(mmc_power_save_host);
-void mmc_power_restore_host(struct mmc_host *host)
+int mmc_power_restore_host(struct mmc_host *host)
{
+ int ret;
+
mmc_bus_get(host);
if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) {
mmc_bus_put(host);
- return;
+ return -EINVAL;
}
mmc_power_up(host);
- host->bus_ops->power_restore(host);
+ ret = host->bus_ops->power_restore(host);
mmc_bus_put(host);
+
+ return ret;
}
EXPORT_SYMBOL(mmc_power_restore_host);
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index 9d9eef5..fff58fa 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -22,8 +22,8 @@ struct mmc_bus_ops {
void (*detect)(struct mmc_host *);
int (*suspend)(struct mmc_host *);
int (*resume)(struct mmc_host *);
- void (*power_save)(struct mmc_host *);
- void (*power_restore)(struct mmc_host *);
+ int (*power_save)(struct mmc_host *);
+ int (*power_restore)(struct mmc_host *);
};
void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 6909a54..1f69f5a 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -623,12 +623,16 @@ static int mmc_resume(struct mmc_host *host)
return err;
}
-static void mmc_power_restore(struct mmc_host *host)
+static int mmc_power_restore(struct mmc_host *host)
{
+ int ret;
+
host->card->state &= ~MMC_STATE_HIGHSPEED;
mmc_claim_host(host);
- mmc_init_card(host, host->ocr, host->card);
+ ret = mmc_init_card(host, host->ocr, host->card);
mmc_release_host(host);
+
+ return ret;
}
static int mmc_sleep(struct mmc_host *host)
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 0f52410..32c58b4 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -722,12 +722,16 @@ static int mmc_sd_resume(struct mmc_host *host)
return err;
}
-static void mmc_sd_power_restore(struct mmc_host *host)
+static int mmc_sd_power_restore(struct mmc_host *host)
{
+ int ret;
+
host->card->state &= ~MMC_STATE_HIGHSPEED;
mmc_claim_host(host);
- mmc_sd_init_card(host, host->ocr, host->card);
+ ret = mmc_sd_init_card(host, host->ocr, host->card);
mmc_release_host(host);
+
+ return ret;
}
static const struct mmc_bus_ops mmc_sd_ops = {
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 1575b52..0935841 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -236,8 +236,8 @@ static inline void *mmc_priv(struct mmc_host *host)
extern int mmc_suspend_host(struct mmc_host *);
extern int mmc_resume_host(struct mmc_host *);
-extern void mmc_power_save_host(struct mmc_host *host);
-extern void mmc_power_restore_host(struct mmc_host *host);
+extern int mmc_power_save_host(struct mmc_host *host);
+extern int mmc_power_restore_host(struct mmc_host *host);
extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v1 3/8] sdio: add power_restore support
2010-09-07 11:29 ` Ohad Ben-Cohen
@ 2010-09-07 11:29 ` Ohad Ben-Cohen
-1 siblings, 0 replies; 29+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-07 11:29 UTC (permalink / raw)
To: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-mmc-u79uwXL29TY76Z2rM5mHXA
Cc: Luciano Coelho, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, San Mehat,
Roger Quadros, Nicolas Pitre, Gao Yunpeng, Ohad Ben-Cohen
Add a power_restore handler to the SDIO bus ops,
in order to support waking up SDIO cards that
were powered off by runtime pm.
Signed-off-by: Ohad Ben-Cohen <ohad-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org>
---
drivers/mmc/core/sdio.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 8a34945..c118cc2 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -639,11 +639,29 @@ static int mmc_sdio_resume(struct mmc_host *host)
return err;
}
+static int mmc_sdio_power_restore(struct mmc_host *host)
+{
+ int ret;
+
+ BUG_ON(!host);
+ BUG_ON(!host->card);
+
+ mmc_claim_host(host);
+ ret = mmc_sdio_init_card(host, host->ocr, host->card,
+ (host->pm_flags & MMC_PM_KEEP_POWER));
+ if (!ret && host->sdio_irqs)
+ mmc_signal_sdio_irq(host);
+ mmc_release_host(host);
+
+ return ret;
+}
+
static const struct mmc_bus_ops mmc_sdio_ops = {
.remove = mmc_sdio_remove,
.detect = mmc_sdio_detect,
.suspend = mmc_sdio_suspend,
.resume = mmc_sdio_resume,
+ .power_restore = mmc_sdio_power_restore,
};
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 29+ messages in thread* [PATCH v1 3/8] sdio: add power_restore support
@ 2010-09-07 11:29 ` Ohad Ben-Cohen
0 siblings, 0 replies; 29+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-07 11:29 UTC (permalink / raw)
To: linux-wireless, linux-mmc
Cc: Luciano Coelho, akpm, San Mehat, Roger Quadros, Nicolas Pitre,
Gao Yunpeng, Ohad Ben-Cohen
Add a power_restore handler to the SDIO bus ops,
in order to support waking up SDIO cards that
were powered off by runtime pm.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
---
drivers/mmc/core/sdio.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 8a34945..c118cc2 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -639,11 +639,29 @@ static int mmc_sdio_resume(struct mmc_host *host)
return err;
}
+static int mmc_sdio_power_restore(struct mmc_host *host)
+{
+ int ret;
+
+ BUG_ON(!host);
+ BUG_ON(!host->card);
+
+ mmc_claim_host(host);
+ ret = mmc_sdio_init_card(host, host->ocr, host->card,
+ (host->pm_flags & MMC_PM_KEEP_POWER));
+ if (!ret && host->sdio_irqs)
+ mmc_signal_sdio_irq(host);
+ mmc_release_host(host);
+
+ return ret;
+}
+
static const struct mmc_bus_ops mmc_sdio_ops = {
.remove = mmc_sdio_remove,
.detect = mmc_sdio_detect,
.suspend = mmc_sdio_suspend,
.resume = mmc_sdio_resume,
+ .power_restore = mmc_sdio_power_restore,
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v1 6/8] sdio: enable Runtime PM for SDIO cards
2010-09-07 11:29 ` Ohad Ben-Cohen
@ 2010-09-07 11:29 ` Ohad Ben-Cohen
-1 siblings, 0 replies; 29+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-07 11:29 UTC (permalink / raw)
To: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-mmc-u79uwXL29TY76Z2rM5mHXA
Cc: Luciano Coelho, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, San Mehat,
Roger Quadros, Nicolas Pitre, Gao Yunpeng, Ohad Ben-Cohen
Enable runtime PM for new SDIO cards.
As soon as the card will be added to the device tree, runtime PM core
will release its power, since it doesn't have any users yet.
Signed-off-by: Ohad Ben-Cohen <ohad-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org>
---
drivers/mmc/core/sdio.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index c118cc2..a5a76a8 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -10,6 +10,7 @@
*/
#include <linux/err.h>
+#include <linux/pm_runtime.h>
#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
@@ -709,6 +710,15 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
card = host->card;
/*
+ * Enable Runtime PM for this card
+ */
+ err = pm_runtime_set_active(&card->dev);
+ if (err)
+ goto remove;
+
+ pm_runtime_enable(&card->dev);
+
+ /*
* The number of functions on the card is encoded inside
* the ocr.
*/
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v1 6/8] sdio: enable Runtime PM for SDIO cards
@ 2010-09-07 11:29 ` Ohad Ben-Cohen
0 siblings, 0 replies; 29+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-07 11:29 UTC (permalink / raw)
To: linux-wireless, linux-mmc
Cc: Luciano Coelho, akpm, San Mehat, Roger Quadros, Nicolas Pitre,
Gao Yunpeng, Ohad Ben-Cohen
Enable runtime PM for new SDIO cards.
As soon as the card will be added to the device tree, runtime PM core
will release its power, since it doesn't have any users yet.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
---
drivers/mmc/core/sdio.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index c118cc2..a5a76a8 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -10,6 +10,7 @@
*/
#include <linux/err.h>
+#include <linux/pm_runtime.h>
#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
@@ -709,6 +710,15 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
card = host->card;
/*
+ * Enable Runtime PM for this card
+ */
+ err = pm_runtime_set_active(&card->dev);
+ if (err)
+ goto remove;
+
+ pm_runtime_enable(&card->dev);
+
+ /*
* The number of functions on the card is encoded inside
* the ocr.
*/
--
1.7.0.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v1 8/8] wireless: wl1271_sdio: enable Runtime PM
2010-09-07 11:29 ` Ohad Ben-Cohen
@ 2010-09-07 11:29 ` Ohad Ben-Cohen
-1 siblings, 0 replies; 29+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-07 11:29 UTC (permalink / raw)
To: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-mmc-u79uwXL29TY76Z2rM5mHXA
Cc: Luciano Coelho, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, San Mehat,
Roger Quadros, Nicolas Pitre, Gao Yunpeng, Ohad Ben-Cohen
Enable runtime pm for the wl1271 SDIO device.
We request power whenever the WLAN interface is brought up,
and release it after the WLAN interface is taken down.
As a result, power is released immediately after probe returns,
since at that point power has not been explicitly requested yet
(i.e. the WLAN interface is still down).
Signed-off-by: Ohad Ben-Cohen <ohad-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org>
---
drivers/net/wireless/wl12xx/wl1271_sdio.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index 824b9e8..235191e 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -30,6 +30,7 @@
#include <linux/mmc/card.h>
#include <linux/gpio.h>
#include <linux/wl12xx.h>
+#include <linux/pm_runtime.h>
#include "wl1271.h"
#include "wl12xx_80211.h"
@@ -153,20 +154,27 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
{
struct sdio_func *func = wl_to_func(wl);
+ int err;
/* Let the SDIO stack handle wlan_enable control, so we
* keep host claimed while wlan is in use to keep wl1271
* alive.
*/
if (enable) {
+ err = pm_runtime_get_sync(&func->dev);
+ if (err)
+ goto out;
+
sdio_claim_host(func);
sdio_enable_func(func);
} else {
sdio_disable_func(func);
sdio_release_host(func);
+ err = pm_runtime_put_sync(&func->dev);
}
- return 0;
+out:
+ return err;
}
static struct wl1271_if_operations sdio_ops = {
@@ -233,6 +241,8 @@ static int __devinit wl1271_probe(struct sdio_func *func,
sdio_set_drvdata(func, wl);
+ pm_runtime_put_noidle(&func->dev);
+
wl1271_notice("initialized");
return 0;
@@ -255,6 +265,8 @@ static void __devexit wl1271_remove(struct sdio_func *func)
wl1271_unregister_hw(wl);
wl1271_free_hw(wl);
+
+ pm_runtime_get_noresume(&func->dev);
}
static struct sdio_driver wl1271_sdio_driver = {
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 29+ messages in thread* [PATCH v1 8/8] wireless: wl1271_sdio: enable Runtime PM
@ 2010-09-07 11:29 ` Ohad Ben-Cohen
0 siblings, 0 replies; 29+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-07 11:29 UTC (permalink / raw)
To: linux-wireless, linux-mmc
Cc: Luciano Coelho, akpm, San Mehat, Roger Quadros, Nicolas Pitre,
Gao Yunpeng, Ohad Ben-Cohen
Enable runtime pm for the wl1271 SDIO device.
We request power whenever the WLAN interface is brought up,
and release it after the WLAN interface is taken down.
As a result, power is released immediately after probe returns,
since at that point power has not been explicitly requested yet
(i.e. the WLAN interface is still down).
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
---
drivers/net/wireless/wl12xx/wl1271_sdio.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index 824b9e8..235191e 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -30,6 +30,7 @@
#include <linux/mmc/card.h>
#include <linux/gpio.h>
#include <linux/wl12xx.h>
+#include <linux/pm_runtime.h>
#include "wl1271.h"
#include "wl12xx_80211.h"
@@ -153,20 +154,27 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
{
struct sdio_func *func = wl_to_func(wl);
+ int err;
/* Let the SDIO stack handle wlan_enable control, so we
* keep host claimed while wlan is in use to keep wl1271
* alive.
*/
if (enable) {
+ err = pm_runtime_get_sync(&func->dev);
+ if (err)
+ goto out;
+
sdio_claim_host(func);
sdio_enable_func(func);
} else {
sdio_disable_func(func);
sdio_release_host(func);
+ err = pm_runtime_put_sync(&func->dev);
}
- return 0;
+out:
+ return err;
}
static struct wl1271_if_operations sdio_ops = {
@@ -233,6 +241,8 @@ static int __devinit wl1271_probe(struct sdio_func *func,
sdio_set_drvdata(func, wl);
+ pm_runtime_put_noidle(&func->dev);
+
wl1271_notice("initialized");
return 0;
@@ -255,6 +265,8 @@ static void __devexit wl1271_remove(struct sdio_func *func)
wl1271_unregister_hw(wl);
wl1271_free_hw(wl);
+
+ pm_runtime_get_noresume(&func->dev);
}
static struct sdio_driver wl1271_sdio_driver = {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 29+ messages in thread[parent not found: <1283858949-11073-9-git-send-email-ohad-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH v1 8/8] wireless: wl1271_sdio: enable Runtime PM
2010-09-07 11:29 ` Ohad Ben-Cohen
@ 2010-09-07 13:02 ` David Vrabel
-1 siblings, 0 replies; 29+ messages in thread
From: David Vrabel @ 2010-09-07 13:02 UTC (permalink / raw)
To: Ohad Ben-Cohen
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-mmc-u79uwXL29TY76Z2rM5mHXA, Luciano Coelho,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, San Mehat, Roger Quadros,
Nicolas Pitre, Gao Yunpeng
Ohad Ben-Cohen wrote:
> Enable runtime pm for the wl1271 SDIO device.
>
> We request power whenever the WLAN interface is brought up,
> and release it after the WLAN interface is taken down.
>
> As a result, power is released immediately after probe returns,
> since at that point power has not been explicitly requested yet
> (i.e. the WLAN interface is still down).
[...]
> @@ -233,6 +241,8 @@ static int __devinit wl1271_probe(struct sdio_func *func,
>
> sdio_set_drvdata(func, wl);
>
> + pm_runtime_put_noidle(&func->dev);
I find this a little odd and confusing as this is releasing the
reference taken by mmc core from inside the function driver.
Instead, I would suggest changing all existing SDIO function drivers to
call pm_runtime_get() in probe() and pm_runtime_put() in remove(). I
think this makes the runtime PM usage more obvious from a function
driver point of view.
> +
> wl1271_notice("initialized");
>
> return 0;
> @@ -255,6 +265,8 @@ static void __devexit wl1271_remove(struct sdio_func *func)
>
> wl1271_unregister_hw(wl);
> wl1271_free_hw(wl);
> +
> + pm_runtime_get_noresume(&func->dev);
> }
>
> static struct sdio_driver wl1271_sdio_driver = {
David
--
David Vrabel, Senior Software Engineer, Drivers
CSR, Churchill House, Cambridge Business Park, Tel: +44 (0)1223 692562
Cowley Road, Cambridge, CB4 0WZ http://www.csr.com/
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 29+ messages in thread* Re: [PATCH v1 8/8] wireless: wl1271_sdio: enable Runtime PM
@ 2010-09-07 13:02 ` David Vrabel
0 siblings, 0 replies; 29+ messages in thread
From: David Vrabel @ 2010-09-07 13:02 UTC (permalink / raw)
To: Ohad Ben-Cohen
Cc: linux-wireless, linux-mmc, Luciano Coelho, akpm, San Mehat,
Roger Quadros, Nicolas Pitre, Gao Yunpeng
Ohad Ben-Cohen wrote:
> Enable runtime pm for the wl1271 SDIO device.
>
> We request power whenever the WLAN interface is brought up,
> and release it after the WLAN interface is taken down.
>
> As a result, power is released immediately after probe returns,
> since at that point power has not been explicitly requested yet
> (i.e. the WLAN interface is still down).
[...]
> @@ -233,6 +241,8 @@ static int __devinit wl1271_probe(struct sdio_func *func,
>
> sdio_set_drvdata(func, wl);
>
> + pm_runtime_put_noidle(&func->dev);
I find this a little odd and confusing as this is releasing the
reference taken by mmc core from inside the function driver.
Instead, I would suggest changing all existing SDIO function drivers to
call pm_runtime_get() in probe() and pm_runtime_put() in remove(). I
think this makes the runtime PM usage more obvious from a function
driver point of view.
> +
> wl1271_notice("initialized");
>
> return 0;
> @@ -255,6 +265,8 @@ static void __devexit wl1271_remove(struct sdio_func *func)
>
> wl1271_unregister_hw(wl);
> wl1271_free_hw(wl);
> +
> + pm_runtime_get_noresume(&func->dev);
> }
>
> static struct sdio_driver wl1271_sdio_driver = {
David
--
David Vrabel, Senior Software Engineer, Drivers
CSR, Churchill House, Cambridge Business Park, Tel: +44 (0)1223 692562
Cowley Road, Cambridge, CB4 0WZ http://www.csr.com/
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
^ permalink raw reply [flat|nested] 29+ messages in thread* Re: [PATCH v1 8/8] wireless: wl1271_sdio: enable Runtime PM
2010-09-07 13:02 ` David Vrabel
(?)
@ 2010-09-07 13:15 ` Ohad Ben-Cohen
2010-09-07 22:20 ` David Vrabel
-1 siblings, 1 reply; 29+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-07 13:15 UTC (permalink / raw)
To: David Vrabel
Cc: linux-wireless, linux-mmc, Luciano Coelho, akpm, San Mehat,
Roger Quadros, Nicolas Pitre, Gao Yunpeng
On Tue, Sep 7, 2010 at 4:02 PM, David Vrabel <david.vrabel@csr.com> wrote:
> Ohad Ben-Cohen wrote:
>> Enable runtime pm for the wl1271 SDIO device.
>>
>> We request power whenever the WLAN interface is brought up,
>> and release it after the WLAN interface is taken down.
>>
>> As a result, power is released immediately after probe returns,
>> since at that point power has not been explicitly requested yet
>> (i.e. the WLAN interface is still down).
> [...]
>> @@ -233,6 +241,8 @@ static int __devinit wl1271_probe(struct sdio_func *func,
>>
>> sdio_set_drvdata(func, wl);
>>
>> + pm_runtime_put_noidle(&func->dev);
>
> I find this a little odd and confusing as this is releasing the
> reference taken by mmc core from inside the function driver.
This is done in order to still support function drivers that are not
aware of runtime pm (same approach was taken in the PCI implementation
of runtime pm).
> Instead, I would suggest changing all existing SDIO function drivers to
> call pm_runtime_get() in probe() and pm_runtime_put() in remove().
If we are willing to require runtime pm awareness from all SDIO
function drivers then we can do this (obviously we will break all
out-of-tree drivers by doing so).
> think this makes the runtime PM usage more obvious from a function
> driver point of view.
>
>> +
>> wl1271_notice("initialized");
>>
>> return 0;
>> @@ -255,6 +265,8 @@ static void __devexit wl1271_remove(struct sdio_func *func)
>>
>> wl1271_unregister_hw(wl);
>> wl1271_free_hw(wl);
>> +
>> + pm_runtime_get_noresume(&func->dev);
>> }
>>
>> static struct sdio_driver wl1271_sdio_driver = {
>
> David
> --
> David Vrabel, Senior Software Engineer, Drivers
> CSR, Churchill House, Cambridge Business Park, Tel: +44 (0)1223 692562
> Cowley Road, Cambridge, CB4 0WZ http://www.csr.com/
>
>
> Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
>
^ permalink raw reply [flat|nested] 29+ messages in thread* Re: [PATCH v1 8/8] wireless: wl1271_sdio: enable Runtime PM
2010-09-07 13:15 ` Ohad Ben-Cohen
@ 2010-09-07 22:20 ` David Vrabel
0 siblings, 0 replies; 29+ messages in thread
From: David Vrabel @ 2010-09-07 22:20 UTC (permalink / raw)
To: Ohad Ben-Cohen
Cc: linux-wireless, linux-mmc, Luciano Coelho, akpm, San Mehat,
Roger Quadros, Nicolas Pitre, Gao Yunpeng
On 07/09/2010 14:15, Ohad Ben-Cohen wrote:
> On Tue, Sep 7, 2010 at 4:02 PM, David Vrabel <david.vrabel@csr.com> wrote:
>> Ohad Ben-Cohen wrote:
>>> Enable runtime pm for the wl1271 SDIO device.
>>>
>>> We request power whenever the WLAN interface is brought up,
>>> and release it after the WLAN interface is taken down.
>>>
>>> As a result, power is released immediately after probe returns,
>>> since at that point power has not been explicitly requested yet
>>> (i.e. the WLAN interface is still down).
>> [...]
>>> @@ -233,6 +241,8 @@ static int __devinit wl1271_probe(struct sdio_func *func,
>>>
>>> sdio_set_drvdata(func, wl);
>>>
>>> + pm_runtime_put_noidle(&func->dev);
>>
>> I find this a little odd and confusing as this is releasing the
>> reference taken by mmc core from inside the function driver.
>
> This is done in order to still support function drivers that are not
> aware of runtime pm (same approach was taken in the PCI implementation
> of runtime pm).
Best to do the same as PCI then.
David
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH v1 8/8] wireless: wl1271_sdio: enable Runtime PM
2010-09-07 11:29 ` Ohad Ben-Cohen
@ 2010-09-08 17:40 ` Luciano Coelho
-1 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-09-08 17:40 UTC (permalink / raw)
To: ext Ohad Ben-Cohen
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, San Mehat,
Quadros Roger (Nokia-MS/Helsinki), Nicolas Pitre, Gao Yunpeng
On Tue, 2010-09-07 at 13:29 +0200, ext Ohad Ben-Cohen wrote:
> Enable runtime pm for the wl1271 SDIO device.
>
> We request power whenever the WLAN interface is brought up,
> and release it after the WLAN interface is taken down.
>
> As a result, power is released immediately after probe returns,
> since at that point power has not been explicitly requested yet
> (i.e. the WLAN interface is still down).
>
> Signed-off-by: Ohad Ben-Cohen <ohad-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org>
> ---
Looks fine to me, after considering David's comment and since it's done
in the same way for PCI.
Acked-by: Luciano Coelho <luciano.coelho-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
--
Cheers,
Luca.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH v1 8/8] wireless: wl1271_sdio: enable Runtime PM
@ 2010-09-08 17:40 ` Luciano Coelho
0 siblings, 0 replies; 29+ messages in thread
From: Luciano Coelho @ 2010-09-08 17:40 UTC (permalink / raw)
To: ext Ohad Ben-Cohen
Cc: linux-wireless@vger.kernel.org, linux-mmc@vger.kernel.org,
akpm@linux-foundation.org, San Mehat,
Quadros Roger (Nokia-MS/Helsinki), Nicolas Pitre, Gao Yunpeng
On Tue, 2010-09-07 at 13:29 +0200, ext Ohad Ben-Cohen wrote:
> Enable runtime pm for the wl1271 SDIO device.
>
> We request power whenever the WLAN interface is brought up,
> and release it after the WLAN interface is taken down.
>
> As a result, power is released immediately after probe returns,
> since at that point power has not been explicitly requested yet
> (i.e. the WLAN interface is still down).
>
> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
> ---
Looks fine to me, after considering David's comment and since it's done
in the same way for PCI.
Acked-by: Luciano Coelho <luciano.coelho@nokia.com>
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 29+ messages in thread