diff options
| author | Kristen Carlson Accardi <kristen@linux.intel.com> | 2011-03-31 14:02:43 -0400 |
|---|---|---|
| committer | Vinod Koul <vinod.koul@intel.com> | 2011-04-01 07:19:05 -0400 |
| commit | e2142df7ec7184ed4a77ada686bc1eb41075490f (patch) | |
| tree | d6f2f0cb5a3c68bc82a10716c968307a9315b9d4 | |
| parent | 427cdf19b97e509e21e5d347e18d8b0b34723dfc (diff) | |
intel_mid_dma: fix runtime pm issues
Use the correct api in probe to enable runtime pm for this driver.
Additionally, do not just call legacy suspend for runtime_suspend,
as this duplicates some work the pci core does for you.
Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
| -rw-r--r-- | drivers/dma/intel_mid_dma.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c index 798f46a4590d..f153adfcaceb 100644 --- a/drivers/dma/intel_mid_dma.c +++ b/drivers/dma/intel_mid_dma.c | |||
| @@ -1292,8 +1292,7 @@ static int __devinit intel_mid_dma_probe(struct pci_dev *pdev, | |||
| 1292 | if (err) | 1292 | if (err) |
| 1293 | goto err_dma; | 1293 | goto err_dma; |
| 1294 | 1294 | ||
| 1295 | pm_runtime_set_active(&pdev->dev); | 1295 | pm_runtime_put_noidle(&pdev->dev); |
| 1296 | pm_runtime_enable(&pdev->dev); | ||
| 1297 | pm_runtime_allow(&pdev->dev); | 1296 | pm_runtime_allow(&pdev->dev); |
| 1298 | return 0; | 1297 | return 0; |
| 1299 | 1298 | ||
| @@ -1322,6 +1321,9 @@ err_enable_device: | |||
| 1322 | static void __devexit intel_mid_dma_remove(struct pci_dev *pdev) | 1321 | static void __devexit intel_mid_dma_remove(struct pci_dev *pdev) |
| 1323 | { | 1322 | { |
| 1324 | struct middma_device *device = pci_get_drvdata(pdev); | 1323 | struct middma_device *device = pci_get_drvdata(pdev); |
| 1324 | |||
| 1325 | pm_runtime_get_noresume(&pdev->dev); | ||
| 1326 | pm_runtime_forbid(&pdev->dev); | ||
| 1325 | middma_shutdown(pdev); | 1327 | middma_shutdown(pdev); |
| 1326 | pci_dev_put(pdev); | 1328 | pci_dev_put(pdev); |
| 1327 | kfree(device); | 1329 | kfree(device); |
| @@ -1385,13 +1387,20 @@ int dma_resume(struct pci_dev *pci) | |||
| 1385 | static int dma_runtime_suspend(struct device *dev) | 1387 | static int dma_runtime_suspend(struct device *dev) |
| 1386 | { | 1388 | { |
| 1387 | struct pci_dev *pci_dev = to_pci_dev(dev); | 1389 | struct pci_dev *pci_dev = to_pci_dev(dev); |
| 1388 | return dma_suspend(pci_dev, PMSG_SUSPEND); | 1390 | struct middma_device *device = pci_get_drvdata(pci_dev); |
| 1391 | |||
| 1392 | device->state = SUSPENDED; | ||
| 1393 | return 0; | ||
| 1389 | } | 1394 | } |
| 1390 | 1395 | ||
| 1391 | static int dma_runtime_resume(struct device *dev) | 1396 | static int dma_runtime_resume(struct device *dev) |
| 1392 | { | 1397 | { |
| 1393 | struct pci_dev *pci_dev = to_pci_dev(dev); | 1398 | struct pci_dev *pci_dev = to_pci_dev(dev); |
| 1394 | return dma_resume(pci_dev); | 1399 | struct middma_device *device = pci_get_drvdata(pci_dev); |
| 1400 | |||
| 1401 | device->state = RUNNING; | ||
| 1402 | iowrite32(REG_BIT0, device->dma_base + DMA_CFG); | ||
| 1403 | return 0; | ||
| 1395 | } | 1404 | } |
| 1396 | 1405 | ||
| 1397 | static int dma_runtime_idle(struct device *dev) | 1406 | static int dma_runtime_idle(struct device *dev) |
