diff options
Diffstat (limited to 'drivers/spi/spi-rspi.c')
-rw-r--r-- | drivers/spi/spi-rspi.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 95dc4d78618d..b37de1d991d6 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
@@ -598,11 +598,13 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, | |||
598 | 598 | ||
599 | ret = wait_event_interruptible_timeout(rspi->wait, | 599 | ret = wait_event_interruptible_timeout(rspi->wait, |
600 | rspi->dma_callbacked, HZ); | 600 | rspi->dma_callbacked, HZ); |
601 | if (ret > 0 && rspi->dma_callbacked) | 601 | if (ret > 0 && rspi->dma_callbacked) { |
602 | ret = 0; | 602 | ret = 0; |
603 | else if (!ret) { | 603 | } else { |
604 | dev_err(&rspi->master->dev, "DMA timeout\n"); | 604 | if (!ret) { |
605 | ret = -ETIMEDOUT; | 605 | dev_err(&rspi->master->dev, "DMA timeout\n"); |
606 | ret = -ETIMEDOUT; | ||
607 | } | ||
606 | if (tx) | 608 | if (tx) |
607 | dmaengine_terminate_all(rspi->master->dma_tx); | 609 | dmaengine_terminate_all(rspi->master->dma_tx); |
608 | if (rx) | 610 | if (rx) |
@@ -1350,12 +1352,36 @@ static const struct platform_device_id spi_driver_ids[] = { | |||
1350 | 1352 | ||
1351 | MODULE_DEVICE_TABLE(platform, spi_driver_ids); | 1353 | MODULE_DEVICE_TABLE(platform, spi_driver_ids); |
1352 | 1354 | ||
1355 | #ifdef CONFIG_PM_SLEEP | ||
1356 | static int rspi_suspend(struct device *dev) | ||
1357 | { | ||
1358 | struct platform_device *pdev = to_platform_device(dev); | ||
1359 | struct rspi_data *rspi = platform_get_drvdata(pdev); | ||
1360 | |||
1361 | return spi_master_suspend(rspi->master); | ||
1362 | } | ||
1363 | |||
1364 | static int rspi_resume(struct device *dev) | ||
1365 | { | ||
1366 | struct platform_device *pdev = to_platform_device(dev); | ||
1367 | struct rspi_data *rspi = platform_get_drvdata(pdev); | ||
1368 | |||
1369 | return spi_master_resume(rspi->master); | ||
1370 | } | ||
1371 | |||
1372 | static SIMPLE_DEV_PM_OPS(rspi_pm_ops, rspi_suspend, rspi_resume); | ||
1373 | #define DEV_PM_OPS &rspi_pm_ops | ||
1374 | #else | ||
1375 | #define DEV_PM_OPS NULL | ||
1376 | #endif /* CONFIG_PM_SLEEP */ | ||
1377 | |||
1353 | static struct platform_driver rspi_driver = { | 1378 | static struct platform_driver rspi_driver = { |
1354 | .probe = rspi_probe, | 1379 | .probe = rspi_probe, |
1355 | .remove = rspi_remove, | 1380 | .remove = rspi_remove, |
1356 | .id_table = spi_driver_ids, | 1381 | .id_table = spi_driver_ids, |
1357 | .driver = { | 1382 | .driver = { |
1358 | .name = "renesas_spi", | 1383 | .name = "renesas_spi", |
1384 | .pm = DEV_PM_OPS, | ||
1359 | .of_match_table = of_match_ptr(rspi_of_match), | 1385 | .of_match_table = of_match_ptr(rspi_of_match), |
1360 | }, | 1386 | }, |
1361 | }; | 1387 | }; |