* [PATCH v2] pinctrl: amd: Clear GPIO debounce for suspend
@ 2025-06-27 15:01 Mario Limonciello
2025-06-27 15:56 ` Hans de Goede
2025-07-03 22:25 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Mario Limonciello @ 2025-06-27 15:01 UTC (permalink / raw)
To: mario.limonciello, Basavaraj.Natikar, Shyam-sundar.S-k,
linus.walleij, dmitry.torokhov, hansg
Cc: linux-gpio
From: Mario Limonciello <mario.limonciello@amd.com>
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: 5c4fa2a6da7fb ("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>
---
v2:
* clarify comment for pinctrl (Hans)
---
drivers/pinctrl/pinctrl-amd.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
index 5cf3db6d78b79..b3f0d02aeeb35 100644
--- a/drivers/pinctrl/pinctrl-amd.c
+++ b/drivers/pinctrl/pinctrl-amd.c
@@ -979,6 +979,17 @@ static int amd_gpio_suspend_hibernate_common(struct device *dev, bool is_suspend
pin, is_suspend ? "suspend" : "hibernate");
}
+ /*
+ * debounce enabled over suspend has shown issues with a GPIO
+ * being unable to wake the system, as we're only interested in
+ * the actual wakeup event, clear it.
+ */
+ if (gpio_dev->saved_regs[i] & (DB_CNTRl_MASK << DB_CNTRL_OFF)) {
+ amd_gpio_set_debounce(gpio_dev, pin, 0);
+ pm_pr_dbg("Clearing debounce for GPIO #%d during %s.\n",
+ pin, is_suspend ? "suspend" : "hibernate");
+ }
+
raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] pinctrl: amd: Clear GPIO debounce for suspend
2025-06-27 15:01 [PATCH v2] pinctrl: amd: Clear GPIO debounce for suspend Mario Limonciello
@ 2025-06-27 15:56 ` Hans de Goede
2025-07-03 22:25 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2025-06-27 15:56 UTC (permalink / raw)
To: Mario Limonciello, mario.limonciello, Basavaraj.Natikar,
Shyam-sundar.S-k, linus.walleij, dmitry.torokhov
Cc: linux-gpio
Hi,
On 27-Jun-25 5:01 PM, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
>
> 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: 5c4fa2a6da7fb ("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>
> ---
> v2:
> * clarify comment for pinctrl (Hans)
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hansg@kernel.org>
Regards,
Hans
> ---
> drivers/pinctrl/pinctrl-amd.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
> index 5cf3db6d78b79..b3f0d02aeeb35 100644
> --- a/drivers/pinctrl/pinctrl-amd.c
> +++ b/drivers/pinctrl/pinctrl-amd.c
> @@ -979,6 +979,17 @@ static int amd_gpio_suspend_hibernate_common(struct device *dev, bool is_suspend
> pin, is_suspend ? "suspend" : "hibernate");
> }
>
> + /*
> + * debounce enabled over suspend has shown issues with a GPIO
> + * being unable to wake the system, as we're only interested in
> + * the actual wakeup event, clear it.
> + */
> + if (gpio_dev->saved_regs[i] & (DB_CNTRl_MASK << DB_CNTRL_OFF)) {
> + amd_gpio_set_debounce(gpio_dev, pin, 0);
> + pm_pr_dbg("Clearing debounce for GPIO #%d during %s.\n",
> + pin, is_suspend ? "suspend" : "hibernate");
> + }
> +
> raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] pinctrl: amd: Clear GPIO debounce for suspend
2025-06-27 15:01 [PATCH v2] pinctrl: amd: Clear GPIO debounce for suspend Mario Limonciello
2025-06-27 15:56 ` Hans de Goede
@ 2025-07-03 22:25 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2025-07-03 22:25 UTC (permalink / raw)
To: Mario Limonciello
Cc: mario.limonciello, Basavaraj.Natikar, Shyam-sundar.S-k,
dmitry.torokhov, hansg, linux-gpio
On Fri, Jun 27, 2025 at 5:02 PM Mario Limonciello <superm1@kernel.org> wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
>
> 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: 5c4fa2a6da7fb ("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>
Patch applied for fixes!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-03 22:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 15:01 [PATCH v2] pinctrl: amd: Clear GPIO debounce for suspend Mario Limonciello
2025-06-27 15:56 ` Hans de Goede
2025-07-03 22:25 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).