summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-rcar.c
diff options
context:
space:
mode:
authorWolfram Sang2018-12-19 17:48:26 +0100
committerWolfram Sang2019-01-08 21:02:52 +0100
commit18569fa89a4db9ed6b5181624788a1574a9b6ed7 (patch)
tree397fb7192f26fff193f6c97bfd6a90317e25d270 /drivers/i2c/busses/i2c-rcar.c
parenti2c: s3c2410: use core helper to mark adapter suspended (diff)
downloadkernel-qcow2-linux-18569fa89a4db9ed6b5181624788a1574a9b6ed7.tar.gz
kernel-qcow2-linux-18569fa89a4db9ed6b5181624788a1574a9b6ed7.tar.xz
kernel-qcow2-linux-18569fa89a4db9ed6b5181624788a1574a9b6ed7.zip
i2c: rcar: add suspend/resume support
Because the adapter will be set up before every transaction anyhow, we just need to mark it as suspended to the I2C core. Signed-off-by: Hiromitsu Yamasaki <hiromitsu.yamasaki.ym@renesas.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-rcar.c')
-rw-r--r--drivers/i2c/busses/i2c-rcar.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 254e6219e538..1d6390eed861 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -1017,10 +1017,35 @@ static int rcar_i2c_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+static int rcar_i2c_suspend(struct device *dev)
+{
+ struct rcar_i2c_priv *priv = dev_get_drvdata(dev);
+
+ i2c_mark_adapter_suspended(&priv->adap);
+ return 0;
+}
+
+static int rcar_i2c_resume(struct device *dev)
+{
+ struct rcar_i2c_priv *priv = dev_get_drvdata(dev);
+
+ i2c_mark_adapter_resumed(&priv->adap);
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(rcar_i2c_pm_ops, rcar_i2c_suspend, rcar_i2c_resume);
+
+#define DEV_PM_OPS (&rcar_i2c_pm_ops)
+#else
+#define DEV_PM_OPS NULL
+#endif /* CONFIG_PM_SLEEP */
+
static struct platform_driver rcar_i2c_driver = {
.driver = {
.name = "i2c-rcar",
.of_match_table = rcar_i2c_dt_ids,
+ .pm = DEV_PM_OPS,
},
.probe = rcar_i2c_probe,
.remove = rcar_i2c_remove,