* [PATCH] mmc: atmel-mci: adopt pinctrl support
@ 2014-11-06 8:52 Wenyou Yang
2014-11-06 9:41 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Wenyou Yang @ 2014-11-06 8:52 UTC (permalink / raw)
To: linux-arm-kernel
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>
---
drivers/mmc/host/atmel-mci.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 4df1599..eb4bfbc 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -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>
@@ -2385,6 +2386,8 @@ static int __init atmci_probe(struct platform_device *pdev)
int irq;
int ret, i;
+ pinctrl_pm_select_default_state(&pdev->dev);
+
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!regs)
return -ENXIO;
@@ -2568,6 +2571,8 @@ static int atmci_runtime_suspend(struct device *dev)
clk_disable_unprepare(host->mck);
+ pinctrl_pm_select_sleep_state(dev);
+
return 0;
}
@@ -2575,6 +2580,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
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] mmc: atmel-mci: adopt pinctrl support
2014-11-06 8:52 [PATCH] mmc: atmel-mci: adopt pinctrl support Wenyou Yang
@ 2014-11-06 9:41 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2014-11-06 9:41 UTC (permalink / raw)
To: linux-arm-kernel
On 6 November 2014 09:52, Wenyou Yang <wenyou.yang@atmel.com> wrote:
> 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>
> ---
> drivers/mmc/host/atmel-mci.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 4df1599..eb4bfbc 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -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>
> @@ -2385,6 +2386,8 @@ static int __init atmci_probe(struct platform_device *pdev)
> int irq;
> int ret, i;
>
> + pinctrl_pm_select_default_state(&pdev->dev);
Not needed, it's already taken care of from driver core.
> +
> regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!regs)
> return -ENXIO;
> @@ -2568,6 +2571,8 @@ static int atmci_runtime_suspend(struct device *dev)
>
> clk_disable_unprepare(host->mck);
>
> + pinctrl_pm_select_sleep_state(dev);
> +
> return 0;
> }
>
> @@ -2575,6 +2580,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
> --
> 1.7.9.5
>
Kind regards
Uffe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-06 9:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-06 8:52 [PATCH] mmc: atmel-mci: adopt pinctrl support Wenyou Yang
2014-11-06 9:41 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).