Re: [PATCH v2] pinctrl: amd: Fix wakeups when IRQ is shared with SCI

From: Andy Shevchenko
Date: Tue Oct 19 2021 - 06:05:20 EST


On Tue, Oct 19, 2021 at 6:27 AM Mario Limonciello
<mario.limonciello@xxxxxxx> wrote:
>
> On some Lenovo AMD Gen2 platforms the IRQ for the SCI and pinctrl drivers
> are shared. Due to how the s2idle loop handling works, this case needs
> an extra explicit check whether the interrupt was caused by SCI or by
> the GPIO controller.
>
> To fix this rework the existing IRQ handler function to function as a
> checker and an IRQ handler depending on the calling arguments.
>
> BugLink: https://gitlab.freedesktop.org/drm/amd/-/issues/1738

Should it have a Fixes tag?

> Reported-by: Joerie de Gram <j.de.gram@xxxxxxxxx>
> Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>

...

> +#ifdef CONFIG_ACPI

__maybe_unused?

> +static bool amd_gpio_check_wake(void *dev_id)
> +{
> + return _amd_gpio_irq_handler(-1, dev_id);
> +}
> +#endif

...

> +#ifdef CONFIG_ACPI
> + acpi_register_wakeup_handler(gpio_dev->irq, amd_gpio_check_wake, gpio_dev);
> +#endif

Not what I expected.

...

> +#ifdef CONFIG_ACPI
> + acpi_unregister_wakeup_handler(amd_gpio_check_wake, gpio_dev);
> +#endif

Ditto.

Yes, I see the problem, perhaps you need to add the stubs. If this is
a real regression fix, then probably this patch should follow by two:
adding stubs, removing ugly ifdeffery here. Otherwise, introduce stubs
as patch 1 preceding this one in a series.

--
With Best Regards,
Andy Shevchenko