From patchwork Tue Jul 29 21:46:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Bolle X-Patchwork-Id: 4643451 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 42381C0338 for ; Tue, 29 Jul 2014 21:51:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 667CF20149 for ; Tue, 29 Jul 2014 21:51:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 05B9C2012B for ; Tue, 29 Jul 2014 21:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752073AbaG2VvY (ORCPT ); Tue, 29 Jul 2014 17:51:24 -0400 Received: from cpsmtpb-ews09.kpnxchange.com ([213.75.39.14]:54997 "EHLO cpsmtpb-ews09.kpnxchange.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751300AbaG2VvX (ORCPT ); Tue, 29 Jul 2014 17:51:23 -0400 X-Greylist: delayed 307 seconds by postgrey-1.27 at vger.kernel.org; Tue, 29 Jul 2014 17:51:23 EDT Received: from cpsps-ews03.kpnxchange.com ([10.94.84.170]) by cpsmtpb-ews09.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Tue, 29 Jul 2014 23:46:14 +0200 Received: from CPSMTPM-TLF101.kpnxchange.com ([195.121.3.4]) by cpsps-ews03.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Tue, 29 Jul 2014 23:46:14 +0200 Received: from [192.168.10.107] ([77.173.140.92]) by CPSMTPM-TLF101.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Tue, 29 Jul 2014 23:46:14 +0200 Message-ID: <1406670374.2406.27.camel@x220> Subject: ACPI / dock: ThinkPad X220: \_SB_.PCI0.LPC_.EC__.BAT1: Unable to dock! From: Paul Bolle To: Shaohua Li , "Rafael J. Wysocki" , Len Brown Cc: Rubin Abdi , linux-acpi@vger.kernel.org, linux-thinkpad@linux-thinkpad.org Date: Tue, 29 Jul 2014 23:46:14 +0200 X-Mailer: Evolution 3.10.4 (3.10.4-2.fc20) Mime-Version: 1.0 X-OriginalArrivalTime: 29 Jul 2014 21:46:14.0557 (UTC) FILETIME=[8528D4D0:01CFAB76] X-RcptDomain: vger.kernel.org Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 0) A ThinkPad X220 I use prints this error at the _first_ resume from suspend (to ram): ACPI: \_SB_.PCI0.LPC_.EC__.BAT1: Unable to dock! 1) BAT1 is apparently a "battery bay". Rubin suggested that it is a "slice" battery. I do not use a "slice" battery. (There are two other possible docks according to the ACPI printks is get. An "ata bay" and a "dock station". I don't use those either, but the kernel at least prints no errors about them.) 2) I've peeked a bit at the DSDT of this machine. Its _WAK method contains this line: \_SB.PCI0.LPC.EC.BATW (Arg0) That BATW method is about 12 lines long. (Can I quote that in full?) It ends with this snippet: If (XOr (Local0, Local1)) { Store (Local1, [...]) Notify (\_SB.PCI0.LPC.EC.BAT1, 0x01) // Device Check } 3) That ACPI_NOTIFY_DEVICE_CHECK for BAT1 apparently triggers this call chain: acpi_bus_notify() acpi_hotplug_schedule() acpi_hotplug_work_fn() acpi_device_hotplug() dock_notify() 4) Perhaps Lenovo needs to update the ACPI part of this laptop's firmware. (I'm running the latest firmware.) Does Lenovo listen to suggestions to update its firmware? 5) A workaround in the kernel _might_ be something utterly untested like this: Please note that BAT1 does have a _EJ0 method but doesn't have a _DCK method. 6) Any suggestions? Paul Bolle --- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index d9339b442a4e..9e5856a6adfb 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c @@ -333,7 +333,7 @@ static void dock_event(struct dock_station *ds, u32 event, int num) * * Execute the _DCK method in response to an acpi event */ -static void handle_dock(struct dock_station *ds, int dock) +static acpi_status handle_dock(struct dock_station *ds, int dock) { acpi_status status; struct acpi_object_list arg_list; @@ -351,11 +351,12 @@ static void handle_dock(struct dock_station *ds, int dock) if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) acpi_handle_err(ds->handle, "Failed to execute _DCK (0x%x)\n", status); + return status; } -static inline void dock(struct dock_station *ds) +static inline acpi_status dock(struct dock_station *ds) { - handle_dock(ds, 1); + return handle_dock(ds, 1); } static inline void undock(struct dock_station *ds) @@ -471,8 +472,12 @@ int dock_notify(struct acpi_device *adev, u32 event) case ACPI_NOTIFY_BUS_CHECK: case ACPI_NOTIFY_DEVICE_CHECK: if (!dock_in_progress(ds) && !acpi_device_enumerated(adev)) { + acpi_status status; + begin_dock(ds); - dock(ds); + status = dock(ds); + if (status == AE_NOT_FOUND) + break; if (!dock_present(ds)) { acpi_handle_err(handle, "Unable to dock!\n"); complete_dock(ds);