[v4,1/8] i2c: tegra: Fix suspending in active runtime PM state
diff mbox series

Message ID 20200112171430.27219-2-digetx@gmail.com
State Changes Requested
Headers show
  • NVIDIA Tegra I2C driver fixes and improvements
Related show

Commit Message

Dmitry Osipenko Jan. 12, 2020, 5:14 p.m. UTC
I noticed that sometime I2C clock is kept enabled during suspend-resume.
This happens because runtime PM defers dynamic suspension and thus it may
happen that runtime PM is in active state when system enters into suspend.
In particular I2C controller that is used for CPU's DVFS is often kept ON
during suspend because CPU's voltage scaling happens quite often.

Fixes: 8ebf15e9c869 ("i2c: tegra: Move suspend handling to NOIRQ phase")
Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
 drivers/i2c/busses/i2c-tegra.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff mbox series

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index a98bf31d0e5c..79d19f6ce94e 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -1710,9 +1710,14 @@  static int tegra_i2c_remove(struct platform_device *pdev)
 static int __maybe_unused tegra_i2c_suspend(struct device *dev)
 	struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev);
+	int err;
+	err = pm_runtime_force_suspend(dev);
+	if (err < 0)
+		return err;
 	return 0;
@@ -1733,6 +1738,10 @@  static int __maybe_unused tegra_i2c_resume(struct device *dev)
 	if (err)
 		return err;
+	err = pm_runtime_force_resume(dev);
+	if (err < 0)
+		return err;
 	return 0;