Re: [PATCH] i2c: designware: add reset control support in suspend/resume
From: Andy Shevchenko
Date: Wed Mar 11 2026 - 08:11:13 EST
On Wed, Mar 11, 2026 at 09:20:25AM +0300, Artem Shimko wrote:
> Hi Andy,
> On Tue, Mar 10, 2026 at 10:22 PM Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > 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?
>
> The conditional compilation is needed because ACPI and DT platforms have
> different requirements for system suspend/resume ordering: ACPI
> platforms require LATE_SUSPEND/EARLY_RESUME
> to support I2C operation regions, which may be accessed during
> suspend/resume of other devices. DT platforms don't have
> this requirement, but using LATE/EARLY callbacks causes problems
> because the I2C controller's dependencies (reset controller,
> clock controller) are not yet available at that stage, leading to hangs.
>
> However, I agree that adding ifdefs is not ideal.
>
> I have a couple ideas for v2, could you please advise which one is
> better from your point of view?
> 1. Splitting PM ops into separate structures for ACPI and DT
> 2. Using has_acpi_companion() checks in the resume callbacks
The second option is inline with the current approach in .prepare(),
so at least it would be easier to sell to the maintainers.
The first one will still require some ifdeffery if I am not mistaken.
(Or at least the similar has_acpi_companion() check.)
--
With Best Regards,
Andy Shevchenko