]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00283508-5 pinctrl: imx: support pin sleep mode in suspend
authorAnson Huang <b20788@freescale.com>
Mon, 14 Oct 2013 19:32:48 +0000 (15:32 -0400)
committerJason Liu <r64343@freescale.com>
Wed, 30 Oct 2013 01:56:00 +0000 (09:56 +0800)
When system suspend, need to switch pwm pin to sleep mode,
this is to save IO power. Using pinctrl mode switch framework
to make it happen.

Signed-off-by: Anson Huang <b20788@freescale.com>
drivers/pinctrl/pinctrl-imx.c
drivers/pinctrl/pinctrl-imx.h
drivers/pinctrl/pinctrl-imx6sl.c

index 7284b8678eadd004eee1ea1b18eb1df9cafe9c7e..6cae657d2a7427216606f855203a3f06d69d6b45 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Core driver for the imx pin controller
  *
- * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ * Copyright (C) 2012-2013 Freescale Semiconductor, Inc.
  * Copyright (C) 2012 Linaro Ltd.
  *
  * Author: Dong Aisheng <dong.aisheng@linaro.org>
@@ -649,3 +649,25 @@ int imx_pinctrl_remove(struct platform_device *pdev)
 
        return 0;
 }
+
+#ifdef CONFIG_PM
+int imx_pinctrl_suspend(struct platform_device *pdev, pm_message_t state)
+{
+       struct imx_pinctrl *ipctl = platform_get_drvdata(pdev);
+
+       if (!ipctl)
+               return -EINVAL;
+
+       return pinctrl_force_sleep(ipctl->pctl);
+}
+
+int imx_pinctrl_resume(struct platform_device *pdev)
+{
+       struct imx_pinctrl *ipctl = platform_get_drvdata(pdev);
+
+       if (!ipctl)
+               return -EINVAL;
+
+       return pinctrl_force_default(ipctl->pctl);
+}
+#endif
index bcedd991c9f344371ef80d1f8517e9353706e413..e18c94deccf57f79e6b2710275b1d84172eeb004 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * IMX pinmux core definitions
  *
- * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ * Copyright (C) 2012-2013 Freescale Semiconductor, Inc.
  * Copyright (C) 2012 Linaro Ltd.
  *
  * Author: Dong Aisheng <dong.aisheng@linaro.org>
@@ -92,4 +92,8 @@ struct imx_pinctrl_soc_info {
 int imx_pinctrl_probe(struct platform_device *pdev,
                        struct imx_pinctrl_soc_info *info);
 int imx_pinctrl_remove(struct platform_device *pdev);
+#ifdef CONFIG_PM
+int imx_pinctrl_suspend(struct platform_device *pdev, pm_message_t state);
+int imx_pinctrl_resume(struct platform_device *pdev);
+#endif
 #endif /* __DRIVERS_PINCTRL_IMX_H */
index 4eb7ccab5f2d1806f17012da9b38b9467db472c7..f8613d53beab332a009fa5bb1b0f6ae1f0e5ac52 100644 (file)
@@ -384,6 +384,10 @@ static struct platform_driver imx6sl_pinctrl_driver = {
        },
        .probe = imx6sl_pinctrl_probe,
        .remove = imx_pinctrl_remove,
+#ifdef CONFIG_PM
+       .suspend = imx_pinctrl_suspend,
+       .resume = imx_pinctrl_resume,
+#endif
 };
 
 static int __init imx6sl_pinctrl_init(void)