From patchwork Thu May 26 07:39:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: aaron lu X-Patchwork-Id: 819872 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4Q7dpcB009726 for ; Thu, 26 May 2011 07:39:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754584Ab1EZHjv (ORCPT ); Thu, 26 May 2011 03:39:51 -0400 Received: from tx2ehsobe003.messaging.microsoft.com ([65.55.88.13]:40417 "EHLO TX2EHSOBE005.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754934Ab1EZHju convert rfc822-to-8bit (ORCPT ); Thu, 26 May 2011 03:39:50 -0400 Received: from mail86-tx2-R.bigfish.com (10.9.14.246) by TX2EHSOBE005.bigfish.com (10.9.40.25) with Microsoft SMTP Server id 14.1.225.22; Thu, 26 May 2011 07:39:50 +0000 Received: from mail86-tx2 (localhost.localdomain [127.0.0.1]) by mail86-tx2-R.bigfish.com (Postfix) with ESMTP id 215B610698; Thu, 26 May 2011 07:39:50 +0000 (UTC) X-SpamScore: 2 X-BigFish: VPS2(zzzz1202hzz8275eh8275bha1495iz32i668h839h62h) X-Spam-TCS-SCL: 1:0 X-Forefront-Antispam-Report: CIP:163.181.249.108; KIP:(null); UIP:(null); IPVD:NLI; H:ausb3twp01.amd.com; RD:none; EFVD:NLI Received: from mail86-tx2 (localhost.localdomain [127.0.0.1]) by mail86-tx2 (MessageSwitch) id 1306395589953929_26132; Thu, 26 May 2011 07:39:49 +0000 (UTC) Received: from TX2EHSMHS028.bigfish.com (unknown [10.9.14.250]) by mail86-tx2.bigfish.com (Postfix) with ESMTP id DB80D1A7804C; Thu, 26 May 2011 07:39:49 +0000 (UTC) Received: from ausb3twp01.amd.com (163.181.249.108) by TX2EHSMHS028.bigfish.com (10.9.99.128) with Microsoft SMTP Server id 14.1.225.22; Thu, 26 May 2011 07:39:49 +0000 X-WSS-ID: 0LLSLAB-01-23Z-02 X-M-MSG: Received: from sausexedgep02.amd.com (sausexedgep02-ext.amd.com [163.181.249.73]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp01.amd.com (Axway MailGate 3.8.1) with ESMTP id 238A1102850E; Thu, 26 May 2011 02:39:46 -0500 (CDT) Received: from sausexhtp02.amd.com (163.181.3.152) by sausexedgep02.amd.com (163.181.36.59) with Microsoft SMTP Server (TLS) id 8.3.106.1; Thu, 26 May 2011 02:40:01 -0500 Received: from storexhtp02.amd.com (172.24.4.4) by sausexhtp02.amd.com (163.181.3.152) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 26 May 2011 02:39:47 -0500 Received: from storexbh1.amd.com (10.1.1.17) by storexhtp02.amd.com (172.24.4.4) with Microsoft SMTP Server id 8.3.83.0; Thu, 26 May 2011 03:39:46 -0400 Received: from sshaexmb1.amd.com ([10.237.2.11]) by storexbh1.amd.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 26 May 2011 03:39:45 -0400 Received: from 163.181.250.55 ([163.181.250.55]) by sshaexmb1.amd.com ([10.237.2.11]) via Exchange Front-End Server myemail.amd.com ([163.181.187.9]) with Microsoft Exchange Server HTTP-DAV ; Thu, 26 May 2011 07:39:42 +0000 Received: from torpedo-aaron by myemail.amd.com; 26 May 2011 15:39:42 +0800 Subject: [PATCH] ACPI, execute _PSx control method if exists during device power init phase From: aaron lu To: CC: , , Date: Thu, 26 May 2011 15:39:41 +0800 Message-ID: <1306395581.10256.9.camel@torpedo-aaron.amd.com> MIME-Version: 1.0 X-Mailer: Evolution 2.32.2 (2.32.2-1.fc14) X-OriginalArrivalTime: 26 May 2011 07:39:45.0679 (UTC) FILETIME=[157311F0:01CC1B78] X-OriginatorOrg: amd.com Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 26 May 2011 07:39:53 +0000 (UTC) Per the acpi spec, for OSPM to put the device in the Dx device state, the following must occur: 1. All Power Resources referenced by elements 1 through N must be in the ON state. 2. All Power Resources no longer referenced by any device in the system must be in the OFF state. 3. If present, the _PSx control method is executed to set the device into the Dx device state. This patch adds support for the execution of _PSx control method during device power init phase. This could also solve the problem I encountered, please see: http://marc.info/?l=linux-acpi&m=130579961021505&w=2 Signed-off-by: Aaron Lu --- drivers/acpi/bus.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 9749980..71c9e35 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -339,6 +339,18 @@ int acpi_bus_init_power(struct acpi_device *device) if (device->power.flags.power_resources) result = acpi_power_on_resources(device, state); + if (result) + return result; + + /* if _PSx exists, execute it */ + if (device->power.states[state].flags.explicit_set) { + acpi_status status; + char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' }; + status = acpi_evaluate_object(device->handle, object_name, + NULL, NULL); + if (ACPI_FAILURE(status)) + result = -ENODEV; + } if (!result) device->power.state = state;