lkml.org 
[lkml]   [2016]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 3/3] ACPI / button: Send "open" state after boot/resume
Date
Linux userspace (systemd-logind) keeps on rechecking lid state when the
lid state is closed. If it failed to update the lid state to open after
boot/resume, the system suspending right after the boot/resume could be
resulted.
Graphics drivers also uses the lid notifications to implment
MODESET_ON_LID_OPEN option.

Before the situation is improved from the userspace and from the graphics
driver, simply send initial "open" lid state to avoid issues. After this is
improved from the userspace and from the graphics driver, Linux kernel
could simply revert this minimal commit.

Link 1: https://lkml.org/2016/3/7/460
Link 2: https://github.com/systemd/systemd/issues/2087
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Bastien Nocera: <hadess@hadess.net>
---
drivers/acpi/button.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index e706e4b..6e77312 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -342,6 +342,8 @@ static int acpi_button_resume(struct device *dev)
struct acpi_button *button = acpi_driver_data(device);

button->suspended = false;
+ if (button->type == ACPI_BUTTON_TYPE_LID)
+ return acpi_lid_notify_state(device, 1);
return 0;
}
#endif
@@ -422,6 +424,7 @@ static int acpi_button_add(struct acpi_device *device)
if (error)
goto err_remove_fs;
if (button->type == ACPI_BUTTON_TYPE_LID) {
+ (void)acpi_lid_notify_state(device, 1);
/*
* This assumes there's only one lid device, or if there are
* more we only care about the last one...
--
1.7.10
\
 
 \ /
  Last update: 2016-05-27 09:21    [W:0.574 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site