aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorChaithrika U S <chaithrika@ti.com>2010-01-06 04:24:59 -0500
committerKevin Hilman <khilman@deeprootsystems.com>2010-08-05 12:38:32 -0400
commit68f15de976f8f90d3bc0d10160aa20b0528760d4 (patch)
treecebffb687c98e750a908a95a8b9049814e6c8716 /drivers/i2c
parent5ae5b1136e0c434b076ab1f9cb39deebf6187f55 (diff)
i2c: davinci: Add suspend/resume support
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>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-davinci.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 9afd9af4f550..7afeb28d6d76 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -646,6 +646,41 @@ static int davinci_i2c_remove(struct platform_device *pdev)
646 return 0; 646 return 0;
647} 647}
648 648
649#ifdef CONFIG_PM
650static int davinci_i2c_suspend(struct device *dev)
651{
652 struct platform_device *pdev = to_platform_device(dev);
653 struct davinci_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
654
655 /* put I2C into reset */
656 davinci_i2c_reset_ctrl(i2c_dev, 0);
657 clk_disable(i2c_dev->clk);
658
659 return 0;
660}
661
662static int davinci_i2c_resume(struct device *dev)
663{
664 struct platform_device *pdev = to_platform_device(dev);
665 struct davinci_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
666
667 clk_enable(i2c_dev->clk);
668 /* take I2C out of reset */
669 davinci_i2c_reset_ctrl(i2c_dev, 1);
670
671 return 0;
672}
673
674static const struct dev_pm_ops davinci_i2c_pm = {
675 .suspend = davinci_i2c_suspend,
676 .resume = davinci_i2c_resume,
677};
678
679#define davinci_i2c_pm_ops (&davinci_i2c_pm)
680#else
681#define davinci_i2c_pm_ops NULL
682#endif
683
649/* work with hotplug and coldplug */ 684/* work with hotplug and coldplug */
650MODULE_ALIAS("platform:i2c_davinci"); 685MODULE_ALIAS("platform:i2c_davinci");
651 686
@@ -655,6 +690,7 @@ static struct platform_driver davinci_i2c_driver = {
655 .driver = { 690 .driver = {
656 .name = "i2c_davinci", 691 .name = "i2c_davinci",
657 .owner = THIS_MODULE, 692 .owner = THIS_MODULE,
693 .pm = davinci_i2c_pm_ops,
658 }, 694 },
659}; 695};
660 696