@@ -1527,6 +1527,12 @@ static int mmci_probe(struct amba_device *dev,
} else
dev_warn(&dev->dev, "could not get default pinstate\n");
+ /* fetch optional sleep state of pins */
+ host->pins_sleep = pinctrl_lookup_state(host->pinctrl,
+ PINCTRL_STATE_SLEEP);
+ if (IS_ERR(host->pins_sleep))
+ dev_dbg(&dev->dev, "could not get sleep pinstate\n");
+
/* Get regulators and the supported OCR mask */
mmc_regulator_get_supply(mmc);
if (!mmc->ocr_avail)
@@ -1767,6 +1773,11 @@ static int mmci_runtime_suspend(struct device *dev)
if (mmc) {
struct mmci_host *host = mmc_priv(mmc);
+
+ /* Optionally let pins go into sleep state */
+ if (!IS_ERR(host->pins_sleep))
+ pinctrl_select_state(host->pinctrl, host->pins_sleep);
+
clk_disable_unprepare(host->clk);
}
@@ -1780,7 +1791,12 @@ static int mmci_runtime_resume(struct device *dev)
if (mmc) {
struct mmci_host *host = mmc_priv(mmc);
+
clk_prepare_enable(host->clk);
+
+ /* Optionally enable pins to be muxed in and configured */
+ if (!IS_ERR(host->pins_default))
+ pinctrl_select_state(host->pinctrl, host->pins_default);
}
return 0;
@@ -203,6 +203,7 @@ struct mmci_host {
/* pinctrl handles */
struct pinctrl *pinctrl;
struct pinctrl_state *pins_default;
+ struct pinctrl_state *pins_sleep;
#ifdef CONFIG_DMA_ENGINE
/* DMA stuff */