[PATCH 5/5] i3c: dw: Resume the controller before unregistering the bus
Frank Li
Frank.li at oss.nxp.com
Wed Aug 5 12:57:00 PDT 2026
On Tue, Aug 04, 2026 at 10:13:01AM +0000, Akhil R wrote:
> dw_i3c_common_remove() unregisters the I3C bus without resuming the
> device first. i3c_master_unregister() ends up in
> dw_i3c_master_bus_cleanup(), which writes DEVICE_CTRL, so unbinding the
> driver while the controller is runtime suspended accesses registers with
> the clocks gated and the reset asserted, which hangs or aborts on most
> platforms.
>
> Resume the device around the unregistration and drop the reference
> before runtime PM is disabled, so the clocks are running for the
> register accesses and the state stays balanced.
common driver already support i3c_master_rpm_get()
Does it fix this problem by set rpm_allowed true?
Frank
>
> Fixes: 62fe9d06f570 ("i3c: dw: Add power management support")
> Reported-by: Sashiko AI review <sashiko-bot at kernel.org>
> Closes: https://lore.kernel.org/all/20260728071757.5B3CD1F000E9@smtp.kernel.org/
> Cc: stable at vger.kernel.org
> Assisted-by: Cursor:claude-opus-5
> Signed-off-by: Akhil R <akhilrajeev at nvidia.com>
> ---
> drivers/i3c/master/dw-i3c-master.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 17e1dd4fb5f3..df542ab7744b 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -1723,8 +1723,20 @@ EXPORT_SYMBOL_GPL(dw_i3c_common_probe);
>
> void dw_i3c_common_remove(struct dw_i3c_master *master)
> {
> + int ret;
> +
> + /* Unregistering the bus accesses the controller registers */
> + ret = pm_runtime_resume_and_get(master->dev);
> + if (ret < 0)
> + dev_err(master->dev,
> + "<%s> cannot resume i3c bus master, err: %d\n",
> + __func__, ret);
> +
> i3c_master_unregister(&master->base);
>
> + if (ret >= 0)
> + pm_runtime_put_noidle(master->dev);
> +
> /* Balance pm_runtime_get_noresume() from probe() */
> if (master->quirks & DW_I3C_DISABLE_RUNTIME_PM_QUIRK)
> pm_runtime_put_noidle(master->dev);
> --
> 2.43.0
>
More information about the linux-i3c
mailing list