diff options
author | Tony Lindgren <tony@atomide.com> | 2018-11-15 18:59:39 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-11-15 19:20:43 -0500 |
commit | 91b9deefedf4c35a01027ce38bed7299605026a3 (patch) | |
tree | 31a02f2f0e9eaeb33499181f23c5110e5a334540 /drivers/spi/spi-omap2-mcspi.c | |
parent | a4d8f64f7267a88d4688f5c216926f5f6cafbae6 (diff) |
spi: omap2-mcspi: Add missing suspend and resume calls
I've been wondering still about omap2-mcspi related suspend and resume
flakeyness and looks like we're missing calls to spi_master_suspend()
and spi_master_resume(). Adding those and using pm_runtime_force_suspend()
and pm_runtime_force_resume() makes things work for suspend and resume
and allows us to stop using noirq suspend and resume.
And while at it, let's use SET_SYSTEM_SLEEP_PM_OPS to simplify things
further.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-omap2-mcspi.c')
-rw-r--r-- | drivers/spi/spi-omap2-mcspi.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index f024c3fc3679..2fd8881fcd65 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c | |||
@@ -1540,13 +1540,26 @@ static int omap2_mcspi_remove(struct platform_device *pdev) | |||
1540 | /* work with hotplug and coldplug */ | 1540 | /* work with hotplug and coldplug */ |
1541 | MODULE_ALIAS("platform:omap2_mcspi"); | 1541 | MODULE_ALIAS("platform:omap2_mcspi"); |
1542 | 1542 | ||
1543 | #ifdef CONFIG_SUSPEND | 1543 | static int __maybe_unused omap2_mcspi_suspend(struct device *dev) |
1544 | static int omap2_mcspi_suspend_noirq(struct device *dev) | ||
1545 | { | 1544 | { |
1546 | return pinctrl_pm_select_sleep_state(dev); | 1545 | struct spi_master *master = dev_get_drvdata(dev); |
1546 | struct omap2_mcspi *mcspi = spi_master_get_devdata(master); | ||
1547 | int error; | ||
1548 | |||
1549 | error = pinctrl_pm_select_sleep_state(dev); | ||
1550 | if (error) | ||
1551 | dev_warn(mcspi->dev, "%s: failed to set pins: %i\n", | ||
1552 | __func__, error); | ||
1553 | |||
1554 | error = spi_master_suspend(master); | ||
1555 | if (error) | ||
1556 | dev_warn(mcspi->dev, "%s: master suspend failed: %i\n", | ||
1557 | __func__, error); | ||
1558 | |||
1559 | return pm_runtime_force_suspend(dev); | ||
1547 | } | 1560 | } |
1548 | 1561 | ||
1549 | static int omap2_mcspi_resume_noirq(struct device *dev) | 1562 | static int __maybe_unused omap2_mcspi_resume(struct device *dev) |
1550 | { | 1563 | { |
1551 | struct spi_master *master = dev_get_drvdata(dev); | 1564 | struct spi_master *master = dev_get_drvdata(dev); |
1552 | struct omap2_mcspi *mcspi = spi_master_get_devdata(master); | 1565 | struct omap2_mcspi *mcspi = spi_master_get_devdata(master); |
@@ -1557,17 +1570,17 @@ static int omap2_mcspi_resume_noirq(struct device *dev) | |||
1557 | dev_warn(mcspi->dev, "%s: failed to set pins: %i\n", | 1570 | dev_warn(mcspi->dev, "%s: failed to set pins: %i\n", |
1558 | __func__, error); | 1571 | __func__, error); |
1559 | 1572 | ||
1560 | return 0; | 1573 | error = spi_master_resume(master); |
1561 | } | 1574 | if (error) |
1575 | dev_warn(mcspi->dev, "%s: master resume failed: %i\n", | ||
1576 | __func__, error); | ||
1562 | 1577 | ||
1563 | #else | 1578 | return pm_runtime_force_resume(dev); |
1564 | #define omap2_mcspi_suspend_noirq NULL | 1579 | } |
1565 | #define omap2_mcspi_resume_noirq NULL | ||
1566 | #endif | ||
1567 | 1580 | ||
1568 | static const struct dev_pm_ops omap2_mcspi_pm_ops = { | 1581 | static const struct dev_pm_ops omap2_mcspi_pm_ops = { |
1569 | .suspend_noirq = omap2_mcspi_suspend_noirq, | 1582 | SET_SYSTEM_SLEEP_PM_OPS(omap2_mcspi_suspend, |
1570 | .resume_noirq = omap2_mcspi_resume_noirq, | 1583 | omap2_mcspi_resume) |
1571 | .runtime_resume = omap_mcspi_runtime_resume, | 1584 | .runtime_resume = omap_mcspi_runtime_resume, |
1572 | }; | 1585 | }; |
1573 | 1586 | ||