linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chaithrika U S <chaithrika-l0cyMroinI0@public.gmane.org>
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org,
	khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org,
	Chaithrika U S <chaithrika-l0cyMroinI0@public.gmane.org>
Subject: [PATCH 2/3] i2c: davinci: Add suspend/resume support
Date: Mon,  7 Dec 2009 14:58:55 +0530	[thread overview]
Message-ID: <1260178136-26416-3-git-send-email-chaithrika@ti.com> (raw)
In-Reply-To: <1260178136-26416-2-git-send-email-chaithrika-l0cyMroinI0@public.gmane.org>

Add suspend and resume callbacks to DaVinci I2C driver.
This has been tested on DA850/OMAP-L138 EVM. The SoC specific
suspend-to-RAM support patch series [1] is needed to test this feature.

[1] http://linux.davincidsp.com/pipermail/davinci-linux-open-source/
2009-November/016958.html

Signed-off-by: Chaithrika U S <chaithrika-l0cyMroinI0@public.gmane.org>
---
 drivers/i2c/busses/i2c-davinci.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 5f3838c..5f0888d 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -623,6 +623,36 @@ static int davinci_i2c_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int davinci_i2c_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	struct davinci_i2c_dev *dev = platform_get_drvdata(pdev);
+
+	/* put I2C into reset */
+	davinci_i2c_reset_ctrl(dev, 0);
+
+	clk_disable(dev->clk);
+
+	return 0;
+}
+
+static int davinci_i2c_resume(struct platform_device *pdev)
+{
+	struct davinci_i2c_dev *dev = platform_get_drvdata(pdev);
+
+	clk_enable(dev->clk);
+
+	/* take I2C out of reset */
+	davinci_i2c_reset_ctrl(dev, 1);
+
+	return 0;
+}
+
+#else
+#define davinci_i2c_suspend NULL
+#define davinci_i2c_resume NULL
+#endif
+
 /* work with hotplug and coldplug */
 MODULE_ALIAS("platform:i2c_davinci");
 
@@ -633,6 +663,8 @@ static struct platform_driver davinci_i2c_driver = {
 		.name	= "i2c_davinci",
 		.owner	= THIS_MODULE,
 	},
+	.suspend	= davinci_i2c_suspend,
+	.resume		= davinci_i2c_resume,
 };
 
 /* I2C may be needed to bring up other drivers */
-- 
1.5.6

  parent reply	other threads:[~2009-12-07  9:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-07  9:28 [PATCH 0/3] i2c: davinci: Add power management features Chaithrika U S
     [not found] ` <1260178136-26416-1-git-send-email-chaithrika-l0cyMroinI0@public.gmane.org>
2009-12-07  9:28   ` [PATCH 1/3] i2c: davinci: Add helper functions Chaithrika U S
     [not found]     ` <1260178136-26416-2-git-send-email-chaithrika-l0cyMroinI0@public.gmane.org>
2009-12-07  9:28       ` Chaithrika U S [this message]
     [not found]         ` <1260178136-26416-3-git-send-email-chaithrika-l0cyMroinI0@public.gmane.org>
2009-12-07  9:28           ` [PATCH 3/3] i2c: davinci: Add cpufreq support Chaithrika U S
     [not found]             ` <1260178136-26416-4-git-send-email-chaithrika-l0cyMroinI0@public.gmane.org>
2009-12-07 11:00               ` Sergei Shtylyov
     [not found]                 ` <4B1CE03E.7040608-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2009-12-08  4:38                   ` Chaithrika U S
2009-12-07 18:24       ` [PATCH 1/3] i2c: davinci: Add helper functions Troy Kisky
     [not found]         ` <4B1D4850.7010108-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org>
2009-12-08  4:46           ` Chaithrika U S

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=1260178136-26416-3-git-send-email-chaithrika@ti.com \
    --to=chaithrika-l0cymroini0@public.gmane.org \
    --cc=davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org \
    --cc=khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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).