diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2011-06-16 04:14:40 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-06-16 10:27:00 -0400 |
commit | bcda6ff8ddffa593635ed7e6f620a1ef3b827ffc (patch) | |
tree | a9eb1eb5b76de898265a2b78fa7ebc6d2a742db0 /drivers/spi | |
parent | 083be3f05371b8fe0606f3abf029beeeff66d633 (diff) |
spi/pl022: support runtime PM
Insert notifiers for the runtime PM API. With this the runtime
PM layer kicks in to action where used.
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Reviewed-by: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>
Reviewed-by: Jonas Aberg <jonas.aberg@stericsson.com>
Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
[Rebased to Linux 3.0-rc3, edit description]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-pl022.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index f4b7b72b373e..5079ff14c9d4 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/dmaengine.h> | 40 | #include <linux/dmaengine.h> |
41 | #include <linux/dma-mapping.h> | 41 | #include <linux/dma-mapping.h> |
42 | #include <linux/scatterlist.h> | 42 | #include <linux/scatterlist.h> |
43 | #include <linux/pm_runtime.h> | ||
43 | 44 | ||
44 | /* | 45 | /* |
45 | * This macro is used to define some register default values. | 46 | * This macro is used to define some register default values. |
@@ -517,6 +518,7 @@ static void giveback(struct pl022 *pl022) | |||
517 | clk_disable(pl022->clk); | 518 | clk_disable(pl022->clk); |
518 | amba_pclk_disable(pl022->adev); | 519 | amba_pclk_disable(pl022->adev); |
519 | amba_vcore_disable(pl022->adev); | 520 | amba_vcore_disable(pl022->adev); |
521 | pm_runtime_put(&pl022->adev->dev); | ||
520 | } | 522 | } |
521 | 523 | ||
522 | /** | 524 | /** |
@@ -1542,6 +1544,7 @@ static void pump_messages(struct work_struct *work) | |||
1542 | * and core will be disabled when giveback() is called in each method | 1544 | * and core will be disabled when giveback() is called in each method |
1543 | * (poll/interrupt/DMA) | 1545 | * (poll/interrupt/DMA) |
1544 | */ | 1546 | */ |
1547 | pm_runtime_get_sync(&pl022->adev->dev); | ||
1545 | amba_vcore_enable(pl022->adev); | 1548 | amba_vcore_enable(pl022->adev); |
1546 | amba_pclk_enable(pl022->adev); | 1549 | amba_pclk_enable(pl022->adev); |
1547 | clk_enable(pl022->clk); | 1550 | clk_enable(pl022->clk); |
@@ -2142,6 +2145,8 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2142 | } | 2145 | } |
2143 | printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n", | 2146 | printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n", |
2144 | adev->res.start, pl022->virtbase); | 2147 | adev->res.start, pl022->virtbase); |
2148 | pm_runtime_enable(dev); | ||
2149 | pm_runtime_resume(dev); | ||
2145 | 2150 | ||
2146 | pl022->clk = clk_get(&adev->dev, NULL); | 2151 | pl022->clk = clk_get(&adev->dev, NULL); |
2147 | if (IS_ERR(pl022->clk)) { | 2152 | if (IS_ERR(pl022->clk)) { |
@@ -2203,6 +2208,7 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2203 | destroy_queue(pl022); | 2208 | destroy_queue(pl022); |
2204 | pl022_dma_remove(pl022); | 2209 | pl022_dma_remove(pl022); |
2205 | free_irq(adev->irq[0], pl022); | 2210 | free_irq(adev->irq[0], pl022); |
2211 | pm_runtime_disable(&adev->dev); | ||
2206 | err_no_irq: | 2212 | err_no_irq: |
2207 | clk_put(pl022->clk); | 2213 | clk_put(pl022->clk); |
2208 | err_no_clk: | 2214 | err_no_clk: |