linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Bishara <saeed@marvell.com>
To: linux-raid@vger.kernel.org, dan.j.williams@intel.com
Cc: buytenh@marvell.com, nico@marvell.com, saeed.bishara@gmail.com,
	Saeed Bishara <saeed@marvell.com>
Subject: [PATCH] mv_xor: add support for power management
Date: Tue, 23 Jun 2009 12:56:44 +0300	[thread overview]
Message-ID: <1245751004-3056-2-git-send-email-saeed@marvell.com> (raw)
In-Reply-To: <1245751004-3056-1-git-send-email-saeed@marvell.com>


Signed-off-by: Saeed Bishara <saeed@marvell.com>
---
 drivers/dma/mv_xor.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index db77903..ecacd32 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1284,9 +1284,38 @@ mv_xor_conf_mbus_windows(struct mv_xor_shared_private *msp,
 	writel(win_enable, base + WINDOW_BAR_ENABLE(1));
 }
 
+#ifdef CONFIG_PM
+static int mv_xor_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	return 0;
+}
+
+static int mv_xor_resume(struct platform_device *pdev)
+{
+	struct mv_xor_device *device = platform_get_drvdata(pdev);
+	struct dma_chan *chan, *_chan;
+	struct mv_xor_chan *mv_chan;
+
+	list_for_each_entry_safe(chan, _chan, &device->common.channels,
+				device_node) {
+		mv_chan = to_mv_xor_chan(chan);
+		mv_chan_unmask_interrupts(mv_chan);
+
+		mv_set_mode(mv_chan, mv_chan->current_type);
+	}
+	return 0;
+}
+
+#else
+#define mv_xor_suspend NULL
+#define mv_xor_resume NULL
+#endif
+
 static struct platform_driver mv_xor_driver = {
 	.probe		= mv_xor_probe,
 	.remove		= __devexit_p(mv_xor_remove),
+	.suspend	= mv_xor_suspend,
+	.resume		= mv_xor_resume,
 	.driver		= {
 		.owner	= THIS_MODULE,
 		.name	= MV_XOR_NAME,
@@ -1355,9 +1384,36 @@ static int mv_xor_shared_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int mv_xor_shared_suspend(struct platform_device *pdev,
+				 pm_message_t state)
+{
+	return 0;
+}
+
+static int mv_xor_shared_resume(struct platform_device *pdev)
+{
+	struct mv_xor_platform_shared_data *msd = pdev->dev.platform_data;
+	struct mv_xor_shared_private *msp = platform_get_drvdata(pdev);
+	/*
+	 * (Re-)program MBUS remapping windows if we are asked to.
+	 */
+	if (msd != NULL && msd->dram != NULL)
+		mv_xor_conf_mbus_windows(msp, msd->dram);
+
+	return 0;
+}
+
+#else
+#define mv_xor_shared_suspend NULL
+#define mv_xor_shared_resume NULL
+#endif
+
 static struct platform_driver mv_xor_shared_driver = {
 	.probe		= mv_xor_shared_probe,
 	.remove		= mv_xor_shared_remove,
+	.suspend	= mv_xor_shared_suspend,
+	.resume		= mv_xor_shared_resume,
 	.driver		= {
 		.owner	= THIS_MODULE,
 		.name	= MV_XOR_SHARED_NAME,
-- 
1.6.0.4


  reply	other threads:[~2009-06-23  9:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-23  9:56 [PATCH] mv_xor: add support for clkdev framework Saeed Bishara
2009-06-23  9:56 ` Saeed Bishara [this message]
2009-06-23 16:20 ` Dan Williams
2009-06-23 16:42   ` saeed bishara
2009-06-23 16:44   ` Nicolas Pitre
2009-06-23 17:00     ` Saeed Bishara
2009-06-23 17:11       ` Dan Williams
2009-06-23 17:22       ` Nicolas Pitre
2009-06-24  7:29         ` Saeed Bishara

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=1245751004-3056-2-git-send-email-saeed@marvell.com \
    --to=saeed@marvell.com \
    --cc=buytenh@marvell.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=nico@marvell.com \
    --cc=saeed.bishara@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).