MLK-13716-2 i2c: imx-lpi2c: support for vlls mode
authorGao Pan <pandy.gao@nxp.com>
Wed, 4 Jan 2017 07:01:22 +0000 (15:01 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:58:17 +0000 (14:58 -0500)
On i.MX7ULP sillicon, system suspend go through VLLS mode that gate
off pinctrl and modules power, then all registers are reset to HW
default value. To support the feature, driver needs to recover all
registers status.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
drivers/i2c/busses/i2c-imx-lpi2c.c

index 6cbf04f..e5ea0a2 100644 (file)
@@ -630,12 +630,32 @@ static int lpi2c_imx_remove(struct platform_device *pdev)
        return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int lpi2c_imx_suspend(struct device *dev)
+{
+       pinctrl_pm_select_sleep_state(dev);
+       return 0;
+}
+
+static int lpi2c_imx_resume(struct device *dev)
+{
+       pinctrl_pm_select_default_state(dev);
+       return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(imx_lpi2c_pm, lpi2c_imx_suspend, lpi2c_imx_resume);
+#define IMX_LPI2C_PM      (&imx_lpi2c_pm)
+#else
+#define IMX_LPI2C_PM      NULL
+#endif
+
 static struct platform_driver lpi2c_imx_driver = {
        .probe = lpi2c_imx_probe,
        .remove = lpi2c_imx_remove,
        .driver = {
                .name = DRIVER_NAME,
                .of_match_table = lpi2c_imx_of_match,
+               .pm = IMX_LPI2C_PM,
        },
 };