All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ACPI: button: Add a debug message when we're sending a LID event
@ 2017-11-22 15:06 Hans de Goede
  2017-11-22 15:06 ` [PATCH v2 2/2] ACPI: button: Add a LID switch blacklist and add 1 model to it Hans de Goede
  2017-12-16  1:55 ` [PATCH v2 1/2] ACPI: button: Add a debug message when we're sending a LID event Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Hans de Goede @ 2017-11-22 15:06 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown; +Cc: Hans de Goede, linux-acpi

I've been debugging some spurious suspend issues on various devices,
at least on some devices these spurious suspends are caused by surious
LID closed events being send to userspace.

Running e.g. evemu-record after noticing a spurious suspend is too late
to detect that a LID closed event it the (probable) cause of this.

This commit adds an acpi_handle_debug call to help debugging this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Use acpi_handle_debug instead of pr_info
---
 drivers/acpi/button.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index bf8e4d371fa7..aac81f40e28e 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -210,6 +210,8 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state)
 	}
 	/* Send the platform triggered reliable event */
 	if (do_update) {
+		acpi_handle_debug(device->handle, "ACPI LID %s\n",
+				  state ? "open" : "closed");
 		input_report_switch(button->input, SW_LID, !state);
 		input_sync(button->input);
 		button->last_state = !!state;
-- 
2.14.3


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

* [PATCH v2 2/2] ACPI: button: Add a LID switch blacklist and add 1 model to it
  2017-11-22 15:06 [PATCH v2 1/2] ACPI: button: Add a debug message when we're sending a LID event Hans de Goede
@ 2017-11-22 15:06 ` Hans de Goede
  2017-12-16  1:55 ` [PATCH v2 1/2] ACPI: button: Add a debug message when we're sending a LID event Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2017-11-22 15:06 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown; +Cc: Hans de Goede, linux-acpi

The GP-electronic T701 tablet does not have a LID switch, but it
does define a LID device in its DSDT. The _LID method points to
the "\\_SB.GPO2" pin 0x18 GPIO with a pull setting of "PullDefault",
which leaves the pin floating.

This causes the ACPI button driver to cause spurious LID closed events,
causing the device to suspend while the user is using it. There is
nothing the ACPI button driver (or the gpio code) can do to fix this,
so the only solution is to add a DMI based blacklist and ignore the LID
device on these tablets.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/button.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index aac81f40e28e..e1eee7a60fad 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -30,6 +30,7 @@
 #include <linux/input.h>
 #include <linux/slab.h>
 #include <linux/acpi.h>
+#include <linux/dmi.h>
 #include <acpi/button.h>
 
 #define PREFIX "ACPI: "
@@ -76,6 +77,22 @@ static const struct acpi_device_id button_device_ids[] = {
 };
 MODULE_DEVICE_TABLE(acpi, button_device_ids);
 
+/*
+ * Some devices which don't even have a lid in anyway have a broken _LID
+ * method (e.g. pointing to a floating gpio pin) causing spurious LID events.
+ */
+static const struct dmi_system_id lid_blacklst[] = {
+	{
+		/* GP-electronic T701 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "T701"),
+			DMI_MATCH(DMI_BIOS_VERSION, "BYT70A.YNCHENG.WIN.007"),
+		},
+	},
+	{}
+};
+
 static int acpi_button_add(struct acpi_device *device);
 static int acpi_button_remove(struct acpi_device *device);
 static void acpi_button_notify(struct acpi_device *device, u32 event);
@@ -475,6 +492,9 @@ static int acpi_button_add(struct acpi_device *device)
 	char *name, *class;
 	int error;
 
+	if (!strcmp(hid, ACPI_BUTTON_HID_LID) && dmi_check_system(lid_blacklst))
+		return -ENODEV;
+
 	button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL);
 	if (!button)
 		return -ENOMEM;
-- 
2.14.3


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

* Re: [PATCH v2 1/2] ACPI: button: Add a debug message when we're sending a LID event
  2017-11-22 15:06 [PATCH v2 1/2] ACPI: button: Add a debug message when we're sending a LID event Hans de Goede
  2017-11-22 15:06 ` [PATCH v2 2/2] ACPI: button: Add a LID switch blacklist and add 1 model to it Hans de Goede
@ 2017-12-16  1:55 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2017-12-16  1:55 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Len Brown, linux-acpi

On Wednesday, November 22, 2017 4:06:11 PM CET Hans de Goede wrote:
> I've been debugging some spurious suspend issues on various devices,
> at least on some devices these spurious suspends are caused by surious
> LID closed events being send to userspace.
> 
> Running e.g. evemu-record after noticing a spurious suspend is too late
> to detect that a LID closed event it the (probable) cause of this.
> 
> This commit adds an acpi_handle_debug call to help debugging this.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Use acpi_handle_debug instead of pr_info
> ---
>  drivers/acpi/button.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
> index bf8e4d371fa7..aac81f40e28e 100644
> --- a/drivers/acpi/button.c
> +++ b/drivers/acpi/button.c
> @@ -210,6 +210,8 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state)
>  	}
>  	/* Send the platform triggered reliable event */
>  	if (do_update) {
> +		acpi_handle_debug(device->handle, "ACPI LID %s\n",
> +				  state ? "open" : "closed");
>  		input_report_switch(button->input, SW_LID, !state);
>  		input_sync(button->input);
>  		button->last_state = !!state;
> 

Both this and the [2/2] applied, thanks!



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

end of thread, other threads:[~2017-12-16  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-22 15:06 [PATCH v2 1/2] ACPI: button: Add a debug message when we're sending a LID event Hans de Goede
2017-11-22 15:06 ` [PATCH v2 2/2] ACPI: button: Add a LID switch blacklist and add 1 model to it Hans de Goede
2017-12-16  1:55 ` [PATCH v2 1/2] ACPI: button: Add a debug message when we're sending a LID event Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.