From: Kevin Hilman <khilman@deeprootsystems.com>
To: linux-i2c@vger.kernel.org, Ben Dooks <ben-linux@fluff.org>
Cc: Chaithrika U S <chaithrika@ti.com>,
"Jean Delvare (PC drivers, core)" <khali@linux-fr.org>,
"Ben Dooks (embedded platforms)" <ben-linux@fluff.org>,
Kevin Hilman <khilman@deeprootsystems.com>,
Philby John <pjohn@in.mvista.com>,
"Srinivasan, Nageswari" <nageswari@ti.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 4/6] i2c: davinci: Add suspend/resume support
Date: Tue, 6 Apr 2010 10:42:16 -0700 [thread overview]
Message-ID: <1270575738-22388-5-git-send-email-khilman@deeprootsystems.com> (raw)
In-Reply-To: <1270575738-22388-1-git-send-email-khilman@deeprootsystems.com>
From: Chaithrika U S <chaithrika@ti.com>
Add suspend and resume callbacks to DaVinci I2C driver.
This has been tested on DA850/OMAP-L138 EVM.
Signed-off-by: Chaithrika U S <chaithrika@ti.com>
Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
---
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 9239d2b..dfec296 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -645,6 +645,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 const 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");
@@ -654,6 +689,7 @@ static struct platform_driver davinci_i2c_driver = {
.driver = {
.name = "i2c_davinci",
.owner = THIS_MODULE,
+ .pm = davinci_i2c_pm_ops,
},
};
--
1.7.0.2
next prev parent reply other threads:[~2010-04-06 17:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1270575738-22388-1-git-send-email-khilman@deeprootsystems.com>
2010-04-06 17:42 ` [PATCH 1/6] i2c: davinci: Fix smbus Oops with AIC33 usage Kevin Hilman
2010-04-20 0:05 ` Ben Dooks
2010-04-06 17:42 ` [PATCH 2/6] i2c: davinci: misc. cleanups: remove MOD_REG_BIT and IO_ADDRESS usage Kevin Hilman
2010-04-06 17:42 ` [PATCH 3/6] i2c: davinci: Add helper functions for power management Kevin Hilman
2010-04-06 17:42 ` Kevin Hilman [this message]
2010-04-06 17:42 ` [PATCH 5/6] i2c: davinci: Add cpufreq support Kevin Hilman
2010-04-06 17:42 ` [PATCH 6/6] i2c: davinci: bus recovery procedure to clear the bus 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=1270575738-22388-5-git-send-email-khilman@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=ben-linux@fluff.org \
--cc=chaithrika@ti.com \
--cc=khali@linux-fr.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nageswari@ti.com \
--cc=pjohn@in.mvista.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
Powered by JetHome