Commit 9f42de8d authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Wolfram Sang

i2c: tegra: Fix suspending in active runtime PM state

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: 8ebf15e9 ("i2c: tegra: Move suspend handling to NOIRQ phase")
Cc: <stable@vger.kernel.org> # v5.4+
Tested-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarDmitry Osipenko <digetx@gmail.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent b3a987b0
...@@ -1710,9 +1710,14 @@ static int tegra_i2c_remove(struct platform_device *pdev) ...@@ -1710,9 +1710,14 @@ static int tegra_i2c_remove(struct platform_device *pdev)
static int __maybe_unused tegra_i2c_suspend(struct device *dev) static int __maybe_unused tegra_i2c_suspend(struct device *dev)
{ {
struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev); struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev);
int err;
i2c_mark_adapter_suspended(&i2c_dev->adapter); i2c_mark_adapter_suspended(&i2c_dev->adapter);
err = pm_runtime_force_suspend(dev);
if (err < 0)
return err;
return 0; return 0;
} }
...@@ -1733,6 +1738,10 @@ static int __maybe_unused tegra_i2c_resume(struct device *dev) ...@@ -1733,6 +1738,10 @@ static int __maybe_unused tegra_i2c_resume(struct device *dev)
if (err) if (err)
return err; return err;
err = pm_runtime_force_resume(dev);
if (err < 0)
return err;
i2c_mark_adapter_resumed(&i2c_dev->adapter); i2c_mark_adapter_resumed(&i2c_dev->adapter);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment