summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorPrashant Gaikwad <pgaikwad@nvidia.com>2013-10-18 11:33:59 +0530
committerBharat Nihalani <bnihalani@nvidia.com>2013-10-17 23:13:27 -0700
commit98d2ffb58e7649eb158367a0f4d675939fe5abef (patch)
tree88a600aacdc6d8a3924923d6bf4322ccfb2e747e /drivers/i2c
parent3a453ca754f3e283235cee5a07d6d2d3e0c72cb8 (diff)
i2c: tegra: restore i2c after resume from LP0
Add function to restore all i2c controllers after resume from LP0. It will happen in idle thread where irqs are disabled and it is expected that no one would be using i2c device. Bug 1254633 Change-Id: Ice6f0f96c4097ccf61f5b36ac8b7b811c333c0b6 Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com> Reviewed-on: http://git-master/r/299461 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-tegra.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 25253154efe1..855bde2fac21 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -42,6 +42,8 @@
#include <asm/unaligned.h>
+#include <mach/pm_domains.h>
+
#define TEGRA_I2C_TIMEOUT (msecs_to_jiffies(1000))
#define TEGRA_I2C_RETRIES 3
#define BYTES_PER_FIFO_WORD 4
@@ -704,6 +706,21 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
return err;
}
+
+int tegra_i2c_restore(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
+
+ i2c_lock_adapter(&i2c_dev->adapter);
+
+ tegra_i2c_init(i2c_dev);
+
+ i2c_unlock_adapter(&i2c_dev->adapter);
+
+ return 0;
+}
+
static int tegra_i2c_copy_next_to_current(struct tegra_i2c_dev *i2c_dev)
{
i2c_dev->msg_buf = i2c_dev->next_msg_buf;
@@ -1514,6 +1531,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
return ret;
}
+ tegra_pd_add_device(&pdev->dev);
pm_runtime_enable(&pdev->dev);
i2c_dev->scl_gpio = pdata->scl_gpio;