Skip to contentSkip to conversation

mmc: Add "ignore mmc pm notify" functionality

PATCH In review Dmitry Shmidt 2 participants 18 messages Oct 11, 2010 – Oct 14, 2010 2 messages not in the archive MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: Add "ignore mmc pm notify" functionality

Hi,

While working with "permanent" mmc/sdio devices we may want to skip new suspend/resume functionality.

commit 4c40080bb1d4f68000b7a4c397c1bc8a623668fa

Author: Dmitry Shmidt <[email protected]>
Date:   Mon Oct 11 11:28:54 2010 -0700

mmc: Add "ignore mmc pm notify" functionality

drivers/mmc/core/host.c +5 -2
index d80cfdc..ba684e6 100644
@@ -137,7 +137,8 @@ int mmc_add_host(struct mmc_host *host)
 #endif
 
 	mmc_start_host(host);
-	register_pm_notifier(&host->pm_notify);
+	if (!(host->pm_flags & MMC_PM_IGNORE_PM_NOTIFY))
+		register_pm_notifier(&host->pm_notify);
 
 	return 0;
 }
@@ -154,7 +155,9 @@ EXPORT_SYMBOL(mmc_add_host);
  */
 void mmc_remove_host(struct mmc_host *host)
 {
-	unregister_pm_notifier(&host->pm_notify);
+	if (!(host->pm_flags & MMC_PM_IGNORE_PM_NOTIFY))
+		unregister_pm_notifier(&host->pm_notify);
+
 	mmc_stop_host(host);
 
 #ifdef CONFIG_DEBUG_FS
include/linux/mmc/pm.h +0 -0
index d37aac4..3903823 100644
@@ -26,5 +26,6 @@ typedef unsigned int mmc_pm_flag_t;
 
 #define MMC_PM_KEEP_POWER	(1 << 0)	/* preserve card power during 

suspend */
#define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO
IRQ assertion */
+#define MMC_PM_IGNORE_PM_NOTIFY (1 << 2) /* ignore mmc pm notify
*/

#endif

#1 lore raw
Quoted 4 lines · Dmitry Shmidt

Hi,

While working with "permanent" mmc/sdio devices we may want to skip new suspend/resume functionality.

Why ??

Quoted 55 lines

commit 4c40080bb1d4f68000b7a4c397c1bc8a623668fa

Author: Dmitry Shmidt <[email protected]>
Date:   Mon Oct 11 11:28:54 2010 -0700

mmc: Add "ignore mmc pm notify" functionality

drivers/mmc/core/host.c +5 -2
index d80cfdc..ba684e6 100644
@@ -137,7 +137,8 @@ int mmc_add_host(struct mmc_host *host)
 #endif
 
 	mmc_start_host(host);
-	register_pm_notifier(&host->pm_notify);
+	if (!(host->pm_flags & MMC_PM_IGNORE_PM_NOTIFY))
+		register_pm_notifier(&host->pm_notify);
 
 	return 0;
 }
@@ -154,7 +155,9 @@ EXPORT_SYMBOL(mmc_add_host);
  */
 void mmc_remove_host(struct mmc_host *host)
 {
-	unregister_pm_notifier(&host->pm_notify);
+	if (!(host->pm_flags & MMC_PM_IGNORE_PM_NOTIFY))
+		unregister_pm_notifier(&host->pm_notify);
+
 	mmc_stop_host(host);
 
 #ifdef CONFIG_DEBUG_FS
include/linux/mmc/pm.h +0 -0
index d37aac4..3903823 100644
@@ -26,5 +26,6 @@ typedef unsigned int mmc_pm_flag_t;
 
 #define MMC_PM_KEEP_POWER	(1 << 0)	/* preserve card power during 

suspend */
#define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO
IRQ assertion */
+#define MMC_PM_IGNORE_PM_NOTIFY (1 << 2) /* ignore mmc pm notify
*/

#endif

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

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

#3 lore raw
Quoted 6 lines · Dmitry Shmidt

Hi Nicolas,

Because for example some sdio device (like wlan) can be powered after suspend (we are not talking about desktop or laptop)
and be a source of wakeup. And we don't want to remove it every time we are going to suspend.

See MMC_PM_KEEP_POWER and MMC_PM_WAKE_SDIO_IRQ. That's exactly what they're for. The OLPC Git tree should contain example usage by the libertas driver.

Nicolas

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

#5 lore raw
Quoted 2 lines · Dmitry Shmidt

MMC_PM_KEEP_POWER is mostly related to mmc host controller - keeping or not keeping power on suspend/resume.

It is not "mostly related", it is _totally_ related and actually its purpose for existing.

Quoted 3 lines

MMC_PM_WAKE_SDIO_IRQ is not related to anything right now. Also in most of the cases sdio irq can not be a wake source of the application processor.

Why not? I know about at least 2 host controllers which can be configured so a transition on DAT3 would wake up the host.

Quoted 4 lines

Imagine your device is keeping connection during suspend. You got packet - wlan will wake application processor
through external irq line and linux starts resume. You can not find wlan card again - it is too slow.

What? I'm not following you anymore.

The Libertas firmware can be configured to filter incoming packets and only assert the IRQ signal only when a specific packet comes in, just like wake-on-LAN for Ethernet devices.

Quoted 2 lines

Again, for mmc card it totally makes sense - mmc card is NOT an active device.

But MMC cards still have operating states. You cannot simply write to them after a power disconnect, and leaving them powered on suspend is not very efficient either.

PS: common netiquette is not to top-post.

Nicolas

#6 lore raw
Quoted 7 lines · Nicolas Pitre
Quoted 2 lines · Dmitry Shmidt

MMC_PM_KEEP_POWER is mostly related to mmc host controller - keeping or not keeping power on suspend/resume.

It is not "mostly related", it is _totally_ related and actually its purpose for existing.

Sorry, I tried to be polite... :)

Quoted 7 lines
Quoted 4 lines

MMC_PM_WAKE_SDIO_IRQ is not related to anything right now. Also in most of the cases sdio irq can not be a wake source of the application processor.

Why not?  I know about at least 2 host controllers which can be configured so a transition on DAT3 would wake up the host.

Sorry, that I was not clear - wake source is not related to the topic.

Quoted 11 lines
Quoted 5 lines

Imagine your device is keeping connection during suspend. You got packet - wlan will wake application processor
through external irq line and linux starts resume. You can not find wlan card again - it is too slow.

What?  I'm not following you anymore.

The Libertas firmware can be configured to filter incoming packets and only assert the IRQ signal only when a specific packet comes in, just like wake-on-LAN for Ethernet devices.

This is not an issue of the ability to handle packets, but to handle them quickly.
This is important for VoIP for example. If you need to recognize device each time you are coming from suspend -
it is not a good idea sometimes.

Quoted 6 lines
Quoted 2 lines

Again, for mmc card it totally makes sense - mmc card is NOT an active device.

But MMC cards still have operating states.  You cannot simply write to them after a power disconnect, and leaving them powered on suspend is not very efficient either.

Agree 100%

Quoted 5 lines

PS: common netiquette is not to top-post.

Nicolas

Thanks,

Dmitry

#7 lore raw
Quoted 12 lines · Dmitry Shmidt
Quoted 10 lines · Nicolas Pitre
Quoted 4 lines

Imagine your device is keeping connection during suspend. You got packet - wlan will wake application processor
through external irq line and linux starts resume. You can not find wlan card again - it is too slow.

What?  I'm not following you anymore.

The Libertas firmware can be configured to filter incoming packets and only assert the IRQ signal only when a specific packet comes in, just like wake-on-LAN for Ethernet devices.

Quoted 5 lines

This is not an issue of the ability to handle packets, but to handle them quickly.
This is important for VoIP for example. If you need to recognize device each time you are coming from suspend -
it is not a good idea sometimes.

