diff options
| author | Geert Uytterhoeven <geert+renesas@linux-m68k.org> | 2014-03-11 05:59:12 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@linaro.org> | 2014-03-11 06:45:53 -0400 |
| commit | 490c97747d5dc77dfb5826e2823b41d8b2ef7ecc (patch) | |
| tree | 9cfd2ac813c6fc868871907015a821f1c30b9fc1 | |
| parent | ba824d4971691a7f1f66429e378a08a95fbb5b79 (diff) | |
spi: rspi: Add runtime PM support, using spi core auto_runtime_pm
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
| -rw-r--r-- | drivers/spi/spi-rspi.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 92bec7e91046..1fb0ad213324 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/dmaengine.h> | 33 | #include <linux/dmaengine.h> |
| 34 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
| 35 | #include <linux/of_device.h> | 35 | #include <linux/of_device.h> |
| 36 | #include <linux/pm_runtime.h> | ||
| 36 | #include <linux/sh_dma.h> | 37 | #include <linux/sh_dma.h> |
| 37 | #include <linux/spi/spi.h> | 38 | #include <linux/spi/spi.h> |
| 38 | #include <linux/spi/rspi.h> | 39 | #include <linux/spi/rspi.h> |
| @@ -1111,7 +1112,7 @@ static int rspi_remove(struct platform_device *pdev) | |||
| 1111 | struct rspi_data *rspi = platform_get_drvdata(pdev); | 1112 | struct rspi_data *rspi = platform_get_drvdata(pdev); |
| 1112 | 1113 | ||
| 1113 | rspi_release_dma(rspi); | 1114 | rspi_release_dma(rspi); |
| 1114 | clk_disable_unprepare(rspi->clk); | 1115 | pm_runtime_disable(&pdev->dev); |
| 1115 | 1116 | ||
| 1116 | return 0; | 1117 | return 0; |
| 1117 | } | 1118 | } |
| @@ -1242,16 +1243,13 @@ static int rspi_probe(struct platform_device *pdev) | |||
| 1242 | goto error1; | 1243 | goto error1; |
| 1243 | } | 1244 | } |
| 1244 | 1245 | ||
| 1245 | ret = clk_prepare_enable(rspi->clk); | 1246 | pm_runtime_enable(&pdev->dev); |
| 1246 | if (ret < 0) { | ||
| 1247 | dev_err(&pdev->dev, "unable to prepare/enable clock\n"); | ||
| 1248 | goto error1; | ||
| 1249 | } | ||
| 1250 | 1247 | ||
| 1251 | init_waitqueue_head(&rspi->wait); | 1248 | init_waitqueue_head(&rspi->wait); |
| 1252 | 1249 | ||
| 1253 | master->bus_num = pdev->id; | 1250 | master->bus_num = pdev->id; |
| 1254 | master->setup = rspi_setup; | 1251 | master->setup = rspi_setup; |
| 1252 | master->auto_runtime_pm = true; | ||
| 1255 | master->transfer_one = ops->transfer_one; | 1253 | master->transfer_one = ops->transfer_one; |
| 1256 | master->prepare_message = rspi_prepare_message; | 1254 | master->prepare_message = rspi_prepare_message; |
| 1257 | master->unprepare_message = rspi_unprepare_message; | 1255 | master->unprepare_message = rspi_unprepare_message; |
| @@ -1312,7 +1310,7 @@ static int rspi_probe(struct platform_device *pdev) | |||
| 1312 | error3: | 1310 | error3: |
| 1313 | rspi_release_dma(rspi); | 1311 | rspi_release_dma(rspi); |
| 1314 | error2: | 1312 | error2: |
| 1315 | clk_disable_unprepare(rspi->clk); | 1313 | pm_runtime_disable(&pdev->dev); |
| 1316 | error1: | 1314 | error1: |
| 1317 | spi_master_put(master); | 1315 | spi_master_put(master); |
| 1318 | 1316 | ||
