From patchwork Thu Jan 11 01:13:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 10156421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 96822602B3 for ; Thu, 11 Jan 2018 01:15:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86DFA28178 for ; Thu, 11 Jan 2018 01:15:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BA11285A7; Thu, 11 Jan 2018 01:15:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8173428161 for ; Thu, 11 Jan 2018 01:15:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752762AbeAKBPN (ORCPT ); Wed, 10 Jan 2018 20:15:13 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:46852 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752604AbeAKBPN (ORCPT ); Wed, 10 Jan 2018 20:15:13 -0500 Received: from 79.184.254.76.ipv4.supernova.orange.pl (79.184.254.76) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.82) id fd9190bb027f06e5; Thu, 11 Jan 2018 02:15:10 +0100 From: "Rafael J. Wysocki" To: Linux ACPI Cc: Andy Shevchenko , Darren Hart , LKML , Linux PM , Platform Driver , Valentin Manea Subject: [PATCH v2 1/2] ACPI / PM: Use Low Power S0 Idle on more systems Date: Thu, 11 Jan 2018 02:13:58 +0100 Message-ID: <2293881.tBporBhK0J@aspire.rjw.lan> In-Reply-To: <1515590661.7000.855.camel@linux.intel.com> References: <4046497.JI7UjL75gC@aspire.rjw.lan> <12541194.33112yYDjW@aspire.rjw.lan> <1515590661.7000.855.camel@linux.intel.com> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki Some systems don't support the ACPI_LPS0_ENTRY and ACPI_LPS0_EXIT functions in their Low Power S0 Idle _DSM, but still expect EC events to be processed in the suspend-to-idle state for power button wakeup (among other things) to work. Surface Pro3 turns out to be one of them. Fortunately, it still provides Low Power S0 Idle _DSM with the screen on/off functions supported, so modify the ACPI suspend-to-idle to use the Low Power S0 Idle code path for all systems supporting the ACPI_LPS0_ENTRY and ACPI_LPS0_EXIT or the ACPI_LPS0_SCREEN_OFF and ACPI_LPS0_SCREEN_ON functions in their Low Power S0 Idle _DSM. Potentially, that will cause more systems to use suspend-to-idle by default, so some future corrections may be necessary if it leads to issues, but let it remain more straightforward for now. Link: https://bugzilla.kernel.org/show_bug.cgi?id=198389#add_comment Reported-by: Valentin Manea Signed-off-by: Rafael J. Wysocki Reviewed-by: Andy Shevchenko --- -> v2: Rename ACPI_LPS0_S2I_MASK to ACPI_LPS0_PLATFORM_MASK. --- drivers/acpi/sleep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) Index: linux-pm/drivers/acpi/sleep.c =================================================================== --- linux-pm.orig/drivers/acpi/sleep.c +++ linux-pm/drivers/acpi/sleep.c @@ -707,7 +707,8 @@ static const struct acpi_device_id lps0_ #define ACPI_LPS0_ENTRY 5 #define ACPI_LPS0_EXIT 6 -#define ACPI_S2IDLE_FUNC_MASK ((1 << ACPI_LPS0_ENTRY) | (1 << ACPI_LPS0_EXIT)) +#define ACPI_LPS0_SCREEN_MASK ((1 << ACPI_LPS0_SCREEN_OFF) | (1 << ACPI_LPS0_SCREEN_ON)) +#define ACPI_LPS0_PLATFORM_MASK ((1 << ACPI_LPS0_ENTRY) | (1 << ACPI_LPS0_EXIT)) static acpi_handle lps0_device_handle; static guid_t lps0_dsm_guid; @@ -910,7 +911,8 @@ static int lps0_device_attach(struct acp if (out_obj && out_obj->type == ACPI_TYPE_BUFFER) { char bitmask = *(char *)out_obj->buffer.pointer; - if ((bitmask & ACPI_S2IDLE_FUNC_MASK) == ACPI_S2IDLE_FUNC_MASK) { + if ((bitmask & ACPI_LPS0_PLATFORM_MASK) == ACPI_LPS0_PLATFORM_MASK || + (bitmask & ACPI_LPS0_SCREEN_MASK) == ACPI_LPS0_SCREEN_MASK) { lps0_dsm_func_mask = bitmask; lps0_device_handle = adev->handle; /*