[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    i2c: imx-lpi2c: add VLLS mode support
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2017-01-28 23:11:50
Message-ID: 20170128231150.7D1C4660834 () gitolite ! kernel ! org
[Download RAW message or body]

Web:        https://git.kernel.org/torvalds/c/e13fe92bb58cf9b8f709ec18267ffc9e6ffeb016
Commit:     e13fe92bb58cf9b8f709ec18267ffc9e6ffeb016
Parent:     0e1929dedea36781e25902118c93edd8d8f09af1
Refname:    refs/heads/master
Author:     Gao Pan <pandy.gao@nxp.com>
AuthorDate: Tue Jan 17 18:20:55 2017 +0800
Committer:  Wolfram Sang <wsa@the-dreams.de>
CommitDate: Thu Jan 26 00:24:23 2017 +0100

    i2c: imx-lpi2c: add VLLS mode support
    
    When system enters VLLS mode, module power is turned off. As a result,
    all registers are reset to HW default value. After exiting VLLS mode,
    registers are still in default mode. As a result, the pinctrl settings
    are incorrect, which will affect the module function.
    
    The patch recovers the pinctrl setting when exit VLLS mode.
    
    Signed-off-by: Gao Pan <pandy.gao@nxp.com>
    Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
    [wsa: added missing include]
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
---
 drivers/i2c/busses/i2c-imx-lpi2c.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index c62b7cd..3310f2e 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
@@ -636,12 +637,31 @@ 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;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(imx_lpi2c_pm, lpi2c_imx_suspend, lpi2c_imx_resume);
+
 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,
 	},
 };
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic