diff options
Diffstat (limited to 'drivers/mmc/core/sdio_io.c')
-rw-r--r-- | drivers/mmc/core/sdio_io.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c index 87c618904ee2..ff27c8c71355 100644 --- a/drivers/mmc/core/sdio_io.c +++ b/drivers/mmc/core/sdio_io.c | |||
@@ -640,3 +640,52 @@ void sdio_f0_writeb(struct sdio_func *func, unsigned char b, unsigned int addr, | |||
640 | *err_ret = ret; | 640 | *err_ret = ret; |
641 | } | 641 | } |
642 | EXPORT_SYMBOL_GPL(sdio_f0_writeb); | 642 | EXPORT_SYMBOL_GPL(sdio_f0_writeb); |
643 | |||
644 | /** | ||
645 | * sdio_get_host_pm_caps - get host power management capabilities | ||
646 | * @func: SDIO function attached to host | ||
647 | * | ||
648 | * Returns a capability bitmask corresponding to power management | ||
649 | * features supported by the host controller that the card function | ||
650 | * might rely upon during a system suspend. The host doesn't need | ||
651 | * to be claimed, nor the function active, for this information to be | ||
652 | * obtained. | ||
653 | */ | ||
654 | mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func) | ||
655 | { | ||
656 | BUG_ON(!func); | ||
657 | BUG_ON(!func->card); | ||
658 | |||
659 | return func->card->host->pm_caps; | ||
660 | } | ||
661 | EXPORT_SYMBOL_GPL(sdio_get_host_pm_caps); | ||
662 | |||
663 | /** | ||
664 | * sdio_set_host_pm_flags - set wanted host power management capabilities | ||
665 | * @func: SDIO function attached to host | ||
666 | * | ||
667 | * Set a capability bitmask corresponding to wanted host controller | ||
668 | * power management features for the upcoming suspend state. | ||
669 | * This must be called, if needed, each time the suspend method of | ||
670 | * the function driver is called, and must contain only bits that | ||
671 | * were returned by sdio_get_host_pm_caps(). | ||
672 | * The host doesn't need to be claimed, nor the function active, | ||
673 | * for this information to be set. | ||
674 | */ | ||
675 | int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags) | ||
676 | { | ||
677 | struct mmc_host *host; | ||
678 | |||
679 | BUG_ON(!func); | ||
680 | BUG_ON(!func->card); | ||
681 | |||
682 | host = func->card->host; | ||
683 | |||
684 | if (flags & ~host->pm_caps) | ||
685 | return -EINVAL; | ||
686 | |||
687 | /* function suspend methods are serialized, hence no lock needed */ | ||
688 | host->pm_flags |= flags; | ||
689 | return 0; | ||
690 | } | ||
691 | EXPORT_SYMBOL_GPL(sdio_set_host_pm_flags); | ||