summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJubeom Kim <jubeomk@nvidia.com>2011-03-17 23:03:07 +0900
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:41:50 -0800
commit7b62b15d270e0327cc9ea49f527e197e3f56a713 (patch)
tree5ab9a1e76059ab49c729e1d6719d7da713d82004 /drivers/i2c
parentbfe944869202473e65cefd0a5e5a70f8e0c9f7a4 (diff)
i2c-tegra: Using suspend_noirq()/resume_noirq() for suspend/resume.
I2C driver needs to be suspended late and resumed early than other drivers. So, I2C driver uses the suspend_noirq/resume_noirq callbacks of struct dev_pm_ops for early/late power management system. Original-Change-Id: Ie2f453b96fb9ab9b16cafec79644fe5d3b982dd3 Reviewed-on: http://git-master/r/23347 Tested-by: Jubeom Kim <jubeomk@nvidia.com> Reviewed-by: Jinyoung Park <jinyoungp@nvidia.com> Reviewed-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: R1126fb1683ac4f9138763e7981a0e36769f14738
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-tegra.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 04b9add189b9..4bc4f0174c28 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -846,8 +846,9 @@ static int tegra_i2c_remove(struct platform_device *pdev)
}
#ifdef CONFIG_PM
-static int tegra_i2c_suspend(struct platform_device *pdev, pm_message_t state)
+static int tegra_i2c_suspend_noirq(struct device *dev)
{
+ struct platform_device *pdev = to_platform_device(dev);
struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
rt_mutex_lock(&i2c_dev->dev_lock);
@@ -857,8 +858,9 @@ static int tegra_i2c_suspend(struct platform_device *pdev, pm_message_t state)
return 0;
}
-static int tegra_i2c_resume(struct platform_device *pdev)
+static int tegra_i2c_resume_noirq(struct device *dev)
{
+ struct platform_device *pdev = to_platform_device(dev);
struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
int ret;
@@ -877,6 +879,14 @@ static int tegra_i2c_resume(struct platform_device *pdev)
return 0;
}
+
+static const struct dev_pm_ops tegra_i2c_dev_pm_ops = {
+ .suspend_noirq = tegra_i2c_suspend_noirq,
+ .resume_noirq = tegra_i2c_resume_noirq,
+};
+#define TEGRA_I2C_DEV_PM_OPS (&tegra_i2c_dev_pm_ops)
+#else
+#define TEGRA_I2C_DEV_PM_OPS NULL
#endif
#if defined(CONFIG_OF)
@@ -893,14 +903,11 @@ MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
static struct platform_driver tegra_i2c_driver = {
.probe = tegra_i2c_probe,
.remove = tegra_i2c_remove,
-#ifdef CONFIG_PM
- .suspend = tegra_i2c_suspend,
- .resume = tegra_i2c_resume,
-#endif
.driver = {
.name = "tegra-i2c",
.owner = THIS_MODULE,
.of_match_table = tegra_i2c_of_match,
+ .pm = TEGRA_I2C_DEV_PM_OPS,
},
};