linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [REGRESSION FIX resend 0/1] gpiolib: acpi: Make set debounce errors non fatal
@ 2025-10-22 13:37 Hans de Goede
  2025-10-22 13:37 ` [REGRESSION FIX resend 1/1] " Hans de Goede
  0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2025-10-22 13:37 UTC (permalink / raw)
  To: Mika Westerberg, Andy Shevchenko, Bartosz Golaszewski,
	Linus Walleij
  Cc: Hans de Goede, linux-gpio, linux-acpi

Hi All,

AFAICT we are all in agreement to move forward with this regression
fix (1) as is. Yet I'm still not seeing this in Torvald's master branch
a month after submitting this fix.

Can we please get this *regression fix* merged ASAP?

Regards,

Hans


1) https://lore.kernel.org/linux-gpio/20250920201200.20611-1-hansg@kernel.org/


Hans de Goede (1):
  gpiolib: acpi: Make set debounce errors non fatal

 drivers/gpio/gpiolib-acpi-core.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

-- 
2.51.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [REGRESSION FIX resend 1/1] gpiolib: acpi: Make set debounce errors non fatal
  2025-10-22 13:37 [REGRESSION FIX resend 0/1] gpiolib: acpi: Make set debounce errors non fatal Hans de Goede
@ 2025-10-22 13:37 ` Hans de Goede
  2025-10-22 13:47   ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2025-10-22 13:37 UTC (permalink / raw)
  To: Mika Westerberg, Andy Shevchenko, Bartosz Golaszewski,
	Linus Walleij
  Cc: Hans de Goede, linux-gpio, linux-acpi, stable, Mario Limonciello

Commit 16c07342b542 ("gpiolib: acpi: Program debounce when finding GPIO")
adds a gpio_set_debounce_timeout() call to acpi_find_gpio() and makes
acpi_find_gpio() fail if this fails.

But gpio_set_debounce_timeout() failing is a somewhat normal occurrence,
since not all debounce values are supported on all GPIO/pinctrl chips.

Making this an error for example break getting the card-detect GPIO for
the micro-sd slot found on many Bay Trail tablets, breaking support for
the micro-sd slot on these tablets.

acpi_request_own_gpiod() already treats gpio_set_debounce_timeout()
failures as non-fatal, just warning about them.

Add a acpi_gpio_set_debounce_timeout() helper which wraps
gpio_set_debounce_timeout() and warns on failures and replace both existing
gpio_set_debounce_timeout() calls with the helper.

Since the helper only warns on failures this fixes the card-detect issue.

Fixes: 16c07342b542 ("gpiolib: acpi: Program debounce when finding GPIO")
Cc: stable@vger.kernel.org
Cc: Mario Limonciello <superm1@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
---
 drivers/gpio/gpiolib-acpi-core.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi-core.c b/drivers/gpio/gpiolib-acpi-core.c
index 284e762d92c4..67c4c38afb86 100644
--- a/drivers/gpio/gpiolib-acpi-core.c
+++ b/drivers/gpio/gpiolib-acpi-core.c
@@ -291,6 +291,19 @@ acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio, int polarity)
 	return GPIOD_ASIS;
 }
 
+static void acpi_gpio_set_debounce_timeout(struct gpio_desc *desc,
+					   unsigned int acpi_debounce)
+{
+	int ret;
+
+	/* ACPI uses hundredths of milliseconds units */
+	acpi_debounce *= 10;
+	ret = gpio_set_debounce_timeout(desc, acpi_debounce);
+	if (ret)
+		gpiod_warn(desc, "Failed to set debounce-timeout %u: %d\n",
+			   acpi_debounce, ret);
+}
+
 static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip,
 						struct acpi_resource_gpio *agpio,
 						unsigned int index,
@@ -300,18 +313,12 @@ static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip,
 	enum gpiod_flags flags = acpi_gpio_to_gpiod_flags(agpio, polarity);
 	unsigned int pin = agpio->pin_table[index];
 	struct gpio_desc *desc;
-	int ret;
 
 	desc = gpiochip_request_own_desc(chip, pin, label, polarity, flags);
 	if (IS_ERR(desc))
 		return desc;
 
-	/* ACPI uses hundredths of milliseconds units */
-	ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout * 10);
-	if (ret)
-		dev_warn(chip->parent,
-			 "Failed to set debounce-timeout for pin 0x%04X, err %d\n",
-			 pin, ret);
+	acpi_gpio_set_debounce_timeout(desc, agpio->debounce_timeout);
 
 	return desc;
 }
@@ -944,7 +951,6 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
 	bool can_fallback = acpi_can_fallback_to_crs(adev, con_id);
 	struct acpi_gpio_info info = {};
 	struct gpio_desc *desc;
