Commit 91b9deef authored by Tony Lindgren's avatar Tony Lindgren Committed by Mark Brown

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: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent a4d8f64f
...@@ -1540,13 +1540,26 @@ static int omap2_mcspi_remove(struct platform_device *pdev) ...@@ -1540,13 +1540,26 @@ static int omap2_mcspi_remove(struct platform_device *pdev)
/* work with hotplug and coldplug */ /* work with hotplug and coldplug */
MODULE_ALIAS("platform:omap2_mcspi"); MODULE_ALIAS("platform:omap2_mcspi");
#ifdef CONFIG_SUSPEND static int __maybe_unused omap2_mcspi_suspend(struct device *dev)
static int omap2_mcspi_suspend_noirq(struct device *dev)
{ {
return pinctrl_pm_select_sleep_state(dev); struct spi_master *master = dev_get_drvdata(dev);
struct omap2_mcspi *mcspi = spi_master_get_devdata(master);
int error;
error = pinctrl_pm_select_sleep_state(dev);
if (error)
dev_warn(mcspi->dev, "%s: failed to set pins: %i\n",
__func__, error);
error = spi_master_suspend(master);
if (error)
dev_warn(mcspi->dev, "%s: master suspend failed: %i\n",
__func__, error);
return pm_runtime_force_suspend(dev);
} }
static int omap2_mcspi_resume_noirq(struct device *dev) static int __maybe_unused omap2_mcspi_resume(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_master *master = dev_get_drvdata(dev);
struct omap2_mcspi *mcspi = spi_master_get_devdata(master); struct omap2_mcspi *mcspi = spi_master_get_devdata(master);
...@@ -1557,17 +1570,17 @@ static int omap2_mcspi_resume_noirq(struct device *dev) ...@@ -1557,17 +1570,17 @@ static int omap2_mcspi_resume_noirq(struct device *dev)
dev_warn(mcspi->dev, "%s: failed to set pins: %i\n", dev_warn(mcspi->dev, "%s: failed to set pins: %i\n",
__func__, error); __func__, error);
return 0; error = spi_master_resume(master);
} if (error)
dev_warn(mcspi->dev, "%s: master resume failed: %i\n",
__func__, error);
#else return pm_runtime_force_resume(dev);
#define omap2_mcspi_suspend_noirq NULL }
#define omap2_mcspi_resume_noirq NULL
#endif
static const struct dev_pm_ops omap2_mcspi_pm_ops = { static const struct dev_pm_ops omap2_mcspi_pm_ops = {
.suspend_noirq = omap2_mcspi_suspend_noirq, SET_SYSTEM_SLEEP_PM_OPS(omap2_mcspi_suspend,
.resume_noirq = omap2_mcspi_resume_noirq, omap2_mcspi_resume)
.runtime_resume = omap_mcspi_runtime_resume, .runtime_resume = omap_mcspi_runtime_resume,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment