From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omzsmtpe01.verizonbusiness.com ([199.249.25.210]:45022 "EHLO omzsmtpe01.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754238AbdDDTe3 (ORCPT ); Tue, 4 Apr 2017 15:34:29 -0400 From: alexander.levin@verizon.com To: "gregkh@linuxfoundation.org" CC: "stable@vger.kernel.org" Subject: [PATCH for 4.9 68/98] ACPI / button: Change default behavior to lid_init_state=open Date: Tue, 4 Apr 2017 19:32:27 +0000 Message-ID: <20170404193158.19041-69-alexander.levin@verizon.com> References: <20170404193158.19041-1-alexander.levin@verizon.com> In-Reply-To: <20170404193158.19041-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Lv Zheng [ Upstream commit 77e9a4aa9de10cc1418bf9a892366988802a8025 ] More and more platforms need the button.lid_init_state=3Dopen quirk. This patch sets it the default behavior. If a platform doesn't send lid open event or lid open event is lost due to the underlying system problems, then we can compare various combinations: 1. systemd/acpid is used to suspend system or not, systemd has a special logic forcing open event after resuming; 2. _LID returns a cached value or not. The result is as follows: 1. lid_init_state=3Dmethod 1. cached 1. resumed by lid: (x) event=3Dclose (x) systemd=3Dsuspends again (x) acpid=3Dsuspends again (x) state=3Dclose 2. resumed by other: (o) event=3Dclose (x) systemd=3Dsuspends again (x) acpid=3Dsuspends again (o) state=3Dclose 2. non-cached 1. resumed by lid: (o) event=3Dopen (o) systemd=3Dresumes (o) acpid=3Dresumes (o) state=3Dopen 2. resumed by other: (o) event=3Dclose (x) systemd=3Dsuspends again (x) acpid=3Dsuspends again (o) state=3Dclose 2. lid_init_state=3Dopen 1. cached 1. resumed by lid: (o) event=3Dopen (o) systemd=3Dresumes (o) acpid=3Dresumes (x) state=3Dclose 2. resumed by other: (x) event=3Dopen (o) systemd=3Dresumes (o) acpid=3Dresumes (o) state=3Dclose 2. non-cached 1. resumed by lid: (o) event=3Dopen (o) systemd=3Dresumes (o) acpid=3Dresumes (o) state=3Dopen 2. resumed by other: (x) event=3Dopen (o) systemd=3Dresumes (o) acpid=3Dresumes (o) state=3Dclose 3. lid_init_state=3Dignore 1. cached 1. resumed by lid: (o) event=3Dnone (x) systemd=3Dsuspends again (o) acpid=3Dresumes (x) state=3Dclose 2. resumed by other: (o) event=3Dnone (x) systemd=3Dsuspends again (o) acpid=3Dresumes (o) state=3Dclose 2. non-cached 1. resumed by lid: (o) event=3Dnone (x) systemd=3Dsuspends again (o) acpid=3Dresumes (o) state=3Dopen 2. resumed by other: (o) event=3Dnone (x) systemd=3Dsuspends again (o) acpid=3Dresumes (o) state=3Dclose As a conclusion: 1. With systemd changed, lid_init_state=3Dignore has only one problem and = the problem comes from an underlying issue, not userspace and kernel lid handling. 2. Without systemd changed, lid_init_state=3Dopen can be the default behavior as the pass ratio is not much worse than lid_init_state=3Digno= re. 3. lid_init_state=3Dmethod is buggy, we can have a separate patch to make = it deprectated. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D187271 Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/button.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index e19f530..6d5a8c1 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -113,7 +113,7 @@ struct acpi_button { =20 static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier); static struct acpi_device *lid_device; -static u8 lid_init_state =3D ACPI_BUTTON_LID_INIT_METHOD; +static u8 lid_init_state =3D ACPI_BUTTON_LID_INIT_OPEN; =20 static unsigned long lid_report_interval __read_mostly =3D 500; module_param(lid_report_interval, ulong, 0644); --=20 2.9.3