mmc: atmel-mci: adopt pinctrl support
authorWenyou Yang <wenyou.yang@atmel.com>
Fri, 7 Nov 2014 00:48:13 +0000 (08:48 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 26 Nov 2014 13:30:52 +0000 (14:30 +0100)
Amend the atmel mci pin controller to optionally take a pin control
handle and set the state of the pins to:
- "default" on boot, resume and before performing an transfer.
- "sleep" on suspend().

This should make it possible to optimize energy usage for the pins
both for the suspend/resume cycle.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/atmel-mci.c

index 4df1599583f8bd1ad375d5e0cc54076065c6e5b5..a7b59ba399a15947e04dd50941a069e5ac4d2433 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/atmel_pdc.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <asm/cacheflush.h>
 #include <asm/io.h>
@@ -2568,6 +2569,8 @@ static int atmci_runtime_suspend(struct device *dev)
 
        clk_disable_unprepare(host->mck);
 
+       pinctrl_pm_select_sleep_state(dev);
+
        return 0;
 }
 
@@ -2575,6 +2578,8 @@ static int atmci_runtime_resume(struct device *dev)
 {
        struct atmel_mci *host = dev_get_drvdata(dev);
 
+       pinctrl_pm_select_default_state(dev);
+
        return clk_prepare_enable(host->mck);
 }
 #endif