diff options
author | Pascal Huerst <pascal.huerst@gmail.com> | 2015-11-19 10:18:28 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-11-19 12:48:52 -0500 |
commit | beca365565d8f8912dce67567f54ad4c71734843 (patch) | |
tree | 35c602172af9af5ae80cbef37d6e6f9a347b7efb | |
parent | 8005c49d9aea74d382f474ce11afbbc7d7130bec (diff) |
spi: omap2-mcspi: Add calls for pinctrl state select
This adds calls to pinctrl subsystem in order to switch pin states
on suspend/resume if you provide a "sleep" state in DT.
If no "sleep" state is provided in DT, these calls turn
to NOPs.
Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/spi/spi-omap2-mcspi.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 1f8903d356e5..02aa1d0607b3 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/dma-mapping.h> | 24 | #include <linux/dma-mapping.h> |
25 | #include <linux/dmaengine.h> | 25 | #include <linux/dmaengine.h> |
26 | #include <linux/omap-dma.h> | 26 | #include <linux/omap-dma.h> |
27 | #include <linux/pinctrl/consumer.h> | ||
27 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
28 | #include <linux/err.h> | 29 | #include <linux/err.h> |
29 | #include <linux/clk.h> | 30 | #include <linux/clk.h> |
@@ -1536,14 +1537,23 @@ static int omap2_mcspi_resume(struct device *dev) | |||
1536 | } | 1537 | } |
1537 | pm_runtime_mark_last_busy(mcspi->dev); | 1538 | pm_runtime_mark_last_busy(mcspi->dev); |
1538 | pm_runtime_put_autosuspend(mcspi->dev); | 1539 | pm_runtime_put_autosuspend(mcspi->dev); |
1539 | return 0; | 1540 | |
1541 | return pinctrl_pm_select_default_state(dev); | ||
1542 | } | ||
1543 | |||
1544 | static int omap2_mcspi_suspend(struct device *dev) | ||
1545 | { | ||
1546 | return pinctrl_pm_select_sleep_state(dev); | ||
1540 | } | 1547 | } |
1548 | |||
1541 | #else | 1549 | #else |
1550 | #define omap2_mcspi_suspend NULL | ||
1542 | #define omap2_mcspi_resume NULL | 1551 | #define omap2_mcspi_resume NULL |
1543 | #endif | 1552 | #endif |
1544 | 1553 | ||
1545 | static const struct dev_pm_ops omap2_mcspi_pm_ops = { | 1554 | static const struct dev_pm_ops omap2_mcspi_pm_ops = { |
1546 | .resume = omap2_mcspi_resume, | 1555 | .resume = omap2_mcspi_resume, |
1556 | .suspend = omap2_mcspi_suspend, | ||
1547 | .runtime_resume = omap_mcspi_runtime_resume, | 1557 | .runtime_resume = omap_mcspi_runtime_resume, |
1548 | }; | 1558 | }; |
1549 | 1559 | ||