All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Scott Ashcroft <scott.ashcroft@talk21.com>,
	Mika Westerberg <mika.westerberg@intel.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	"Blin, Jerome" <jerome.blin@intel.com>,
	linux-acpi@vger.kernel.org, Vinod Koul <vinod.koul@intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 4/4] dmaengine: dw: enable runtime PM
Date: Wed,  5 Nov 2014 18:34:48 +0200	[thread overview]
Message-ID: <1415205288-3356-5-git-send-email-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <1415205288-3356-1-git-send-email-andriy.shevchenko@linux.intel.com>

On runtime PM aware platforms the DMA have to manage its own power state. This
patch enables runtime PM support and applies necessary calls wherever it's
needed.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dw/core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index 2447221..3804785 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -22,6 +22,7 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <linux/pm_runtime.h>
 
 #include "../dmaengine.h"
 #include "internal.h"
@@ -1504,6 +1505,9 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
 	dw->regs = chip->regs;
 	chip->dw = dw;
 
+	pm_runtime_enable(chip->dev);
+	pm_runtime_get_sync(chip->dev);
+
 	dw_params = dma_read_byaddr(chip->regs, DW_PARAMS);
 	autocfg = dw_params >> DW_PARAMS_EN & 0x1;
 
@@ -1667,11 +1671,14 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
 	dev_info(chip->dev, "DesignWare DMA Controller, %d channels\n",
 		 nr_channels);
 
+	pm_runtime_put_sync_suspend(chip->dev);
+
 	return 0;
 
 err_dma_register:
 	free_irq(chip->irq, dw);
 err_pdata:
+	pm_runtime_put_sync_suspend(chip->dev);
 	return err;
 }
 EXPORT_SYMBOL_GPL(dw_dma_probe);
@@ -1681,6 +1688,8 @@ int dw_dma_remove(struct dw_dma_chip *chip)
 	struct dw_dma		*dw = chip->dw;
 	struct dw_dma_chan	*dwc, *_dwc;
 
+	pm_runtime_get_sync(chip->dev);
+
 	dw_dma_off(dw);
 	dma_async_device_unregister(&dw->dma);
 
@@ -1693,6 +1702,8 @@ int dw_dma_remove(struct dw_dma_chip *chip)
 		channel_clear_bit(dw, CH_EN, dwc->mask);
 	}
 
+	pm_runtime_put_sync_suspend(chip->dev);
+	pm_runtime_disable(chip->dev);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(dw_dma_remove);
-- 
2.1.1


  parent reply	other threads:[~2014-11-05 16:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 16:34 [PATCH v1 0/4] ACPI / LPSS: fix system hangup on BYT Andy Shevchenko
2014-11-05 16:34 ` [PATCH v1 1/4] ACPI / LPSS: add all LPSS devices to the specific power domain Andy Shevchenko
2014-11-05 16:34 ` [PATCH v1 2/4] ACPI / LPSS: allow to use specific PM domain during ->probe() Andy Shevchenko
2014-11-05 16:34 ` [PATCH v1 3/4] ACPI / LPSS: introduce a 'proxy' device to power on LPSS for DMA Andy Shevchenko
2014-11-05 16:34 ` Andy Shevchenko [this message]
2014-11-06  7:44   ` [PATCH v1 4/4] dmaengine: dw: enable runtime PM Vinod Koul
2014-11-05 19:33 ` [PATCH v1 0/4] ACPI / LPSS: fix system hangup on BYT Scott Ashcroft
2014-11-06 18:06 ` Scott Ashcroft
2014-11-07  0:37 ` Rafael J. Wysocki
2014-11-07  8:46   ` Scott Ashcroft
2014-11-07 13:54     ` Andy Shevchenko
2014-11-07 13:46   ` Andy Shevchenko
2014-11-07 16:30     ` Rafael J. Wysocki
2014-11-07 20:46       ` Scott Ashcroft
2014-11-10 13:23       ` Andy Shevchenko
2014-11-08 10:51 ` Scott Ashcroft
2014-11-10 13:24   ` Andy Shevchenko
2014-11-14 23:27 ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415205288-3356-5-git-send-email-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=jerome.blin@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mika.westerberg@intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=scott.ashcroft@talk21.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.