From: Mario Limonciello <superm1@kernel.org>
To: Hans de Goede <hansg@kernel.org>,
Mika Westerberg <westeri@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-gpio@vger.kernel.org (open list:GPIO ACPI SUPPORT),
linux-acpi@vger.kernel.org (open list:GPIO ACPI SUPPORT),
linux-kernel@vger.kernel.org (open list),
linux-input@vger.kernel.org (open list:INPUT (KEYBOARD, MOUSE,
JOYSTICK, TOUCHSCREEN)...),
Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH v2 3/3] Input: soc_button_array: Only debounce cherryview and baytrail systems
Date: Wed, 25 Jun 2025 13:13:42 -0500 [thread overview]
Message-ID: <20250625181342.3175969-4-superm1@kernel.org> (raw)
In-Reply-To: <20250625181342.3175969-1-superm1@kernel.org>
From: Mario Limonciello <mario.limonciello@amd.com>
commit 5c4fa2a6da7fb ("Input: soc_button_array - debounce the buttons")
hardcoded all soc-button-array devices to use a 50ms debounce timeout
but this doesn't work on all hardware. The hardware I have on hand
actually prescribes in the ASL that the timeout should be 0:
GpioInt (Edge, ActiveBoth, Exclusive, PullUp, 0x0000,
"\\_SB.GPIO", 0x00, ResourceConsumer, ,)
{ // Pin list
0x0000
}
Many cherryview and baytrail systems don't have accurate values in the
ASL for debouncing and thus use software debouncing in gpio_keys. The
value to use is programmed in soc_button_array. Detect Cherry View
and Baytrail using ACPI HID IDs used for those GPIO controllers and apply
the 50ms only for those systems.
Cc: Hans de Goede <hansg@kernel.org>
Fixes: 5c4fa2a6da7fb ("Input: soc_button_array - debounce the buttons")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2:
* commit message
* quirk systems instead of revert
---
drivers/input/misc/soc_button_array.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index b8cad415c62ca..56abc93f23e0c 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -129,6 +129,13 @@ static const struct dmi_system_id dmi_invalid_acpi_index[] = {
{} /* Terminating entry */
};
+static const struct acpi_device_id force_software_debounce_ids[] = {
+ { "INT33FF" },
+ { "INT33B2" },
+ { "INT33FC" },
+ { }
+};
+
/*
* Get the Nth GPIO number from the ACPI object.
*/
@@ -149,11 +156,17 @@ static int soc_button_lookup_gpio(struct device *dev, int acpi_index,
return 0;
}
+static int soc_button_match_acpi_device_ids(struct device *dev, const void *data)
+{
+ return acpi_match_device(data, dev) ? 1 : 0;
+}
+
static struct platform_device *
soc_button_device_create(struct platform_device *pdev,
const struct soc_button_info *button_info,
bool autorepeat)
{
+ struct device *quirkdev __free(put_device) = NULL;
const struct soc_button_info *info;
struct platform_device *pd;
struct gpio_keys_button *gpio_keys;
@@ -181,6 +194,10 @@ soc_button_device_create(struct platform_device *pdev,
if (dmi_id)
invalid_acpi_index = (long)dmi_id->driver_data;
+ quirkdev = bus_find_device(&platform_bus_type, NULL,
+ force_software_debounce_ids,
+ soc_button_match_acpi_device_ids);
+
for (info = button_info; info->name; info++) {
if (info->autorepeat != autorepeat)
continue;
@@ -220,7 +237,8 @@ soc_button_device_create(struct platform_device *pdev,
gpio_keys[n_buttons].desc = info->name;
gpio_keys[n_buttons].wakeup = info->wakeup;
/* These devices often use cheap buttons, use 50 ms debounce */
- gpio_keys[n_buttons].debounce_interval = 50;
+ if (quirkdev)
+ gpio_keys[n_buttons].debounce_interval = 50;
n_buttons++;
}
--
2.43.0
next prev parent reply other threads:[~2025-06-25 18:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 18:13 [PATCH v2 0/3] Fix soc-button-array debounce Mario Limonciello
2025-06-25 18:13 ` [PATCH v2 1/3] gpiolib: acpi: Add a helper for programming debounce Mario Limonciello
2025-06-25 18:58 ` Hans de Goede
2025-06-25 18:13 ` [PATCH v2 2/3] gpiolib: acpi: Program debounce when finding GPIO Mario Limonciello
2025-06-25 18:58 ` Hans de Goede
2025-06-25 18:13 ` Mario Limonciello [this message]
2025-06-25 19:03 ` [PATCH v2 3/3] Input: soc_button_array: Only debounce cherryview and baytrail systems Hans de Goede
2025-06-25 19:23 ` Mario Limonciello
2025-06-25 19:42 ` Hans de Goede
2025-06-25 20:34 ` Mario Limonciello
2025-06-26 18:27 ` Dmitry Torokhov
2025-06-26 18:30 ` Mario Limonciello
2025-06-26 18:53 ` Dmitry Torokhov
2025-06-26 18:58 ` Mario Limonciello
2025-06-26 19:04 ` Hans de Goede
2025-06-26 19:32 ` Dmitry Torokhov
2025-06-26 19:37 ` Mario Limonciello
2025-06-26 19:54 ` Dmitry Torokhov
2025-06-26 21:39 ` Mario Limonciello
2025-06-27 5:08 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250625181342.3175969-4-superm1@kernel.org \
--to=superm1@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=dmitry.torokhov@gmail.com \
--cc=hansg@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=westeri@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox