MLK-13717-2 spi: imx-lpspi: support for vlls mode
authorGao Pan <pandy.gao@nxp.com>
Wed, 4 Jan 2017 07:13:29 +0000 (15:13 +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/spi/spi-fsl-lpspi.c

index 9ae55b7..cf79a48 100644 (file)
@@ -464,11 +464,31 @@ static int fsl_lpspi_remove(struct platform_device *pdev)
        return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int fsl_lpspi_suspend(struct device *dev)
+{
+       pinctrl_pm_select_sleep_state(dev);
+       return 0;
+}
+
+static int fsl_lpspi_resume(struct device *dev)
+{
+       pinctrl_pm_select_default_state(dev);
+       return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(imx_lpspi_pm, fsl_lpspi_suspend, fsl_lpspi_resume);
+#define IMX_LPSPI_PM   (&imx_lpspi_pm)
+#else
+#define IMX_LPSPI_PM   NULL
+#endif
+
 static struct platform_driver fsl_lpspi_driver = {
        .driver = {
-                  .name = DRIVER_NAME,
-                  .of_match_table = fsl_lpspi_dt_ids,
-                  },
+                       .name = DRIVER_NAME,
+                       .of_match_table = fsl_lpspi_dt_ids,
+                       .pm = IMX_LPSPI_PM,
+               },
        .probe = fsl_lpspi_probe,
        .remove = fsl_lpspi_remove,
 };