]> git.ipfire.org Git - thirdparty/kernel/linux.git/blobdiff - drivers/mmc/core/sdio_io.c
mmc: core: Add sdio_retune_hold_now() and sdio_retune_release()
[thirdparty/kernel/linux.git] / drivers / mmc / core / sdio_io.c
index 0acb1a29c968e40c0e73f6186597e4a03e15eb4f..2ba00acf64e6421152b54ac226b13b72dae14d2e 100644 (file)
@@ -15,6 +15,7 @@
 #include "sdio_ops.h"
 #include "core.h"
 #include "card.h"
+#include "host.h"
 
 /**
  *     sdio_claim_host - exclusively claim a bus for a certain SDIO function
@@ -771,3 +772,42 @@ void sdio_retune_crc_enable(struct sdio_func *func)
        func->card->host->retune_crc_disable = false;
 }
 EXPORT_SYMBOL_GPL(sdio_retune_crc_enable);
+
+/**
+ *     sdio_retune_hold_now - start deferring retuning requests till release
+ *     @func: SDIO function attached to host
+ *
+ *     This function can be called if it's currently a bad time to do
+ *     a retune of the SDIO card.  Retune requests made during this time
+ *     will be held and we'll actually do the retune sometime after the
+ *     release.
+ *
+ *     This function could be useful if an SDIO card is in a power state
+ *     where it can respond to a small subset of commands that doesn't
+ *     include the retuning command.  Care should be taken when using
+ *     this function since (presumably) the retuning request we might be
+ *     deferring was made for a good reason.
+ *
+ *     This function should be called while the host is claimed.
+ */
+void sdio_retune_hold_now(struct sdio_func *func)
+{
+       mmc_retune_hold_now(func->card->host);
+}
+EXPORT_SYMBOL_GPL(sdio_retune_hold_now);
+
+/**
+ *     sdio_retune_release - signal that it's OK to retune now
+ *     @func: SDIO function attached to host
+ *
+ *     This is the complement to sdio_retune_hold_now().  Calling this
+ *     function won't make a retune happen right away but will allow
+ *     them to be scheduled normally.
+ *
+ *     This function should be called while the host is claimed.
+ */
+void sdio_retune_release(struct sdio_func *func)
+{
+       mmc_retune_release(func->card->host);
+}
+EXPORT_SYMBOL_GPL(sdio_retune_release);