Linux I2C development
 help / color / mirror / Atom feed
From: Gao Pan <pandy.gao@nxp.com>
To: wsa@the-dreams.de, wsa-dev@sang-engineering.com, vz@mleia.com
Cc: linux-i2c@vger.kernel.org, pandy.gao@nxp.com, frank.li@nxp.com
Subject: [Patch V2] i2c: imx-lpi2c: add VLLS mode support
Date: Tue, 17 Jan 2017 15:09:27 +0800	[thread overview]
Message-ID: <1484636967-23599-1-git-send-email-pandy.gao@nxp.com> (raw)

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>
---
V2:
 -drop "#else branch" and IMX_LPI2C_PM completely
 -pm = &imx_lpi2c_pm

 drivers/i2c/busses/i2c-imx-lpi2c.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index c62b7cd..dbde95d 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -636,12 +636,33 @@ 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);
+#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,
+#ifdef CONFIG_PM_SLEEP
+		.pm = &imx_lpi2c_pm,
+#endif
 	},
 };
 
-- 
1.9.1

             reply	other threads:[~2017-01-17  7:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17  7:09 Gao Pan [this message]
2017-01-17  9:10 ` [Patch V2] i2c: imx-lpi2c: add VLLS mode support Vladimir Zapolskiy
2017-01-17 10:14   ` Pandy Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1484636967-23599-1-git-send-email-pandy.gao@nxp.com \
    --to=pandy.gao@nxp.com \
    --cc=frank.li@nxp.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=vz@mleia.com \
    --cc=wsa-dev@sang-engineering.com \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox