linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>, Lv Zheng <lv.zheng@intel.com>
Cc: Jiri Eischmann <jeischma@redhat.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] Revert "ACPI / button: Remove lid_init_state=method mode"
Date: Wed, 10 May 2017 18:12:39 +0200	[thread overview]
Message-ID: <20170510161240.13229-2-benjamin.tissoires@redhat.com> (raw)
In-Reply-To: <20170510161240.13229-1-benjamin.tissoires@redhat.com>

This reverts commit ecb10b694b72ca5ea51b3c90a71ff2a11963425a.

Even if the method can be buggy some times, it's still a need
when you boot a laptop with a lid closed and an external monitor
connected (typical situation when using a docking station)

Note: this option has been removed without being deprecated, which
is terrible in term of distribution handling. The new default "open"
is plain wrong and we don't even have the chance to keep the current
default option because it's not there anymore.

Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 Documentation/acpi/acpi-lid.txt | 16 ++++++++++++----
 drivers/acpi/button.c           |  9 +++++++++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/acpi/acpi-lid.txt
index 22cb309..effe7af 100644
--- a/Documentation/acpi/acpi-lid.txt
+++ b/Documentation/acpi/acpi-lid.txt
@@ -59,20 +59,28 @@ button driver uses the following 3 modes in order not to trigger issues.
 If the userspace hasn't been prepared to ignore the unreliable "opened"
 events and the unreliable initial state notification, Linux users can use
 the following kernel parameters to handle the possible issues:
-A. button.lid_init_state=open:
+A. button.lid_init_state=method:
+   When this option is specified, the ACPI button driver reports the
+   initial lid state using the returning value of the _LID control method
+   and whether the "opened"/"closed" events are paired fully relies on the
+   firmware implementation.
+   This option can be used to fix some platforms where the returning value
+   of the _LID control method is reliable but the initial lid state
+   notification is missing.
+   This option is the default behavior during the period the userspace
+   isn't ready to handle the buggy AML tables.
+B. button.lid_init_state=open:
    When this option is specified, the ACPI button driver always reports the
    initial lid state as "opened" and whether the "opened"/"closed" events
    are paired fully relies on the firmware implementation.
    This may fix some platforms where the returning value of the _LID
    control method is not reliable and the initial lid state notification is
    missing.
-   This option is the default behavior during the period the userspace
-   isn't ready to handle the buggy AML tables.
 
 If the userspace has been prepared to ignore the unreliable "opened" events
 and the unreliable initial state notification, Linux users should always
 use the following kernel parameter:
-B. button.lid_init_state=ignore:
+C. button.lid_init_state=ignore:
    When this option is specified, the ACPI button driver never reports the
    initial lid state and there is a compensation mechanism implemented to
    ensure that the reliable "closed" notifications can always be delievered
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 668137e..6d5a8c1 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -57,6 +57,7 @@
 
 #define ACPI_BUTTON_LID_INIT_IGNORE	0x00
 #define ACPI_BUTTON_LID_INIT_OPEN	0x01
+#define ACPI_BUTTON_LID_INIT_METHOD	0x02
 
 #define _COMPONENT		ACPI_BUTTON_COMPONENT
 ACPI_MODULE_NAME("button");
@@ -376,6 +377,9 @@ static void acpi_lid_initialize_state(struct acpi_device *device)
 	case ACPI_BUTTON_LID_INIT_OPEN:
 		(void)acpi_lid_notify_state(device, 1);
 		break;
+	case ACPI_BUTTON_LID_INIT_METHOD:
+		(void)acpi_lid_update_state(device);
+		break;
 	case ACPI_BUTTON_LID_INIT_IGNORE:
 	default:
 		break;
@@ -559,6 +563,9 @@ static int param_set_lid_init_state(const char *val, struct kernel_param *kp)
 	if (!strncmp(val, "open", sizeof("open") - 1)) {
 		lid_init_state = ACPI_BUTTON_LID_INIT_OPEN;
 		pr_info("Notify initial lid state as open\n");
+	} else if (!strncmp(val, "method", sizeof("method") - 1)) {
+		lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;
+		pr_info("Notify initial lid state with _LID return value\n");
 	} else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) {
 		lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE;
 		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)
 	switch (lid_init_state) {
 	case ACPI_BUTTON_LID_INIT_OPEN:
 		return sprintf(buffer, "open");
+	case ACPI_BUTTON_LID_INIT_METHOD:
+		return sprintf(buffer, "method");
 	case ACPI_BUTTON_LID_INIT_IGNORE:
 		return sprintf(buffer, "ignore");
 	default:
-- 
2.9.3

  reply	other threads:[~2017-05-10 16:12 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 16:12 [PATCH 0/2] acpi/button: revert v4.10 behavior Benjamin Tissoires
2017-05-10 16:12 ` Benjamin Tissoires [this message]
2017-05-11  0:58   ` [PATCH 1/2] Revert "ACPI / button: Remove lid_init_state=method mode" Zheng, Lv
2017-05-11  1:19     ` Zheng, Lv
2017-05-11 10:12       ` Benjamin Tissoires
2017-05-12  5:08         ` Zheng, Lv
2017-05-12  9:50           ` Benjamin Tissoires
2017-05-15  4:54             ` Zheng, Lv
2017-05-15  7:42               ` Benjamin Tissoires
2017-05-16  5:05                 ` Zheng, Lv
2017-05-10 16:12 ` [PATCH 2/2] Revert "ACPI / button: Change default behavior to lid_init_state=open" Benjamin Tissoires
2017-05-11  0:59   ` Zheng, Lv
2017-05-11  9:45     ` Benjamin Tissoires
2017-05-12  2:36       ` Zheng, Lv
2017-05-12 21:50         ` Rafael J. Wysocki
2017-05-15  7:45           ` Benjamin Tissoires
2017-05-15  9:17             ` Rafael J. Wysocki
2017-05-15  9:37               ` Benjamin Tissoires
2017-05-15 11:01                 ` Rafael J. Wysocki
2017-05-15 13:05                   ` Benjamin Tissoires
2017-05-16  5:33                     ` Zheng, Lv
2017-05-16  5:47                       ` Zheng, Lv
2017-05-16  7:15                         ` Benjamin Tissoires
2017-05-16  8:30                           ` Zheng, Lv
2017-05-16 10:10                             ` Benjamin Tissoires
2017-05-17  7:32                               ` Zheng, Lv
2017-05-17 11:54                                 ` Peter Hutterer
2017-05-17 14:16                                 ` Benjamin Tissoires
2017-05-24  8:08                   ` Benjamin Tissoires
2017-05-24 23:01                     ` Rafael J. Wysocki
2017-05-25  6:17                       ` Zheng, Lv
2017-05-26  7:39                     ` Peter Hutterer
2017-05-27 19:23                       ` Rafael J. Wysocki
2017-05-11  0:09 ` [PATCH 0/2] acpi/button: revert v4.10 behavior Rafael J. Wysocki
2017-05-11  9:33   ` Benjamin Tissoires

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170510161240.13229-2-benjamin.tissoires@redhat.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=jeischma@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).