Re: [PATCH] i2c: designware: add reset control support in suspend/resume

From: Andy Shevchenko

Date: Tue Mar 10 2026 - 15:22:50 EST


On Tue, Mar 10, 2026 at 09:40:45PM +0300, Artem Shimko wrote:
> The driver currently acquires reset control during probe but does not
> manage it during system suspend/resume. This can leave the I2C controller
> in an undefined state after resume.
>
> Add reset control assertion during system suspend and deassertion during
> resume to ensure proper hardware initialization across power management
> transitions. Skip runtime suspend if the device is already suspended to
> avoid redundant operations.

...

> +#ifdef CONFIG_ACPI

Why?

> static int i2c_dw_prepare(struct device *device)
> {
> /*

> */
> return !has_acpi_companion(device);
> }
> +#endif

...

> EXPORT_GPL_DEV_PM_OPS(i2c_dw_dev_pm_ops) = {
> +#ifdef CONFIG_ACPI
> .prepare = pm_sleep_ptr(i2c_dw_prepare),
> LATE_SYSTEM_SLEEP_PM_OPS(i2c_dw_suspend, i2c_dw_resume)
> +#else
> + SYSTEM_SLEEP_PM_OPS(i2c_dw_suspend, i2c_dw_resume)
> +#endif

Why?

Usually we try to avoid _adding_ ugly ifdeffery. Can you elaborate why the
change is needed in the first place and why there is no better way to handle
it?

> RUNTIME_PM_OPS(i2c_dw_runtime_suspend, i2c_dw_runtime_resume, NULL)
> };

--
With Best Regards,
Andy Shevchenko