[RFC] improve the SDHCI wakeup support.

Giuseppe CAVALLARO
2010-11-10T15:28:22Z

Hello.

The following patches, currently built against an ST Kernel
"2.6.32", show how to improve the wakeup support in the SDHCI
device driver.

Note:
I'm going to rework them, for example, against the mmc-next
after performing the review process and, obviously, if you
think that they can be actually useful.

Indeed, on a STB, it can be nice to have the capability to
wake-up the system when a card is inserted ;-).

This work allows the SDHCI to wake up the system
on the following events:
1) Card Interrupts.
2) Card Insertion.
3) Card Removal.

To do that the sdhci has to perform some operations
described in the patch named:
"mmc_sdhci: improve the wake-up support"

A new parameter has been also added to select which wakeup
event has to be used. At any rate, a device based on
the sdchi, e.g. sdhci-pci, can use a default mode (that
can be modified at run-time as well).
In case of the sdhci-pci the "Card Interrupt event" has not
been modified according to the logic behind the recent commit:
5f619704d18b93869d045abc49e09cdba109b04b

The define MMC_PM_KEEP_POWER has been used to notify that
a device driver (e.g. sdhci-pltfm) want to wakeup the system.
In any case, the logic for programming the HC register is
embedded in the suspend and it's self contained.

To modify at run time the wakeup event we can do:
$ echo X > /sys/module/sdhci/parameters/wakeup
where X can be:
0: no wakeup
1: Card Interrupts
2: Card Insertion
3: Card Removal

Hmm, maybe it's worth having more parameters instead of the
wakeup. I mean, something like this (welcome feedback):
wake_on_card_int
wake_on_card_ins
wake_on_card_rem

Welcome advice and feedback as usual.

Regards
Giuseppe