I simply don't see why you'd want to suspend while a VoIP session is active then. Those methods you want to inhibit are meant for long term deep suspending, not for inter-packet power saving during a call.

Nicolas

#8 lore raw
Quoted 20 lines · Nicolas Pitre
Quoted 12 lines · Dmitry Shmidt
Quoted 10 lines · Nicolas Pitre
Quoted 4 lines

Imagine your device is keeping connection during suspend. You got packet - wlan will wake application processor
through external irq line and linux starts resume. You can not find wlan card again - it is too slow.

What?  I'm not following you anymore.

The Libertas firmware can be configured to filter incoming packets and only assert the IRQ signal only when a specific packet comes in, just like wake-on-LAN for Ethernet devices.

Quoted 5 lines

This is not an issue of the ability to handle packets, but to handle them quickly.
This is important for VoIP for example. If you need to recognize device each time you are coming from suspend -
it is not a good idea sometimes.

Quoted 3 lines

I simply don't see why you'd want to suspend while a VoIP session is active then.  Those methods you want to inhibit are meant for long term deep suspending, not for inter-packet power saving during a call.

You are right - there are other ways to resolve some issues. I just wanted to add another option
that will be kernel-related and not application-related.

Quoted 3 lines

Nicolas

Dmitry

#9 lore raw
Quoted 21 lines · Dmitry Shmidt
Quoted 20 lines · Nicolas Pitre
Quoted 17 lines · Dmitry Shmidt
Quoted 10 lines · Nicolas Pitre
Quoted 4 lines

Imagine your device is keeping connection during suspend. You got packet - wlan will wake application processor
through external irq line and linux starts resume. You can not find wlan card again - it is too slow.

What?  I'm not following you anymore.

The Libertas firmware can be configured to filter incoming packets and only assert the IRQ signal only when a specific packet comes in, just like wake-on-LAN for Ethernet devices.

This is not an issue of the ability to handle packets, but to handle them quickly.
This is important for VoIP for example. If you need to recognize device each time you are coming from suspend -
it is not a good idea sometimes.

Quoted 7 lines
Quoted 3 lines

I simply don't see why you'd want to suspend while a VoIP session is active then.  Those methods you want to inhibit are meant for long term deep suspending, not for inter-packet power saving during a call.

You are right - there are other ways to resolve some issues. I just wanted to add another option
that will be kernel-related and not application-related.

Even for a kernel related solution, I don't think what you propose is the right thing to do.

Nicolas

#10 lore raw
Quoted 27 lines · Nicolas Pitre
Quoted 25 lines · Dmitry Shmidt
Quoted 23 lines · Nicolas Pitre
Quoted 12 lines · Dmitry Shmidt
Quoted 10 lines · Nicolas Pitre
Quoted 4 lines

Imagine your device is keeping connection during suspend. You got packet - wlan will wake application processor
through external irq line and linux starts resume. You can not find wlan card again - it is too slow.

What?  I'm not following you anymore.

The Libertas firmware can be configured to filter incoming packets and only assert the IRQ signal only when a specific packet comes in, just like wake-on-LAN for Ethernet devices.

Quoted 5 lines

This is not an issue of the ability to handle packets, but to handle them quickly.
This is important for VoIP for example. If you need to recognize device each time you are coming from suspend -
it is not a good idea sometimes.

I simply don't see why you'd want to suspend while a VoIP session is active then.  Those methods you want to inhibit are meant for long term deep suspending, not for inter-packet power saving during a call.

Quoted 6 lines
Quoted 3 lines

You are right - there are other ways to resolve some issues. I just wanted to add another option
that will be kernel-related and not application-related.

Even for a kernel related solution, I don't think what you propose is the right thing to do.

I am open for suggestions.

Quoted 3 lines

Nicolas

Thanks,
Dmitry

