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 v2 3/4] i2c: davinci: Add suspend/resume support
Date: Tue, 8 Dec 2009 15:43:37 +0530 [thread overview]
Message-ID: <1260267218-19406-4-git-send-email-chaithrika@ti.com> (raw)
In-Reply-To: <1260267218-19406-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>
---
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 81c1049..c1c2909 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -622,6 +622,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");
@@ -632,6 +662,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
next prev parent reply other threads:[~2009-12-08 10:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-08 10:13 [PATCH v2 0/4] i2c: davinci: Add power management features Chaithrika U S
[not found] ` <1260267218-19406-1-git-send-email-chaithrika-l0cyMroinI0@public.gmane.org>
2009-12-08 10:13 ` [PATCH v2 1/4] i2c: davinci: Remove MOD_REG_BIT and IO_ADDRESS usage Chaithrika U S
[not found] ` <1260267218-19406-2-git-send-email-chaithrika-l0cyMroinI0@public.gmane.org>
2009-12-08 10:13 ` [PATCH v2 2/4] i2c: davinci: Add helper functions Chaithrika U S
[not found] ` <1260267218-19406-3-git-send-email-chaithrika-l0cyMroinI0@public.gmane.org>
2009-12-08 10:13 ` Chaithrika U S [this message]
[not found] ` <1260267218-19406-4-git-send-email-chaithrika-l0cyMroinI0@public.gmane.org>
2009-12-08 10:13 ` [PATCH v2 4/4] i2c: davinci: Add cpufreq support Chaithrika U S
2010-01-05 22:56 ` [PATCH v2 3/4] i2c: davinci: Add suspend/resume support Kevin Hilman
[not found] ` <87vdfgrwib.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2010-01-06 4:56 ` Chaithrika U S
2009-12-08 11:24 ` [PATCH v2 2/4] i2c: davinci: Add helper functions Sergei Shtylyov
[not found] ` <4B1E376F.1030808-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2009-12-10 11:15 ` Chaithrika U S
2009-12-10 13:02 ` Sergei Shtylyov
2009-12-15 12:57 ` [PATCH v2 0/4] i2c: davinci: Add power management features 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=1260267218-19406-4-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).