[PATCH 0/3] pinctrl-amd powerbtn handling regression

From: Mario Limonciello
Date: Tue Aug 29 2023 - 15:14:31 EST


AMD GPIO controllers have a bit in one of the registers that sets debounce
to meet Windows certification requirements.

As many platforms ship Windows they enable this by default.
Linux was not using it until a bug fix commit a855724dc08b ("pinctrl: amd:
Fix mistake in handling clearing pins at startup") aligned the register
with the intended values.

On systems that program GPIOs through _AEI and handle interrupts in the
GPIO controller driver this makes them behave like Windows.

On systems that don't program GPIOs in _AEI, the interrupts aren't handled
by the GPIO controller driver this causes the GPIO to get "stuck".

It's stuck because according to the spec the interrupt is supposed to be
cleared by driver when the button is pressed less than 2s.

However as the GPIO doesn't trigger an interrupt, it can't be cleared
until another GPIO that is handled by the driver (such as touchpad).

This series adds handling behavior from the spec, but as it's not ideal
on the reported platform from the lack of interrupt to handle set a quirk
to revert the debounce behavior back to old behavior.

A module parameter is also added to let anyone else affected by this debug
it.

Mario Limonciello (3):
pinctrl: amd: Clear `Less2secSts` and `Less10secSts` for GPIO0
pinctrl: amd: Add a module parameter to configure power button
behavior
pinctrl: amd: Add a quirk for Lenovo Ideapad 5

drivers/pinctrl/pinctrl-amd.c | 70 +++++++++++++++++++++++++++++++++++
drivers/pinctrl/pinctrl-amd.h | 2 +
2 files changed, 72 insertions(+)


base-commit: b4e880a8d840e2b64937ab47ad518185c07747e3
--
2.34.1