From patchwork Tue May 24 06:41:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ocean HY1 He X-Patchwork-Id: 9132855 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 24888607D5 for ; Tue, 24 May 2016 06:50:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B83028285 for ; Tue, 24 May 2016 06:50:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1020628292; Tue, 24 May 2016 06:50:14 +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 77BE128285 for ; Tue, 24 May 2016 06:50:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751853AbcEXGuJ (ORCPT ); Tue, 24 May 2016 02:50:09 -0400 Received: from mail1.bemta12.messagelabs.com ([216.82.251.8]:59577 "EHLO mail1.bemta12.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751346AbcEXGuI (ORCPT ); Tue, 24 May 2016 02:50:08 -0400 X-Greylist: delayed 405 seconds by postgrey-1.27 at vger.kernel.org; Tue, 24 May 2016 02:50:08 EDT Received: from [216.82.251.41] by server-8.bemta-12.messagelabs.com id 05/98-18327-508F3475; Tue, 24 May 2016 06:43:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIKsWRWlGSWpSXmKPExsWSLvfCXZflh3O 4wan31haT1i5nttj58C2bxfJ9/YwWl3fNYbN496OX3eLM6UusFi37p7A4sHtsWtXJ5vF+31U2 jy1X21k8Pm+SC2CJYs3MS8qvSGDNODihkbHgplrF2b8nmRoYZ6h1MXJxCAlsZpR4t2MKO4Szk FHi/Ic+1i5GTg42AVWJm6tfgdkiAgkSKybfYgexmQUOMUlMPpkDYgsLuEp82b+aDaLGTeLp7J lQtpXEy1PrwWwWoDkzFxxiBLF5BXwkHt1YARYXEnCUOPhsLthMRgFZiWmP7jNBzBeXmDttFth eCQEBiSV7zjND2KISLx//A4pzANnyEltmCUKUa0nMa/gN1aooMaX7ITvEKkGJkzOfsExgFJ6F ZOosJC2zkLTMQtKygJFlFaN6cWpRWWqRroleUlFmekZJbmJmjq6hoZFebmpxcWJ6ak5iUrFec n7uJkZgVDEAwQ7GVQudDzFKcjApifKufuccLsSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mCt+QbUE 6wKDU9tSItMwcY3zBpCQ4eJRHe1V+B0rzFBYm5xZnpEKlTjIpS4rwSIH0CIImM0jy4NlhKucQ oKyXMywh0iBBPQWpRbmYJqvwrRnEORiVh3mCQKTyZeSVw018BLWYCWuz/BWxxSSJCSqqBUfl2 1FzHDJsFn3sle48KuXstdwnurS+0KTrBcoZnqfIxWb8rAc4vPHqDa1PVJzo81YkpfPZpstgZg 48/+E/N26de+f34jDpvxzkOXL86rqpOX1r6XUv28y/vZfMPmBTu3t45ZXr0d4lAlzplHl73Fy yxp2IuFJ0WLe70dFMRlNjLoLfw9jcvJZbijERDLeai4kQAVvGMnyQDAAA= X-Env-Sender: hehy1@lenovo.com X-Msg-Ref: server-10.tower-143.messagelabs.com!1464072196!5419959!1 X-Originating-IP: [103.30.232.71] X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24706 invoked from network); 24 May 2016 06:43:16 -0000 Received: from unknown (HELO maesmtp02.lenovo.com) (103.30.232.71) by server-10.tower-143.messagelabs.com with SMTP; 24 May 2016 06:43:16 -0000 Received: from CNMAILEX04.lenovo.com (unknown [10.96.80.4]) by maesmtp02.lenovo.com with smtp id 7386_4694_056175cc_c88d_4ee3_b0da_0bb9bb4c99ef; Tue, 24 May 2016 06:43:12 +0000 Received: from CNMAILEX03.lenovo.com ([169.254.11.165]) by CNMAILEX04.lenovo.com ([192.168.1.124]) with mapi id 14.03.0248.002; Tue, 24 May 2016 14:41:43 +0800 From: Ocean HY1 He To: "Prarit Bhargava (prarit@redhat.com)" , "jcm@redhat.com" CC: "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , David Tanaka , Nagananda Chumbalkar , "rjw@rjwysocki.net" , "lenb@kernel.org" , "wefu@redhat.com" Subject: RE: [PATCH] ACPI: Execute the _PTS method when system reboot Thread-Topic: [PATCH] ACPI: Execute the _PTS method when system reboot Thread-Index: AQHRqbamBaQ1afmGqEqJpmjI9y2kzJ+66qWQgAzPlbA= Date: Tue, 24 May 2016 06:41:42 +0000 Message-ID: References: <1462772495-71113-1-git-send-email-hehy1@lenovo.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.96.19.89] MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Prarit and Jon, How do you think of this? Thanks. Ocean He / 何海洋 SW Development Dept. Beijing Design Center Enterprise Product Group Mobile: 18911778926 E-mail: hehy1@lenovo.com No.6 Chuang Ye Road, Haidian District, Beijing, China 100085 -----Original Message----- From: Ocean HY1 He Sent: Monday, May 16, 2016 11:04 AM To: rjw@rjwysocki.net; lenb@kernel.org Cc: linux-acpi@vger.kernel.org; linux-kernel@vger.kernel.org; David Tanaka; Nagananda Chumbalkar Subject: RE: [PATCH] ACPI: Execute the _PTS method when system reboot To whom may concern, A Lenovo feature depends on _PTS method execution when reboot. And after check the ACPI spec, I think _PTS should be exectued when reboo. This patch could fix the problem. Any comments of this patch? Many thanks! Ocean He / 何海洋 SW Development Dept. Beijing Design Center Enterprise Product Group Mobile: 18911778926 E-mail: hehy1@lenovo.com No.6 Chuang Ye Road, Haidian District, Beijing, China 100085 -----Original Message----- From: Ocean HY1 He Sent: Monday, May 09, 2016 1:50 PM To: rjw@rjwysocki.net; lenb@kernel.org Cc: linux-acpi@vger.kernel.org; linux-kernel@vger.kernel.org; David Tanaka; Ocean HY1 He; Nagananda Chumbalkar Subject: [PATCH] ACPI: Execute the _PTS method when system reboot The _PTS control method is defined in the section 7.4.1 of acpi 6.0 spec. The _PTS control method is executed by the OS during the sleep transition process for S1, S2, S3, S4, and for orderly S5 shutdown. The sleeping state value (For example, 1, 2, 3, 4 or 5 for the S5 soft-off state) is passed to the _PTS control method. This method is called after OSPM has notified native device drivers of the sleep state transition and before the OSPM has had a chance to fully prepare the system for a sleep state transition. The _PTS control method provides the BIOS a mechanism for performing some housekeeping, such as writing the sleep type value to the embedded controller, before entering the system sleeping state. According to section 7.5 of acpi 6.0 spec, _PTS should run after _TTS. Thus, a _PTS block notifier is added to the reboot notifier list so that the _PTS object will also be evaluated when the system reboot. Signed-off-by: Ocean He Signed-off-by: Nagananda Chumbalkar --- drivers/acpi/sleep.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) -- 1.8.3.1 diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 2a8b596..8b290fb 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -55,6 +55,26 @@ static struct notifier_block tts_notifier = { .priority = 0, }; +static int pts_notify_reboot(struct notifier_block *this, + unsigned long code, void *x) +{ + acpi_status status; + + status = acpi_execute_simple_method(NULL, "\\_PTS", ACPI_STATE_S5); + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + /* It won't break anything. */ + printk(KERN_NOTICE "Failure in evaluating _PTS object\n"); + } + + return NOTIFY_DONE; +} + +static struct notifier_block pts_notifier = { + .notifier_call = pts_notify_reboot, + .next = NULL, + .priority = 0, +}; + static int acpi_sleep_prepare(u32 acpi_state) { #ifdef CONFIG_ACPI_SLEEP @@ -896,5 +916,12 @@ int __init acpi_sleep_init(void) * object can also be evaluated when the system enters S5. */ register_reboot_notifier(&tts_notifier); + + /* + * According to section 7.5 of acpi 6.0 spec, _PTS should run after + * _TTS when the system enters S5. + */ + register_reboot_notifier(&pts_notifier); + return 0; }