Skip to content

Commit 8ff4fb2

Browse files
superm1Linus Walleij
authored andcommitted
pinctrl: amd: Clear GPIO debounce for suspend
soc-button-array hardcodes a debounce value by means of gpio_keys which uses pinctrl-amd as a backend to program debounce for a GPIO. This hardcoded value doesn't match what the firmware intended to be programmed in _AEI. The hardcoded debounce leads to problems waking from suspend. There isn't appetite to conditionalize the behavior in soc-button-array or gpio-keys so clear it when the system suspends to avoid problems with being able to resume. Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Hans de Goede <hansg@kernel.org> Fixes: 5c4fa2a ("Input: soc_button_array - debounce the buttons") Link: https://lore.kernel.org/linux-input/mkgtrb5gt7miyg6kvqdlbu4nj3elym6ijudobpdi26gp4xxay5@rsa6ytrjvj2q/ Link: https://lore.kernel.org/linux-input/20250625215813.3477840-1-superm1@kernel.org/ Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Hans de Goede <hansg@kernel.org> Link: https://lore.kernel.org/20250627150155.3311574-1-superm1@kernel.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 4614749 commit 8ff4fb2

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

drivers/pinctrl/pinctrl-amd.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,17 @@ static int amd_gpio_suspend_hibernate_common(struct device *dev, bool is_suspend
979979
pin, is_suspend ? "suspend" : "hibernate");
980980
}
981981

982+
/*
983+
* debounce enabled over suspend has shown issues with a GPIO
984+
* being unable to wake the system, as we're only interested in
985+
* the actual wakeup event, clear it.
986+
*/
987+
if (gpio_dev->saved_regs[i] & (DB_CNTRl_MASK << DB_CNTRL_OFF)) {
988+
amd_gpio_set_debounce(gpio_dev, pin, 0);
989+
pm_pr_dbg("Clearing debounce for GPIO #%d during %s.\n",
990+
pin, is_suspend ? "suspend" : "hibernate");
991+
}
992+
982993
raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
983994
}
984995

0 commit comments

Comments
 (0)