From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: linux-i2c@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
Kuninori Morimoto <kuninori.morimoto.gx@gmail.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Wolfram Sang <wsa+renesas@sang-engineering.com>
Subject: [RFC] i2c: rcar: reinit hardware on resume
Date: Mon, 17 Apr 2017 20:32:49 +0200 [thread overview]
Message-ID: <20170417183249.19128-1-wsa+renesas@sang-engineering.com> (raw)
On resume, reinit hardware to ensure state machine and clock settings
are proper. This code assumes:
* bus clock is a fixed value, so no need to recalculate timings after probe
* handling RuntimePM is not needed, because register content is kept
when disabling the IP core clock
Tested with r8a7796 (M3-W) and r8a7790 (H2).
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
@Geert: do you agree to my assumptions?
drivers/i2c/busses/i2c-rcar.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 26f2ff22e97e55..7010c77df11daa 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -907,10 +907,27 @@ static int rcar_i2c_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+static int rcar_i2c_resume(struct device *dev)
+{
+ struct rcar_i2c_priv *priv = dev_get_drvdata(dev);
+
+ rcar_i2c_init(priv);
+
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(rcar_i2c_pm, NULL, rcar_i2c_resume);
+#define RCAR_I2C_PM (&rcar_i2c_pm)
+#else
+#define RCAR_I2C_PM NULL
+#endif
+
static struct platform_driver rcar_i2c_driver = {
.driver = {
.name = "i2c-rcar",
.of_match_table = rcar_i2c_dt_ids,
+ .pm = RCAR_I2C_PM,
},
.probe = rcar_i2c_probe,
.remove = rcar_i2c_remove,
--
2.11.0
next reply other threads:[~2017-04-17 18:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-17 18:32 Wolfram Sang [this message]
2017-04-18 0:35 ` [RFC] i2c: rcar: reinit hardware on resume Kuninori Morimoto
2017-04-18 7:07 ` Wolfram Sang
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=20170417183249.19128-1-wsa+renesas@sang-engineering.com \
--to=wsa+renesas@sang-engineering.com \
--cc=geert@linux-m68k.org \
--cc=kuninori.morimoto.gx@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).