#11 lore raw
Quoted 28 lines · Dmitry Shmidt
Quoted 27 lines · Nicolas Pitre
Quoted 25 lines · Dmitry Shmidt
Quoted 23 lines · Nicolas Pitre
Quoted 12 lines · Dmitry Shmidt
Quoted 10 lines · Nicolas Pitre
Quoted 4 lines

Imagine your device is keeping connection during suspend. You got packet - wlan will wake application processor
through external irq line and linux starts resume. You can not find wlan card again - it is too slow.

What?  I'm not following you anymore.

The Libertas firmware can be configured to filter incoming packets and only assert the IRQ signal only when a specific packet comes in, just like wake-on-LAN for Ethernet devices.

Quoted 5 lines

This is not an issue of the ability to handle packets, but to handle them quickly.
This is important for VoIP for example. If you need to recognize device each time you are coming from suspend -
it is not a good idea sometimes.

I simply don't see why you'd want to suspend while a VoIP session is active then.  Those methods you want to inhibit are meant for long term deep suspending, not for inter-packet power saving during a call.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

You are right - there are other ways to resolve some issues. I just wanted to add another option
that will be kernel-related and not application-related.

Even for a kernel related solution, I don't think what you propose is the right thing to do.

I am open for suggestions.

Please tell us more about the problem you are trying to solve, and in what ways the current infrastructure is not achieving that goal. Then we might be in a better position to propose suggestions.

But selectively ignoring upper suspend requests certainly feels wrong to me. If you need this, then the actual problem must be somewhere else.

Nicolas

#12 lore raw
Quoted 8 lines

Please tell us more about the problem you are trying to solve, and in what ways the current infrastructure is not achieving that goal.  Then we might be in a better position to propose suggestions.

But selectively ignoring upper suspend requests certainly feels wrong to me.  If you need this, then the actual problem must be somewhere else.

Nicolas

Let's assume we are talking about device that is not a laptop - and it is very power-consumption sensitive. Like smartphone...
So you want to go to suspend very aggressively.
And you want to keep connectivity. And you want to resume quickly - else it is very easy to be in the situation where
you just suspending and resuming all the time.
So it doesn't make sense on every suspend/resume rescan for alive sdio card. Makes sense ?
Thanks,

Dmitry

#13 lore raw
Quoted 9 lines · Dmitry Shmidt
Quoted 8 lines

Please tell us more about the problem you are trying to solve, and in what ways the current infrastructure is not achieving that goal.  Then we might be in a better position to propose suggestions.

But selectively ignoring upper suspend requests certainly feels wrong to me.  If you need this, then the actual problem must be somewhere else.

Nicolas

Quoted 8 lines

Let's assume we are talking about device that is not a laptop - and it is very power-consumption sensitive. Like smartphone...
So you want to go to suspend very aggressively.
And you want to keep connectivity. And you want to resume quickly - else it is very easy to be in the situation where
you just suspending and resuming all the time.
So it doesn't make sense on every suspend/resume rescan for alive sdio card. Makes sense ?

Yes, but in this case the suspend methods are inappropriate when the phone is in live usage. They are meant to be used, say, when the phone becomes unused and its flap is folded. Otherwise, what is supposed to happen when you actually want the SDIO card to be suspended if the suspend method is cut out?

Nicolas

#14 lore raw
Quoted 20 lines · Nicolas Pitre
Quoted 9 lines · Dmitry Shmidt
Quoted 8 lines

Please tell us more about the problem you are trying to solve, and in what ways the current infrastructure is not achieving that goal.  Then we might be in a better position to propose suggestions.

But selectively ignoring upper suspend requests certainly feels wrong to me.  If you need this, then the actual problem must be somewhere else.

Nicolas

Quoted 8 lines

Let's assume we are talking about device that is not a laptop - and it is very power-consumption sensitive. Like smartphone...
So you want to go to suspend very aggressively.
And you want to keep connectivity. And you want to resume quickly - else it is very easy to be in the situation where
you just suspending and resuming all the time.
So it doesn't make sense on every suspend/resume rescan for alive sdio card. Makes sense ?

Quoted 9 lines

Yes, but in this case the suspend methods are inappropriate when the phone is in live usage.  They are meant to be used, say, when the phone becomes unused and its flap is folded.  Otherwise, what is supposed to happen when you actually want the SDIO card to be suspended if the suspend method is cut out?

Nicolas

"Flap is folded"... It is not the case for usual smartphones anymore. :) Simple scenario - you are siting in chat, wait like 15 sec and your screen goes Off, after another 5 sec kernel gets suspend command and tries to suspend. And you are getting new message - you want to resume quickly and process this packet with no delay.
Maybe what I am describing seems weird, but phone developers are fighting for every mA.
And mmc card resume if usually deferred - to reduce tiem and save power, but this is a different issue.

Dmitry

#15 lore raw
Quoted 16 lines · Dmitry Shmidt
Quoted 9 lines · Nicolas Pitre
Quoted 6 lines · Dmitry Shmidt

So you want to go to suspend very aggressively.
And you want to keep connectivity. And you want to resume quickly - else it is very easy to be in the situation where
you just suspending and resuming all the time.
So it doesn't make sense on every suspend/resume rescan for alive sdio card. Makes sense ?

Quoted 5 lines

Yes, but in this case the suspend methods are inappropriate when the phone is in live usage.  They are meant to be used, say, when the phone becomes unused and its flap is folded.  Otherwise, what is supposed to happen when you actually want the SDIO card to be suspended if the suspend method is cut out?

Quoted 5 lines

"Flap is folded"... It is not the case for usual smartphones anymore. :) Simple scenario - you are siting in chat, wait like 15 sec and your screen goes Off, after another 5 sec kernel gets suspend command and tries to suspend. And you are getting new message - you want to resume quickly and process this packet with no delay.

OK... and how do you want to achieve that?

Why isn't MMC_PM_KEEP_POWER suitable for this?

Quoted 2 lines

Maybe what I am describing seems weird, but phone developers are fighting for every mA.

How can you save power when the WIFI interface is not in use if you disabled the suspend method with your patch?

Quoted 2 lines

And mmc card resume if usually deferred - to reduce tiem and save power, but this is a different issue.

How much time are we talking about?

Nicolas

#16 lore raw
Quoted 12 lines · Nicolas Pitre
Quoted 11 lines
Quoted 5 lines

Yes, but in this case the suspend methods are inappropriate when the phone is in live usage.  They are meant to be used, say, when the phone becomes unused and its flap is folded.  Otherwise, what is supposed to happen when you actually want the SDIO card to be suspended if the suspend method is cut out?

"Flap is folded"... It is not the case for usual smartphones anymore. :) Simple scenario - you are siting in chat, wait like 15 sec and your screen goes Off, after another 5 sec kernel gets suspend command and tries to suspend. And you are getting new message - you want to resume quickly and process this packet with no delay.

Quoted 3 lines

OK... and how do you want to achieve that?

Why isn't MMC_PM_KEEP_POWER suitable for this?

It just allows to keep power for SDC controller. It doesn't change suspend/resume behavior from SDIO device
perspective.

Quoted 6 lines
Quoted 3 lines

Maybe what I am describing seems weird, but phone developers are fighting for every mA.

How can you save power when the WIFI interface is not in use if you disabled the suspend method with your patch?

You see, we are not talking about wlan chip power. CPU is consuming in average more energy, so
we are talking about overall savings or consumption and not specifically wlan. I mean, definitely
turn off SDC controller and remove device will save power, BUT we will spend much more time on resume
meaning - more power for CPU...

Quoted 5 lines
Quoted 3 lines

And mmc card resume if usually deferred - to reduce tiem and save power, but this is a different issue.

How much time are we talking about?

The best thing is to defer resume till it will be needed.

Quoted 3 lines

Nicolas

Dmitry

#17 lore raw
Quoted 13 lines · Dmitry Shmidt
Quoted 12 lines · Nicolas Pitre
Quoted 11 lines
Quoted 5 lines

Yes, but in this case the suspend methods are inappropriate when the phone is in live usage.  They are meant to be used, say, when the phone becomes unused and its flap is folded.  Otherwise, what is supposed to happen when you actually want the SDIO card to be suspended if the suspend method is cut out?

"Flap is folded"... It is not the case for usual smartphones anymore. :) Simple scenario - you are siting in chat, wait like 15 sec and your screen goes Off, after another 5 sec kernel gets suspend command and tries to suspend. And you are getting new message - you want to resume quickly and process this packet with no delay.

Quoted 6 lines
Quoted 3 lines

OK... and how do you want to achieve that?

Why isn't MMC_PM_KEEP_POWER suitable for this?

It just allows to keep power for SDC controller. It doesn't change suspend/resume behavior from SDIO device
perspective.

I think you misunderstood the purpose of MMC_PM_KEEP_POWER.

Let's assume the context of a WIFI card. There are cases when you want the WIFI card to be suspended, and some other cases you want it to remain alive when the host CPU does suspend itself. So the decision has to come from the WIFI driver not from the host controller as this is where the information about the device usage is. And that's exactly what MMC_PM_KEEP_POWER is about. When the WIFI driver receives a suspend request, it can set that flag to tell the rest of the stack that it wants to remain alive regardless of what the rest of the system does to go to sleep. Then the firmware on the WIFI card can be notified of that state and go on with its business until it decides it has data for which the host CPU should pay attention. Then the host resumes itself as usual, except for the WIFI driver which simply has to continue operating the card without having to go through reconfiguration, firmware loading, and so on.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

Maybe what I am describing seems weird, but phone developers are fighting for every mA.

How can you save power when the WIFI interface is not in use if you disabled the suspend method with your patch?

Quoted 7 lines

You see, we are not talking about wlan chip power. CPU is consuming in average more energy, so
we are talking about overall savings or consumption and not specifically wlan. I mean, definitely
turn off SDC controller and remove device will save power, BUT we will spend much more time on resume
meaning - more power for CPU...

I still disagree with your patch. If you want to turn the CPU off and not the peripherals then this is more about some idle state than suspend state. Or at least that's how you should conceptualize it.

If some peripherals are not in use, they should always be powered off anyway, whether or not the CPU is suspended.

But disabling suspend methods like your patch does is fundamentally the wrong approach.

Nicolas

#18 lore raw
Quoted 24 lines · Nicolas Pitre
Quoted 13 lines · Dmitry Shmidt
Quoted 12 lines · Nicolas Pitre
Quoted 11 lines
Quoted 5 lines

Yes, but in this case the suspend methods are inappropriate when the phone is in live usage.  They are meant to be used, say, when the phone becomes unused and its flap is folded.  Otherwise, what is supposed to happen when you actually want the SDIO card to be suspended if the suspend method is cut out?

"Flap is folded"... It is not the case for usual smartphones anymore. :) Simple scenario - you are siting in chat, wait like 15 sec and your screen goes Off, after another 5 sec kernel gets suspend command and tries to suspend. And you are getting new message - you want to resume quickly and process this packet with no delay.

Quoted 6 lines
Quoted 3 lines

OK... and how do you want to achieve that?

Why isn't MMC_PM_KEEP_POWER suitable for this?

It just allows to keep power for SDC controller. It doesn't change suspend/resume behavior from SDIO device
perspective.

I think you misunderstood the purpose of MMC_PM_KEEP_POWER.

Quoted 14 lines

Let's assume the context of a WIFI card.  There are cases when you want the WIFI card to be suspended, and some other cases you want it to remain alive when the host CPU does suspend itself.  So the decision has to come from the WIFI driver not from the host controller as this is where the information about the device usage is.  And that's exactly what MMC_PM_KEEP_POWER is about.  When the WIFI driver receives a suspend request, it can set that flag to tell the rest of the stack that it wants to remain alive regardless of what the rest of the system does to go to sleep.  Then the firmware on the WIFI card can be notified of that state and go on with its business until it decides it has data for which the host CPU should pay attention.  Then the host resumes itself as usual, except for the WIFI driver which simply has to continue operating the card without having to go through reconfiguration, firmware loading, and so on.

Everything is correct but I also want to skip sdio device reinitialization from SDIO stack perspective.

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Maybe what I am describing seems weird, but phone developers are fighting for every mA.

How can you save power when the WIFI interface is not in use if you disabled the suspend method with your patch?

Quoted 7 lines

You see, we are not talking about wlan chip power. CPU is consuming in average more energy, so
we are talking about overall savings or consumption and not specifically wlan. I mean, definitely
turn off SDC controller and remove device will save power, BUT we will spend much more time on resume
meaning - more power for CPU...

Quoted 6 lines

I still disagree with your patch.  If you want to turn the CPU off and not the peripherals then this is more about some idle state than suspend state.  Or at least that's how you should conceptualize it.

If some peripherals are not in use, they should always be powered off anyway, whether or not the CPU is suspended.

Agree 100% but this is not the case.

Quoted 2 lines

But disabling suspend methods like your patch does is fundamentally the wrong approach.

Again, I am open for reasonable suggestions.

Quoted 2 lines

Nicolas

Dmitry

#19 lore raw
Quoted 40 lines · Dmitry Shmidt
Quoted 24 lines · Nicolas Pitre
Quoted 13 lines · Dmitry Shmidt
Quoted 12 lines · Nicolas Pitre
Quoted 11 lines
Quoted 5 lines

Yes, but in this case the suspend methods are inappropriate when the phone is in live usage.  They are meant to be used, say, when the phone becomes unused and its flap is folded.  Otherwise, what is supposed to happen when you actually want the SDIO card to be suspended if the suspend method is cut out?

"Flap is folded"... It is not the case for usual smartphones anymore. :) Simple scenario - you are siting in chat, wait like 15 sec and your screen goes Off, after another 5 sec kernel gets suspend command and tries to suspend. And you are getting new message - you want to resume quickly and process this packet with no delay.

Quoted 6 lines
Quoted 3 lines

OK... and how do you want to achieve that?

Why isn't MMC_PM_KEEP_POWER suitable for this?

It just allows to keep power for SDC controller. It doesn't change suspend/resume behavior from SDIO device
perspective.

I think you misunderstood the purpose of MMC_PM_KEEP_POWER.

Quoted 14 lines

Let's assume the context of a WIFI card.  There are cases when you want the WIFI card to be suspended, and some other cases you want it to remain alive when the host CPU does suspend itself.  So the decision has to come from the WIFI driver not from the host controller as this is where the information about the device usage is.  And that's exactly what MMC_PM_KEEP_POWER is about.  When the WIFI driver receives a suspend request, it can set that flag to tell the rest of the stack that it wants to remain alive regardless of what the rest of the system does to go to sleep.  Then the firmware on the WIFI card can be notified of that state and go on with its business until it decides it has data for which the host CPU should pay attention.  Then the host resumes itself as usual, except for the WIFI driver which simply has to continue operating the card without having to go through reconfiguration, firmware loading, and so on.

Quoted 2 lines

Everything is correct but I also want to skip sdio device reinitialization from SDIO stack perspective.

It is already skipped. See mmc_sdio_init_card() and notice the powered_resume argument which avoids all the costly initializations.

Quoted 4 lines
Quoted 2 lines

But disabling suspend methods like your patch does is fundamentally the wrong approach.

Again, I am open for reasonable suggestions.

It is unreasonable to suspend and resume the system so frequently that the cost of the SDIO powered suspend/resume code becomes measurable. So if you are seeing significant costs associated to suspend/resume, then this is a sign that you probably are misusing it and should not have invoked a suspend at all in the first place. Maybe you should investigate the CPU idle infrastructure instead.

But inhibiting the suspend method like this with a flag looks much more like a dirty hack.

Nicolas