-	int ret;
 
 	desc = __acpi_find_gpio(fwnode, con_id, idx, can_fallback, &info);
 	if (IS_ERR(desc))
@@ -959,10 +965,7 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
 	acpi_gpio_update_gpiod_flags(dflags, &info);
 	acpi_gpio_update_gpiod_lookup_flags(lookupflags, &info);
 
-	/* ACPI uses hundredths of milliseconds units */
-	ret = gpio_set_debounce_timeout(desc, info.debounce * 10);
-	if (ret)
-		return ERR_PTR(ret);
+	acpi_gpio_set_debounce_timeout(desc, info.debounce);
 
 	return desc;
 }
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [REGRESSION FIX resend 1/1] gpiolib: acpi: Make set debounce errors non fatal
  2025-10-22 13:37 ` [REGRESSION FIX resend 1/1] " Hans de Goede
@ 2025-10-22 13:47   ` Andy Shevchenko
  2025-10-23  6:39     ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2025-10-22 13:47 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Mika Westerberg, Andy Shevchenko, Bartosz Golaszewski,
	Linus Walleij, linux-gpio, linux-acpi, stable, Mario Limonciello

On Wed, Oct 22, 2025 at 4:37 PM Hans de Goede <hansg@kernel.org> wrote:
>
> Commit 16c07342b542 ("gpiolib: acpi: Program debounce when finding GPIO")
> adds a gpio_set_debounce_timeout() call to acpi_find_gpio() and makes
> acpi_find_gpio() fail if this fails.
>
> But gpio_set_debounce_timeout() failing is a somewhat normal occurrence,
> since not all debounce values are supported on all GPIO/pinctrl chips.
>
> Making this an error for example break getting the card-detect GPIO for
> the micro-sd slot found on many Bay Trail tablets, breaking support for
> the micro-sd slot on these tablets.
>
> acpi_request_own_gpiod() already treats gpio_set_debounce_timeout()
> failures as non-fatal, just warning about them.
>
> Add a acpi_gpio_set_debounce_timeout() helper which wraps
> gpio_set_debounce_timeout() and warns on failures and replace both existing
> gpio_set_debounce_timeout() calls with the helper.
>
> Since the helper only warns on failures this fixes the card-detect issue.

Acked-by: Andy Shevchenko <andy@kernel.org>
if Bart wants to take this directly.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [REGRESSION FIX resend 1/1] gpiolib: acpi: Make set debounce errors non fatal
  2025-10-22 13:47   ` Andy Shevchenko
@ 2025-10-23  6:39     ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-10-23  6:39 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Hans de Goede, Mika Westerberg, Andy Shevchenko,
	Bartosz Golaszewski, Linus Walleij, linux-gpio, linux-acpi,
	stable, Mario Limonciello

On Wed, Oct 22, 2025 at 04:47:34PM +0300, Andy Shevchenko wrote:
> On Wed, Oct 22, 2025 at 4:37 PM Hans de Goede <hansg@kernel.org> wrote:
> >
> > Commit 16c07342b542 ("gpiolib: acpi: Program debounce when finding GPIO")
> > adds a gpio_set_debounce_timeout() call to acpi_find_gpio() and makes
> > acpi_find_gpio() fail if this fails.
> >
> > But gpio_set_debounce_timeout() failing is a somewhat normal occurrence,
> > since not all debounce values are supported on all GPIO/pinctrl chips.
> >
> > Making this an error for example break getting the card-detect GPIO for
> > the micro-sd slot found on many Bay Trail tablets, breaking support for
> > the micro-sd slot on these tablets.
> >
> > acpi_request_own_gpiod() already treats gpio_set_debounce_timeout()
> > failures as non-fatal, just warning about them.
> >
> > Add a acpi_gpio_set_debounce_timeout() helper which wraps
> > gpio_set_debounce_timeout() and warns on failures and replace both existing
> > gpio_set_debounce_timeout() calls with the helper.
> >
> > Since the helper only warns on failures this fixes the card-detect issue.
> 
> Acked-by: Andy Shevchenko <andy@kernel.org>
> if Bart wants to take this directly.

Never mind, it seems we gotta fix an LKP thingy, I'm about to send a PR out of
two patches.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-23  6:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22 13:37 [REGRESSION FIX resend 0/1] gpiolib: acpi: Make set debounce errors non fatal Hans de Goede
2025-10-22 13:37 ` [REGRESSION FIX resend 1/1] " Hans de Goede
2025-10-22 13:47   ` Andy Shevchenko
2025-10-23  6:39     ` Andy Shevchenko

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).