Skip to contentSkip to conversation

Fix some more fallout from GPIOs from _CRS

PATCH Applied Mario Limonciello 5 participants 13 messages Jan 21, 2023 – Jan 27, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Fix some more fallout from GPIOs from _CRS

Raul's series that let GPIOs be enabled based on ACPI tables caused some fallout on systems that don't support s2idle.

When systems were suspended they either immediately woke up or never (appeared) to enter suspend.

This affected at least 2 System76 systems (pang10/pang11) as well as two Lenovo laptops (X13 G2a/T14 G2a).

Initially the solution was developed as a quirk for these 4 systems, but then it was discovered the systems are ONLY affected when set to S3 instead of s2idle in BIOS setup.

To fix the regression, don't set wake capable for those GPIOs unless the system claims to support low power idle in the FADT.

This effectively restores the behavior from before
commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") but only when utilized with S3.

Mario Limonciello (2):
pinctrl: amd: Fix debug output for debounce time
gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

 drivers/gpio/gpiolib-acpi.c   | 3 ++-
 drivers/pinctrl/pinctrl-amd.c | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 pinctrl: amd: Fix debug output for debounce time

If one GPIO has debounce enabled but future GPIOs in the list don't have debounce the time never gets reset and shows wrong value.

---
 drivers/pinctrl/pinctrl-amd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pinctrl/pinctrl-amd.c +1 -0
index 9bc6e3922e78e..32c3edaf90385 100644
@@ -365,6 +365,7 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
 
 			} else {
 				debounce_enable = "  ∅";
+				time = 0;
 			}
 			snprintf(debounce_value, sizeof(debounce_value), "%u", time * unit);
 			seq_printf(s, "debounce %s (🕑 %sus)| ", debounce_enable, debounce_value);
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 1/2] pinctrl: amd: Fix debug output for debounce time

Quoted 4 lines · Mario Limonciello

If one GPIO has debounce enabled but future GPIOs in the list don't have debounce the time never gets reset and shows wrong value.

Patch applied for fixes.

Yours,
Lijnus Walleij

#3 lore raw

PATCH 2/2 gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

In reply to Mario Limonciello

commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") adjusted the policy to enable wakeup by default if the ACPI tables indicated that a device was wake capable.

It was reported however that this broke suspend on at least two System76 systems in S3 mode and two Lenovo Gen2a systems, but only with S3. When the machines are set to s2idle, wakeup behaves properly.

Configuring the GPIOs for wakeup with S3 doesn't work properly, so only set it when the system supports low power idle.

Fixes 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable")
Fixes b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set wake_irq")
---
 drivers/gpio/gpiolib-acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib-acpi.c +2 -1
index 9ef0f5641b521..17c53f484280f 100644
@@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in
 				dev_dbg(&adev->dev, "IRQ %d already in use\n", irq);
 			}
 
-			if (wake_capable)
+			/* avoid suspend issues with GPIOs when systems are using S3 */
+			if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
 				*wake_capable = info.wake_capable;
 
 			return irq;
Signature · 1 line
2.34.1
Acked-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

Quoted 10 lines · Mario Limonciello

commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") adjusted the policy to enable wakeup by default if the ACPI tables indicated that a device was wake capable.

It was reported however that this broke suspend on at least two System76 systems in S3 mode and two Lenovo Gen2a systems, but only with S3. When the machines are set to s2idle, wakeup behaves properly.

Configuring the GPIOs for wakeup with S3 doesn't work properly, so only set it when the system supports low power idle.

Fine by me,

Quoted 29 lines
Fixes 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable")
Fixes b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set wake_irq")
---
 drivers/gpio/gpiolib-acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib-acpi.c +2 -1
index 9ef0f5641b521..17c53f484280f 100644
@@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in
 				dev_dbg(&adev->dev, "IRQ %d already in use\n", irq);
 			}
 
-			if (wake_capable)
+			/* avoid suspend issues with GPIOs when systems are using S3 */
+			if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
 				*wake_capable = info.wake_capable;
 
 			return irq;
Signature · 1 line
2.34.1
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw

Re: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

In reply to Mario Limonciello
Quoted 39 lines · Mario Limonciello

commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") adjusted the policy to enable wakeup by default if the ACPI tables indicated that a device was wake capable.

It was reported however that this broke suspend on at least two System76 systems in S3 mode and two Lenovo Gen2a systems, but only with S3. When the machines are set to s2idle, wakeup behaves properly.

Configuring the GPIOs for wakeup with S3 doesn't work properly, so only set it when the system supports low power idle.

Fixes 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable")
Fixes b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set wake_irq")
---
 drivers/gpio/gpiolib-acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib-acpi.c +2 -2
index 9ef0f5641b521..17c53f484280f 100644
@@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in
                                dev_dbg(&adev->dev, "IRQ %d already in use\n", irq);
                        }
 
-                       if (wake_capable)
+                       /* avoid suspend issues with GPIOs when systems are using S3 */
+                       if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
                                *wake_capable = info.wake_capable;
 
                        return irq;
--
Quoted 2 lines

2.34.1

Applied, thanks!

Bart

#6 lore raw

Re: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

Quoted 40 lines · Bartosz Golaszewski
Quoted 37 lines · Mario Limonciello

commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") adjusted the policy to enable wakeup by default if the ACPI tables indicated that a device was wake capable.

It was reported however that this broke suspend on at least two System76 systems in S3 mode and two Lenovo Gen2a systems, but only with S3. When the machines are set to s2idle, wakeup behaves properly.

Configuring the GPIOs for wakeup with S3 doesn't work properly, so only set it when the system supports low power idle.

Fixes 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable")
Fixes b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set wake_irq")
---
 drivers/gpio/gpiolib-acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib-acpi.c +2 -1
index 9ef0f5641b521..17c53f484280f 100644
@@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in
                                dev_dbg(&adev->dev, "IRQ %d already in use\n", irq);
                        }
 
-                       if (wake_capable)
+                       /* avoid suspend issues with GPIOs when systems are using S3 */
+                       if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
                                *wake_capable = info.wake_capable;
 
Quoted 8 lines
Quoted 4 lines
drivers/gpio/gpiolib-acpi.c +0 -1
                        return irq;
--

2.34.1

Applied, thanks!

Bart

We still need to figure out a proper fix for this. If you read my post
here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372
I think we misinterpreted what the SharedAndWake bit is used for. To me it sounds like it's only valid for HW Reduced ACPI platforms, and S0ix. My changes made it so we call dev_pm_set_wake_irq when the Wake bit is set. Does anyone have any additional context on the Wake bit? I think we either need to make dev_pm_set_wake_irq (or a variant) only enable the wake on S0i3, or we can teach the ACPI subsystem to manage arming the IRQ's wake bit. Kind of like we already manage the GPE events for the device.

#7 lore raw

RE: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

[Public]

Quoted 72 lines

-----Original Message-----
From: Raul Rangel <[email protected]>
Sent: Monday, January 23, 2023 09:55
To: Bartosz Golaszewski <[email protected]>
Cc: Limonciello, Mario <[email protected]>; Mika Westerberg <[email protected]>; Andy Shevchenko <[email protected]>; Linus Walleij <[email protected]>; Dmitry Torokhov <[email protected]>; Benjamin Tissoires <[email protected]>; Wolfram Sang <[email protected]>; Rafael J. Wysocki <[email protected]>; Nathan Smythe <[email protected]>; [email protected]; linux- [email protected]; [email protected]; Mark Hasemeyer <[email protected]>
Subject: Re: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

Quoted 9 lines · Bartosz Golaszewski
Quoted 6 lines · Mario Limonciello

commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") adjusted the policy to enable wakeup by default if the ACPI tables indicated that a device was wake capable.

It was reported however that this broke suspend on at least two

System76

Quoted 8 lines
Quoted 8 lines

systems in S3 mode and two Lenovo Gen2a systems, but only with S3. When the machines are set to s2idle, wakeup behaves properly.

Configuring the GPIOs for wakeup with S3 doesn't work properly, so only set it when the system supports low power idle.

Fixes 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable")
Fixes b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set

wake_irq")

Quoted 10 lines
Quoted 10 lines
---
 drivers/gpio/gpiolib-acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 5 lines

drivers/gpio/gpiolib-acpi.c int acpi_dev_gpio_irq_wake_get_by(struct

Quoted 5 lines
drivers/gpio/gpiolib-acpi.c +0 -0
index 9ef0f5641b521..17c53f484280f 100644
@@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct

acpi_device *adev, const char *name, in

Quoted 5 lines

drivers/gpio/gpiolib-acpi.c int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in

Quoted 5 lines
drivers/gpio/gpiolib-acpi.c +1 -1
                                dev_dbg(&adev->dev, "IRQ %d already in use\n", irq);
                        }
 
-                       if (wake_capable)
+                       /* avoid suspend issues with GPIOs when systems are using

S3 */

Quoted 1 line

drivers/gpio/gpiolib-acpi.c int acpi_dev_gpio_irq_wake_get_by(struct · line 1108

Quoted 1 line
drivers/gpio/gpiolib-acpi.c +1 -0
+                       if (wake_capable && acpi_gbl_FADT.flags &

ACPI_FADT_LOW_POWER_S0)

Quoted 10 lines
Quoted 6 lines
drivers/gpio/gpiolib-acpi.c +0 -1
                                *wake_capable = info.wake_capable;
 
                        return irq;
--

2.34.1

Applied, thanks!

Bart

Quoted 10 lines

We still need to figure out a proper fix for this. If you read my post
here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372
I think we misinterpreted what the SharedAndWake bit is used for. To me it sounds like it's only valid for HW Reduced ACPI platforms, and S0ix. My changes made it so we call dev_pm_set_wake_irq when the Wake bit is set. Does anyone have any additional context on the Wake bit? I think we either need to make dev_pm_set_wake_irq (or a variant) only enable the wake on S0i3, or we can teach the ACPI subsystem to manage arming the IRQ's wake bit. Kind of like we already manage the GPE events for the device.

There is an FADT flag for HW reduced (ACPI_FADT_HW_REDUCED). So maybe something on top of my change to look at that too?

IE:
if (wake_capable && (acpi_gbl_FADT.flags & (ACPI_FADT_LOW_POWER_S0 | ACPI_FADT_HW_REDUCED)

#8 lore raw

Re: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

Quoted 88 lines · Mario

[Public]

Quoted 72 lines

-----Original Message-----
From: Raul Rangel <[email protected]>
Sent: Monday, January 23, 2023 09:55
To: Bartosz Golaszewski <[email protected]>
Cc: Limonciello, Mario <[email protected]>; Mika Westerberg <[email protected]>; Andy Shevchenko <[email protected]>; Linus Walleij <[email protected]>; Dmitry Torokhov <[email protected]>; Benjamin Tissoires <[email protected]>; Wolfram Sang <[email protected]>; Rafael J. Wysocki <[email protected]>; Nathan Smythe <[email protected]>; [email protected]; linux- [email protected]; [email protected]; Mark Hasemeyer <[email protected]>
Subject: Re: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

Quoted 9 lines · Bartosz Golaszewski
Quoted 6 lines · Mario Limonciello

commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") adjusted the policy to enable wakeup by default if the ACPI tables indicated that a device was wake capable.

It was reported however that this broke suspend on at least two

System76

Quoted 8 lines
Quoted 8 lines

systems in S3 mode and two Lenovo Gen2a systems, but only with S3. When the machines are set to s2idle, wakeup behaves properly.

Configuring the GPIOs for wakeup with S3 doesn't work properly, so only set it when the system supports low power idle.

Fixes 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable")
Fixes b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set

wake_irq")

Quoted 10 lines
Quoted 10 lines
---
 drivers/gpio/gpiolib-acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 5 lines

drivers/gpio/gpiolib-acpi.c int acpi_dev_gpio_irq_wake_get_by(struct

Quoted 5 lines
drivers/gpio/gpiolib-acpi.c +0 -0
index 9ef0f5641b521..17c53f484280f 100644
@@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct

acpi_device *adev, const char *name, in

Quoted 5 lines

drivers/gpio/gpiolib-acpi.c int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in

Quoted 5 lines
drivers/gpio/gpiolib-acpi.c +1 -1
                                dev_dbg(&adev->dev, "IRQ %d already in use\n", irq);
                        }
 
-                       if (wake_capable)
+                       /* avoid suspend issues with GPIOs when systems are using

S3 */

Quoted 1 line

drivers/gpio/gpiolib-acpi.c int acpi_dev_gpio_irq_wake_get_by(struct · line 1108

Quoted 1 line
drivers/gpio/gpiolib-acpi.c +1 -0
+                       if (wake_capable && acpi_gbl_FADT.flags &

ACPI_FADT_LOW_POWER_S0)

Quoted 10 lines
Quoted 6 lines
drivers/gpio/gpiolib-acpi.c +0 -1
                                *wake_capable = info.wake_capable;
 
                        return irq;
--

2.34.1

Applied, thanks!

Bart

Quoted 10 lines

We still need to figure out a proper fix for this. If you read my post
here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372
I think we misinterpreted what the SharedAndWake bit is used for. To me it sounds like it's only valid for HW Reduced ACPI platforms, and S0ix. My changes made it so we call dev_pm_set_wake_irq when the Wake bit is set. Does anyone have any additional context on the Wake bit? I think we either need to make dev_pm_set_wake_irq (or a variant) only enable the wake on S0i3, or we can teach the ACPI subsystem to manage arming the IRQ's wake bit. Kind of like we already manage the GPE events for the device.

Quoted 5 lines

There is an FADT flag for HW reduced (ACPI_FADT_HW_REDUCED). So maybe something on top of my change to look at that too?

IE:
if (wake_capable && (acpi_gbl_FADT.flags & (ACPI_FADT_LOW_POWER_S0 | ACPI_FADT_HW_REDUCED)

The problem with the ACPI_FADT_LOW_POWER_S0 FADT flag is that it defines if S0ix is supported. That's not mutually exclusive with S3. So we really need a runtime check to see which suspend mode we are entering.

#9 lore raw

Re: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

In reply to Limonciello, Mario
Quoted 6 lines · Mario
Quoted 6 lines

From: Raul Rangel <[email protected]>
Sent: Monday, January 23, 2023 09:55

Quoted 2 lines · Bartosz Golaszewski

On Sat, Jan 21, 2023 at 2:48 PM Mario Limonciello
<[email protected]> wrote:

...

Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

+ /* avoid suspend issues with GPIOs when systems are using

S3 */

Quoted 1 line
Quoted 1 line

+ if (wake_capable && acpi_gbl_FADT.flags &

ACPI_FADT_LOW_POWER_S0)

Quoted 3 lines
Quoted 3 lines
                                *wake_capable = info.wake_capable;

                        return irq;

...

Quoted 11 lines
Quoted 10 lines

We still need to figure out a proper fix for this. If you read my post
here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372
I think we misinterpreted what the SharedAndWake bit is used for. To me it sounds like it's only valid for HW Reduced ACPI platforms, and S0ix. My changes made it so we call dev_pm_set_wake_irq when the Wake bit is set. Does anyone have any additional context on the Wake bit? I think we either need to make dev_pm_set_wake_irq (or a variant) only enable the wake on S0i3, or we can teach the ACPI subsystem to manage arming the IRQ's wake bit. Kind of like we already manage the GPE events for the device.

Quoted 5 lines

There is an FADT flag for HW reduced (ACPI_FADT_HW_REDUCED). So maybe something on top of my change to look at that too?

IE:
if (wake_capable && (acpi_gbl_FADT.flags & (ACPI_FADT_LOW_POWER_S0 | ACPI_FADT_HW_REDUCED)

I'm not sure why we are talking about HW reduced case? In HP reduced case IIRC the GPE are absent as a class.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#10 lore raw

Re: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

In reply to Raul Rangel
Quoted 51 lines · Raul Rangel
Quoted 40 lines · Bartosz Golaszewski
Quoted 37 lines · Mario Limonciello

commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") adjusted the policy to enable wakeup by default if the ACPI tables indicated that a device was wake capable.

It was reported however that this broke suspend on at least two System76 systems in S3 mode and two Lenovo Gen2a systems, but only with S3. When the machines are set to s2idle, wakeup behaves properly.

Configuring the GPIOs for wakeup with S3 doesn't work properly, so only set it when the system supports low power idle.

Fixes 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable")
Fixes b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set wake_irq")
---
 drivers/gpio/gpiolib-acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib-acpi.c +2 -1
index 9ef0f5641b521..17c53f484280f 100644
@@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in
                                dev_dbg(&adev->dev, "IRQ %d already in use\n", irq);
                        }
 
-                       if (wake_capable)
+                       /* avoid suspend issues with GPIOs when systems are using S3 */
+                       if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
                                *wake_capable = info.wake_capable;
 
Quoted 8 lines
Quoted 4 lines
drivers/gpio/gpiolib-acpi.c +0 -1
                        return irq;
--

2.34.1

Applied, thanks!

Bart

Quoted 10 lines

We still need to figure out a proper fix for this. If you read my post
here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372
I think we misinterpreted what the SharedAndWake bit is used for. To me it sounds like it's only valid for HW Reduced ACPI platforms, and S0ix. My changes made it so we call dev_pm_set_wake_irq when the Wake bit is set. Does anyone have any additional context on the Wake bit? I think we either need to make dev_pm_set_wake_irq (or a variant) only enable the wake on S0i3, or we can teach the ACPI subsystem to manage arming the IRQ's wake bit. Kind of like we already manage the GPE events for the device.

From the spec:

Shared is an optional argument and can be one of Shared, Exclusive, SharedAndWake or ExclusiveAndWake. If not specified, Exclusive is assumed. The “Wake” designation indicates that the interrupt is capable of waking the system from a low-power idle state or a system sleep state. The bit field name _SHR is automatically created to refer to this portion of the resource descriptor.

Note: "...a low-power idle state or a system sleep state.". I believe it applies to both.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#11 lore raw

Re: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

Quoted 74 lines · Andy Shevchenko
Quoted 51 lines · Raul Rangel
Quoted 40 lines · Bartosz Golaszewski
Quoted 37 lines · Mario Limonciello

commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable") adjusted the policy to enable wakeup by default if the ACPI tables indicated that a device was wake capable.

It was reported however that this broke suspend on at least two System76 systems in S3 mode and two Lenovo Gen2a systems, but only with S3. When the machines are set to s2idle, wakeup behaves properly.

Configuring the GPIOs for wakeup with S3 doesn't work properly, so only set it when the system supports low power idle.

Fixes 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable")
Fixes b38f2d5d9615c ("i2c: acpi: Use ACPI wake capability bit to set wake_irq")
---
 drivers/gpio/gpiolib-acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib-acpi.c +2 -1
index 9ef0f5641b521..17c53f484280f 100644
@@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in
                                dev_dbg(&adev->dev, "IRQ %d already in use\n", irq);
                        }
 
-                       if (wake_capable)
+                       /* avoid suspend issues with GPIOs when systems are using S3 */
+                       if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
                                *wake_capable = info.wake_capable;
 
Quoted 8 lines
Quoted 4 lines
drivers/gpio/gpiolib-acpi.c +0 -1
                        return irq;
--

2.34.1

Applied, thanks!

Bart

Quoted 10 lines

We still need to figure out a proper fix for this. If you read my post
here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372
I think we misinterpreted what the SharedAndWake bit is used for. To me it sounds like it's only valid for HW Reduced ACPI platforms, and S0ix. My changes made it so we call dev_pm_set_wake_irq when the Wake bit is set. Does anyone have any additional context on the Wake bit? I think we either need to make dev_pm_set_wake_irq (or a variant) only enable the wake on S0i3, or we can teach the ACPI subsystem to manage arming the IRQ's wake bit. Kind of like we already manage the GPE events for the device.

From the spec:

Shared is an optional argument and can be one of Shared, Exclusive, SharedAndWake or ExclusiveAndWake. If not specified, Exclusive is assumed. The “Wake” designation indicates that the interrupt is capable of waking the system from a low-power idle state or a system sleep state. The bit field name _SHR is automatically created to refer to this portion of the resource descriptor.

Quoted 2 lines

Note: "...a low-power idle state or a system sleep state.". I believe it applies to both.

Without the _PRW, how do we determine the valid system sleep states the device can wake the system from?

Quoted 6 lines

--
With Best Regards,
Andy Shevchenko

#12 lore raw

Re: [PATCH 2/2] gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode

Quoted 6 lines · Raul Rangel
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Raul Rangel
Quoted 2 lines · Bartosz Golaszewski

On Sat, Jan 21, 2023 at 2:48 PM Mario Limonciello
<[email protected]> wrote:

...

Quoted 21 lines
Quoted 21 lines
Quoted 10 lines

We still need to figure out a proper fix for this. If you read my post
here: https://gitlab.freedesktop.org/drm/amd/-/issues/2357#note_1732372
I think we misinterpreted what the SharedAndWake bit is used for. To me it sounds like it's only valid for HW Reduced ACPI platforms, and S0ix. My changes made it so we call dev_pm_set_wake_irq when the Wake bit is set. Does anyone have any additional context on the Wake bit? I think we either need to make dev_pm_set_wake_irq (or a variant) only enable the wake on S0i3, or we can teach the ACPI subsystem to manage arming the IRQ's wake bit. Kind of like we already manage the GPE events for the device.

From the spec:

Shared is an optional argument and can be one of Shared, Exclusive, SharedAndWake or ExclusiveAndWake. If not specified, Exclusive is assumed. The “Wake” designation indicates that the interrupt is capable of waking the system from a low-power idle state or a system sleep state. The bit field name _SHR is automatically created to refer to this portion of the resource descriptor.

Quoted 5 lines
Quoted 2 lines

Note: "...a low-power idle state or a system sleep state.". I believe it applies to both.

Without the _PRW, how do we determine the valid system sleep states the device can wake the system from?

Good question. I believe you need to ask somebody from ASWG for the clarifications.

Signature · 2 lines
With Best Regards,
Andy Shevchenko