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,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org
Subject: [PATCH v3 3/4] i2c: davinci: Add suspend/resume support
Date: Wed, 6 Jan 2010 14:54:59 +0530 [thread overview]
Message-ID: <1262769900-2710-4-git-send-email-chaithrika@ti.com> (raw)
In-Reply-To: <1262769900-2710-3-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>
Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
---
drivers/i2c/busses/i2c-davinci.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 81c1049..d2a4844 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -622,6 +622,41 @@ static int davinci_i2c_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+static int davinci_i2c_suspend(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct davinci_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
+
+ /* put I2C into reset */
+ davinci_i2c_reset_ctrl(i2c_dev, 0);
+ clk_disable(i2c_dev->clk);
+
+ return 0;
+}
+
+static int davinci_i2c_resume(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct davinci_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
+
+ clk_enable(i2c_dev->clk);
+ /* take I2C out of reset */
+ davinci_i2c_reset_ctrl(i2c_dev, 1);
+
+ return 0;
+}
+
+static struct dev_pm_ops davinci_i2c_pm = {
+ .suspend = davinci_i2c_suspend,
+ .resume = davinci_i2c_resume,
+};
+
+#define davinci_i2c_pm_ops (&davinci_i2c_pm)
+#else
+#define davinci_i2c_pm_ops NULL
+#endif
+
/* work with hotplug and coldplug */
MODULE_ALIAS("platform:i2c_davinci");
@@ -631,6 +666,7 @@ static struct platform_driver davinci_i2c_driver = {
.driver = {
.name = "i2c_davinci",
.owner = THIS_MODULE,
+ .pm = davinci_i2c_pm_ops,
},
};
--
1.5.6
next prev parent reply other threads:[~2010-01-06 9:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-06 9:24 [PATCH v3 0/4] i2c: davinci: Add power management features Chaithrika U S
[not found] ` <1262769900-2710-1-git-send-email-chaithrika-l0cyMroinI0@public.gmane.org>
2010-01-06 9:24 ` [PATCH v2 1/4] i2c: davinci: Remove MOD_REG_BIT and IO_ADDRESS usage Chaithrika U S
[not found] ` <1262769900-2710-2-git-send-email-chaithrika-l0cyMroinI0@public.gmane.org>
2010-01-06 9:24 ` [PATCH v2 2/4] i2c: davinci: Add helper functions Chaithrika U S
[not found] ` <1262769900-2710-3-git-send-email-chaithrika-l0cyMroinI0@public.gmane.org>
2010-01-06 9:24 ` Chaithrika U S [this message]
2010-01-06 9:25 ` [PATCH v2 4/4] i2c: davinci: Add cpufreq support Chaithrika U S
2010-01-06 15:24 ` [PATCH v3 0/4] i2c: davinci: Add power management features Kevin Hilman
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=1262769900-2710-4-git-send-email-chaithrika@ti.com \
--to=chaithrika-l0cymroini0@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-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).