summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-08-29 15:41:37 +0530
committerSimone Willett <swillett@nvidia.com>2012-08-29 13:42:23 -0700
commit08dc4014dc57ecbd495f54bfd89dc31d66bfb64e (patch)
tree6a1401c2c3dd935865c5f23c7fc1fa0fb283000c /drivers
parent29b248c4f6171b08dc84eda893b1bfffaaeb5cc4 (diff)
i2c: tegra: Add stub runtime power management
Add stub runtime_pm calls which go through the flow of enabling and disabling but don't actually do anything with the device itself as there's nothing useful we can do. This provides the core PM framework with information about when the device is idle, enabling chip wide power savings. The change is based on change done by Mark Brown for s3c2410 i2c bus driver. ---------- Author: Mark Brown <broonie@opensource.wolfsonmicro.com> i2c-s3c2410: Add stub runtime power management ---------- Change-Id: Icb92129c4f79a1642b2b73d14578b05928d745a8 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/128151
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/i2c-tegra.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 28896fdc5607..b3c7a762760a 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -29,6 +29,7 @@
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
+#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/i2c-tegra.h>
#include <linux/of_i2c.h>
@@ -813,6 +814,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
i2c_dev->msgs = msgs;
i2c_dev->msgs_num = num;
+ pm_runtime_get_sync(&adap->dev);
tegra_i2c_clock_enable(i2c_dev);
for (i = 0; i < num; i++) {
@@ -829,6 +831,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
}
tegra_i2c_clock_disable(i2c_dev);
+ pm_runtime_put(&adap->dev);
rt_mutex_unlock(&i2c_dev->dev_lock);
@@ -992,6 +995,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
return ret;
}
+ pm_runtime_enable(&pdev->dev);
for (i = 0; i < nbus; i++) {
struct tegra_i2c_bus *i2c_bus = &i2c_dev->busses[i];
@@ -1028,10 +1032,12 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
goto err_del_bus;
}
of_i2c_register_devices(&i2c_bus->adapter);
+ pm_runtime_enable(&i2c_bus->adapter.dev);
i2c_dev->bus_count++;
}
+
return 0;
err_del_bus:
@@ -1044,11 +1050,14 @@ static int __devexit tegra_i2c_remove(struct platform_device *pdev)
{
struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
- while (i2c_dev->bus_count--)
+ while (i2c_dev->bus_count--) {
i2c_del_adapter(&i2c_dev->busses[i2c_dev->bus_count].adapter);
+ pm_runtime_disable(&i2c_dev->busses[i2c_dev->bus_count].adapter.dev);
+ }
if (i2c_dev->is_clkon_always)
tegra_i2c_clock_disable(i2c_dev);
+ pm_runtime_disable(&pdev->dev);
return 0;
}