]> exis.tech > repos - linux.git/commit
i2c: imx: fix clock and pinctrl state inconsistency in runtime PM
authorCarlos Song <carlos.song@nxp.com>
Thu, 21 May 2026 06:50:38 +0000 (14:50 +0800)
committerAndi Shyti <andi.shyti@kernel.org>
Mon, 8 Jun 2026 17:43:05 +0000 (19:43 +0200)
commit8783fb8031799f1230997c16df8c8dce9fcd1841
tree88e0229da2131442cc0cc89aa8e396d95b75e959
parent9c37eac31c559b079d55890d1dbe70072fec0435
i2c: imx: fix clock and pinctrl state inconsistency in runtime PM

In i2c_imx_runtime_suspend(), the clock is disabled before switching
the pinctrl state to sleep. If pinctrl_pm_select_sleep_state() fails,
the runtime suspend is aborted but the clock remains disabled, causing
a system crash when the hardware is subsequently accessed.

Fix this by switching the pinctrl state before disabling the clock so
that a pinctrl failure leaves the clock enabled and the hardware
accessible.

In i2c_imx_runtime_resume(), restore the pinctrl state back to sleep
if clk_enable() fails to keep the consistent.

Fixes: 576eba03c994 ("i2c: imx: switch different pinctrl state in different system power status")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Cc: <stable@vger.kernel.org> # v6.14+
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260521065038.2954998-1-carlos.song@oss.nxp.com
drivers/i2c/busses/i2c-imx.c