1 From b862ceba838786ac81aa6a295ad91a54aff6909d Mon Sep 17 00:00:00 2001
2 From: Gao Pan <b54642@freescale.com>
3 Date: Tue, 25 Aug 2015 14:00:32 +0800
4 Subject: [PATCH] MLK-11403: I2C: imx: restore pin setting for i2c
6 restore pin setting for i2c in suspend/resume
8 Signed-off-by: Gao Pan <gaopan@freescale.com>
9 (Vipul: Fixed merge conflicts)
10 Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
11 (cherry picked from commit 42b5aa1d72c09015d435459c6a59022255e3ef21)
13 drivers/i2c/busses/i2c-imx.c | 19 +++++++++++++++++--
14 1 file changed, 17 insertions(+), 2 deletions(-)
16 --- a/drivers/i2c/busses/i2c-imx.c
17 +++ b/drivers/i2c/busses/i2c-imx.c
18 @@ -1227,7 +1227,8 @@ static int __maybe_unused i2c_imx_runtim
20 struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
22 - clk_disable(i2c_imx->clk);
23 + clk_disable_unprepare(i2c_imx->clk);
24 + pinctrl_pm_select_sleep_state(dev);
28 @@ -1237,14 +1238,28 @@ static int __maybe_unused i2c_imx_runtim
29 struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
32 - ret = clk_enable(i2c_imx->clk);
33 + pinctrl_pm_select_default_state(dev);
34 + ret = clk_prepare_enable(i2c_imx->clk);
36 dev_err(dev, "can't enable I2C clock, ret=%d\n", ret);
41 +static int i2c_imx_suspend(struct device *dev)
43 + pinctrl_pm_select_sleep_state(dev);
47 +static int i2c_imx_resume(struct device *dev)
49 + pinctrl_pm_select_default_state(dev);
53 static const struct dev_pm_ops i2c_imx_pm_ops = {
54 + SET_SYSTEM_SLEEP_PM_OPS(i2c_imx_suspend, i2c_imx_resume)
55 SET_RUNTIME_PM_OPS(i2c_imx_runtime_suspend,
56 i2c_imx_runtime_resume, NULL)