aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/button.c
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2017-05-09 03:02:22 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-05-12 17:14:59 -0400
commitf369fdf4f661322b73f3307e9f3cd55fb3a20123 (patch)
tree99e03087eb08adae4960fe4386327b553b5d1897 /drivers/acpi/button.c
parenta351e9b9fc24e982ec2f0e76379a49826036da12 (diff)
Revert "ACPI / button: Remove lid_init_state=method mode"
This reverts commit ecb10b694b72ca5ea51b3c90a71ff2a11963425a. The only expected ACPI control method lid device's usage model is 1. Listen to the lid notification, 2. Evaluate _LID after being notified by BIOS, 3. Suspend the system (if users configure to do so) after seeing "close". It's not ensured that BIOS will notify OS after boot/resume, and it's not ensured that BIOS will always generate "open" event upon opening the lid. But there are 2 wrong usage models: 1. When the lid device is responsible for suspend/resume the system, userspace requires to see "open" event to be paired with "close" after the system is resumed, or it will suspend the system again. 2. When an external monitor connects to the laptop attached docks, userspace requires to see "close" event after the system is resumed so that it can determine whether the internal display should remain dark and the external display should be lit on. After we made default kernel behavior to be suitable for usage model 1, users of usage model 2 start to report regressions for such behavior change. Reversion of button.lid_init_state=method doesn't actually reverts to old default behavior as doing so can enter a regression loop, but facilitates users to work the reported regressions around with button.lid_init_state=method. Fixes: ecb10b694b72 (ACPI / button: Remove lid_init_state=method mode) Cc: 4.11+ <stable@vger.kernel.org> # 4.11+ Link: https://bugzilla.kernel.org/show_bug.cgi?id=195455 Link: https://bugzilla.redhat.com/show_bug.cgi?id=1430259 Tested-by: Steffen Weber <steffen.weber@gmail.com> Tested-by: Julian Wiedmann <julian.wiedmann@jwi.name> Reported-by: Joachim Frieben <jfrieben@hotmail.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/button.c')
-rw-r--r--drivers/acpi/button.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 668137e4a069..6d5a8c1d3132 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -57,6 +57,7 @@
57 57
58#define ACPI_BUTTON_LID_INIT_IGNORE 0x00 58#define ACPI_BUTTON_LID_INIT_IGNORE 0x00
59#define ACPI_BUTTON_LID_INIT_OPEN 0x01 59#define ACPI_BUTTON_LID_INIT_OPEN 0x01
60#define ACPI_BUTTON_LID_INIT_METHOD 0x02
60 61
61#define _COMPONENT ACPI_BUTTON_COMPONENT 62#define _COMPONENT ACPI_BUTTON_COMPONENT
62ACPI_MODULE_NAME("button"); 63ACPI_MODULE_NAME("button");
@@ -376,6 +377,9 @@ static void acpi_lid_initialize_state(struct acpi_device *device)
376 case ACPI_BUTTON_LID_INIT_OPEN: 377 case ACPI_BUTTON_LID_INIT_OPEN:
377 (void)acpi_lid_notify_state(device, 1); 378 (void)acpi_lid_notify_state(device, 1);
378 break; 379 break;
380 case ACPI_BUTTON_LID_INIT_METHOD:
381 (void)acpi_lid_update_state(device);
382 break;
379 case ACPI_BUTTON_LID_INIT_IGNORE: 383 case ACPI_BUTTON_LID_INIT_IGNORE:
380 default: 384 default:
381 break; 385 break;
@@ -559,6 +563,9 @@ static int param_set_lid_init_state(const char *val, struct kernel_param *kp)
559 if (!strncmp(val, "open", sizeof("open") - 1)) { 563 if (!strncmp(val, "open", sizeof("open") - 1)) {
560 lid_init_state = ACPI_BUTTON_LID_INIT_OPEN; 564 lid_init_state = ACPI_BUTTON_LID_INIT_OPEN;
561 pr_info("Notify initial lid state as open\n"); 565 pr_info("Notify initial lid state as open\n");
566 } else if (!strncmp(val, "method", sizeof("method") - 1)) {
567 lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;
568 pr_info("Notify initial lid state with _LID return value\n");
562 } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) { 569 } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) {
563 lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE; 570 lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE;
564 pr_info("Do not notify initial lid state\n"); 571 pr_info("Do not notify initial lid state\n");
@@ -572,6 +579,8 @@ static int param_get_lid_init_state(char *buffer, struct kernel_param *kp)
572 switch (lid_init_state) { 579 switch (lid_init_state) {
573 case ACPI_BUTTON_LID_INIT_OPEN: 580 case ACPI_BUTTON_LID_INIT_OPEN:
574 return sprintf(buffer, "open"); 581 return sprintf(buffer, "open");
582 case ACPI_BUTTON_LID_INIT_METHOD:
583 return sprintf(buffer, "method");
575 case ACPI_BUTTON_LID_INIT_IGNORE: 584 case ACPI_BUTTON_LID_INIT_IGNORE:
576 return sprintf(buffer, "ignore"); 585 return sprintf(buffer, "ignore");
577 default: 586 default: