From patchwork Mon May 9 05:50:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ocean HY1 He X-Patchwork-Id: 9041141 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DC7CE9F372 for ; Mon, 9 May 2016 06:02:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 04FB620154 for ; Mon, 9 May 2016 06:02:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1F67220149 for ; Mon, 9 May 2016 06:02:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750913AbcEIGC2 (ORCPT ); Mon, 9 May 2016 02:02:28 -0400 Received: from mail1.bemta8.messagelabs.com ([216.82.243.193]:16240 "EHLO mail1.bemta8.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750864AbcEIGC1 convert rfc822-to-8bit (ORCPT ); Mon, 9 May 2016 02:02:27 -0400 X-Greylist: delayed 423 seconds by postgrey-1.27 at vger.kernel.org; Mon, 09 May 2016 02:02:27 EDT Received: from [216.82.242.19] by server-1.bemta-8.messagelabs.com id 69/AB-30925-84620375; Mon, 09 May 2016 05:55:20 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrIIsWRWlGSWpSXmKPExsWSLvfCXddDzSD c4P0aWYudD9+yWSzf189ocXnXHDaLM6cvsTqweGxa1cnmseVqO4vH501yAcxRrJl5SfkVCawZ b39tZCn4L1jxZeJq1gbGTv4uRi4OIYFbjBLPH6xkhnDmM0rc2b2NqYuRk4NNQFXi5upXrCC2i ECgxMkTl1lAipgFPjJK3G3ezd7FyMEhLOAo8eC1FkSNm8TT2TPZIGw9iUXnrzGC2CwCKhL32p pYQcp5BRwk2s5ag4QZBWQlpj26D7aKWUBc4taT+WC2hICAxJI955khbFGJl4//gbVKCMhLbJk lCFGuJ3Fj6hQ2CFtbYtnC12DlvAKCEidnPmGZwCg0C8nUWUhaZiFpmYWkZQEjyypGjeLUorLU Il1Dc72kosz0jJLcxMwcXUMDC73c1OLixPTUnMSkYr3k/NxNjMCoqGdgYNzBOGW3+yFGSQ4mJ VFeV0a9cCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvG2qBuFCgkWp6akVaZk5wPiESUtw8CiJ8C 4DSfMWFyTmFmemQ6ROMSpKifP2gSQEQBIZpXlwbbCUcIlRVkqYl5GBgUGIpyC1KDezBFX+FaM 4B6OSMO8EkCk8mXklcNNfAS1mAlosx6YPsrgkESEl1cAokDDtTy1jaEJ/iBEva4rAGWW1fYX6 H55uaas+crsma+d5qekxc7QDgkSmvPa6t+BbXkO/Gee9s2sOGbbYdM39aHDs40Orda2nz7FyP ra9VSu6cmt/tPiuvrOM77d4B0n6Fm+fs0pi1xKLV/7vkw0PLNAWTMgNki+sS2M62DD59cWF3y b2GrArsRRnJBpqMRcVJwIAfdoMBwQDAAA= X-Env-Sender: hehy1@lenovo.com X-Msg-Ref: server-16.tower-191.messagelabs.com!1462773320!36346073!1 X-Originating-IP: [103.30.232.71] X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18928 invoked from network); 9 May 2016 05:55:20 -0000 Received: from unknown (HELO maesmtp02.lenovo.com) (103.30.232.71) by server-16.tower-191.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 May 2016 05:55:20 -0000 Received: from CNMAILEX03.lenovo.com (unknown [10.96.80.3]) by maesmtp02.lenovo.com with smtp (TLS: TLSv1/SSLv3,256bits,AES256-SHA) id 31aa_af63_b7e51dff_8864_47c2_9b39_36bb4c228980; Mon, 09 May 2016 05:55:13 +0000 Received: from CNMAILEX01.lenovo.com ([169.254.9.102]) by CNMAILEX03.lenovo.com ([169.254.11.28]) with mapi id 14.03.0248.002; Mon, 9 May 2016 13:50:11 +0800 From: Ocean HY1 He 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 Thread-Topic: [PATCH] ACPI: Execute the _PTS method when system reboot Thread-Index: AQHRqbamBaQ1afmGqEqJpmjI9y2kzA== Date: Mon, 9 May 2016 05:50:11 +0000 Message-ID: <1462772495-71113-1-git-send-email-hehy1@lenovo.com> Accept-Language: zh-CN, en-US Content-Language: en-US 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-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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; }