From patchwork Mon May 16 03:04:05 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: 9098261 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E74FDBF29F for ; Mon, 16 May 2016 03:04:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 62602200DB for ; Mon, 16 May 2016 03:04:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C31DA200D4 for ; Mon, 16 May 2016 03:04:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752351AbcEPDEZ (ORCPT ); Sun, 15 May 2016 23:04:25 -0400 Received: from mail1.bemta8.messagelabs.com ([216.82.243.198]:40773 "EHLO mail1.bemta8.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751921AbcEPDEZ (ORCPT ); Sun, 15 May 2016 23:04:25 -0400 Received: from [216.82.242.19] by server-6.bemta-8.messagelabs.com id 5A/55-32060-5B839375; Mon, 16 May 2016 03:04:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkleJIrShJLcpLzFFi42JJl3vhrrvFwjL coPuXscXOh2/ZLJbv62e0uLxrDpvFmdOXWB1YPDat6mTz2HK1ncXj8ya5AOYo1sy8pPyKBNaM qb03mQoeK1QcfrOIrYFxjUIXIxeHkMBmRokpFyewQTgLGSVe/F7B0sXIycEmoCpxc/UrVhBbR CBQ4uSJyywgRcwC5xkldv/dzgySEBZwlfiyfzUbRJGbxNPZM6FsI4nWBevBbBagQU09f4BsDg 5eAR+Jx7s0QUwhAQeJU/vkQCo4BRwlPs9aCbaKUUBWYtqj+0wgNrOAuMTcabPA4hICAhJL9px nhrBFJV4+/scKMkZCQF5iyyxBiHItiXkNv6FaFSWmdD9kB7F5BQQlTs58wjKBUWQWkqmzkLTM QtIyC0nLAkaWVYwaxalFZalFuoYGeklFmekZJbmJmTlAnoVebmpxcWJ6ak5iUrFecn7uJkZgF DEAwQ7G9a3OhxglOZiURHmrf1uEC/El5adUZiQWZ8QXleakFh9ilOHgUJLgnWtuGS4kWJSanl qRlpkDjGeYtAQHj5II72aQNG9xQWJucWY6ROoUo6KUOO8qkIQASCKjNA+uDZZCLjHKSgnzMgI dIsRTkFqUm1mCKv+KUZyDUUmYdwbIFJ7MvBK46a+AFjMBLZ5gZgGyuCQRISXVwKjauP5yDUNJ xLqDheuzbKJz3EyX3Fu/a/LMT34WmWzpJZUh3ArzDths2nXsu6Sw7LNnShVvzO6ZGjz3elN+/ eerF3M8N3847bRxKbtR2qvG5QHfFrJlCPx+diVKedfmKsW/7/Nrvh354GpuP/8+W9Z27/kFto +21Qc+Xm7Dxn9XZNafR7XdFwSUWIozEg21mIuKEwE66Q8WHAMAAA== X-Env-Sender: hehy1@lenovo.com X-Msg-Ref: server-3.tower-191.messagelabs.com!1463367860!30158719!1 X-Originating-IP: [103.30.232.71] X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21645 invoked from network); 16 May 2016 03:04:20 -0000 Received: from unknown (HELO maesmtp02.lenovo.com) (103.30.232.71) by server-3.tower-191.messagelabs.com with SMTP; 16 May 2016 03:04:20 -0000 Received: from CNMAILEX02.lenovo.com (unknown [10.96.80.2]) by maesmtp02.lenovo.com with smtp id 3e25_fdfe_2fbf9d8c_8365_45d3_94ce_313f61fcde06; Mon, 16 May 2016 03:04:14 +0000 Received: from CNMAILEX03.lenovo.com ([169.254.11.165]) by CNMAILEX02.lenovo.com ([169.254.10.16]) with mapi id 14.03.0248.002; Mon, 16 May 2016 11:04:06 +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 , Nagananda Chumbalkar 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+66qWQ Date: Mon, 16 May 2016 03:04:05 +0000 Message-ID: References: <1462772495-71113-1-git-send-email-hehy1@lenovo.com> In-Reply-To: <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-Spam-Status: No, score=-8.3 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 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; }