Skip to content

Commit 8ff4fb2

Browse files
superm1linusw
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 <[email protected]> Cc: Hans de Goede <[email protected]> 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/[email protected]/ Signed-off-by: Mario Limonciello <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 4614749 commit 8ff4fb2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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)