diff options
author | Sebastian Reichel <sre@kernel.org> | 2015-07-22 14:46:09 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-07-24 12:40:40 -0400 |
commit | 5f74db105b1c0980c9863e7a7d1bc0525e0316e8 (patch) | |
tree | 7aba2e3f7e4ebd68cbd0269be0ae738e039b9a74 | |
parent | bc0195aad0daa2ad5b0d76cce22b167bc3435590 (diff) |
spi: omap2-mcspi: add runtime PM to set_cs()
Since commit ddcad7e9068eb omap2_mcspi_set_cs() is called without
runtime power management requested. This patch fixes the problem by
requesting runtime power management in omap2_mcspi_set_cs().
Reported-By: Pali Rohár <pali.rohar@gmail.com>
Fixes: ddcad7e9068eb (spi: omap2-mcspi: Fix native cs with new set_cs)
Tested-By: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Michael Welling <mwelling@ieee.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/spi/spi-omap2-mcspi.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 58673841286c..3d09e0b69b73 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c | |||
@@ -245,6 +245,7 @@ static void omap2_mcspi_set_enable(const struct spi_device *spi, int enable) | |||
245 | 245 | ||
246 | static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable) | 246 | static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable) |
247 | { | 247 | { |
248 | struct omap2_mcspi *mcspi = spi_master_get_devdata(spi->master); | ||
248 | u32 l; | 249 | u32 l; |
249 | 250 | ||
250 | /* The controller handles the inverted chip selects | 251 | /* The controller handles the inverted chip selects |
@@ -255,6 +256,12 @@ static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable) | |||
255 | enable = !enable; | 256 | enable = !enable; |
256 | 257 | ||
257 | if (spi->controller_state) { | 258 | if (spi->controller_state) { |
259 | int err = pm_runtime_get_sync(mcspi->dev); | ||
260 | if (err < 0) { | ||
261 | dev_err(mcspi->dev, "failed to get sync: %d\n", err); | ||
262 | return; | ||
263 | } | ||
264 | |||
258 | l = mcspi_cached_chconf0(spi); | 265 | l = mcspi_cached_chconf0(spi); |
259 | 266 | ||
260 | if (enable) | 267 | if (enable) |
@@ -263,6 +270,9 @@ static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable) | |||
263 | l |= OMAP2_MCSPI_CHCONF_FORCE; | 270 | l |= OMAP2_MCSPI_CHCONF_FORCE; |
264 | 271 | ||
265 | mcspi_write_chconf0(spi, l); | 272 | mcspi_write_chconf0(spi, l); |
273 | |||
274 | pm_runtime_mark_last_busy(mcspi->dev); | ||
275 | pm_runtime_put_autosuspend(mcspi->dev); | ||
266 | } | 276 | } |
267 | } | 277 | } |
268 | 278 | ||