i2c: tegra: Restore pinmux on system resume
authorThierry Reding <treding@nvidia.com>
Fri, 13 Dec 2019 13:44:17 +0000 (14:44 +0100)
committerThierry Reding <treding@nvidia.com>
Fri, 8 May 2020 10:42:11 +0000 (12:42 +0200)
commit44c99904cf61f945d02ac9976ab10dd5ccaea393
tree60ca5bf48ec59ff89df71e912dc228ea15227d29
parent78ad73421831247e46c31899a7bead02740e4bef
i2c: tegra: Restore pinmux on system resume

Depending on the board design, the I2C controllers found on Tegra SoCs
may require pinmuxing in order to function. This is done as part of the
driver's runtime suspend/resume operations. However, the PM core does
not allow devices to go into runtime suspend during system sleep to
avoid potential races with the suspend/resume of their parents.

As a result of this, when Tegra SoCs resume from system suspend, their
I2C controllers may have lost the pinmux state in hardware, whereas the
pinctrl subsystem is not aware of this. To fix this, make sure that if
the I2C controller is not runtime suspended, the runtime suspend code is
still executed in order to disable the module clock (which we don't need
to be enabled during sleep) and set the pinmux to the idle state.

Conversely, make sure that the I2C controller is properly resumed when
waking up from sleep so that pinmux settings are properly restored.

This fixes a bug seen with DDC transactions to an HDMI monitor timing
out when resuming from system suspend.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/i2c/busses/i2c-tegra.c