From patchwork Mon Jan 6 14:50:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 3438661 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 43CA9C02DC for ; Mon, 6 Jan 2014 14:51:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1A02A2016D for ; Mon, 6 Jan 2014 14:51:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E7686200E7 for ; Mon, 6 Jan 2014 14:51:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753882AbaAFOuu (ORCPT ); Mon, 6 Jan 2014 09:50:50 -0500 Received: from mga11.intel.com ([192.55.52.93]:34022 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751580AbaAFOut (ORCPT ); Mon, 6 Jan 2014 09:50:49 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 06 Jan 2014 06:50:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,613,1384329600"; d="scan'208";a="460755713" Received: from unknown (HELO localhost) ([10.255.21.142]) by fmsmga002.fm.intel.com with ESMTP; 06 Jan 2014 06:50:46 -0800 From: Lan Tianyu To: lenb@kernel.org, rjw@rjwysocki.net Cc: Lan Tianyu , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, fcr@adinet.com.uy, l@dorileo.org, dmitry.torokhov@gmail.com, "3.8+" Subject: [PATCH V2] ACPI/Battery: Add a _BIX quirk for NEC LZ750/LS Date: Mon, 6 Jan 2014 22:50:37 +0800 Message-Id: <1389019837-13619-1-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.8.2.1 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.2 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 aml method _BIX of NEC LZ750/LS returns a broken package which skip the first member "Revision" according ACPI 5.0 spec Table 10-234. This patch is to add a quirk for this machine to skip member "Revision" during parsing _BIX returned package. Reported-and-tested-by: Francisco Castro Reference: https://bugzilla.kernel.org/show_bug.cgi?id=67351 Cc: 3.8+ Signed-off-by: Lan Tianyu Reviewed-by: Dmitry Torokhov --- Change since v1: Remove battery_bix_package_quirk() function and set battery_bix_broken_package flag according the returned value of dmi_check_system(). drivers/acpi/battery.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index e90ef8b..d21cc1a 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -61,6 +61,7 @@ MODULE_AUTHOR("Alexey Starikovskiy "); MODULE_DESCRIPTION("ACPI Battery Driver"); MODULE_LICENSE("GPL"); +static int battery_bix_broken_package; static unsigned int cache_time = 1000; module_param(cache_time, uint, 0644); MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); @@ -415,7 +416,12 @@ static int acpi_battery_get_info(struct acpi_battery *battery) ACPI_EXCEPTION((AE_INFO, status, "Evaluating %s", name)); return -ENODEV; } - if (test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags)) + + if (battery_bix_broken_package) + result = extract_package(battery, buffer.pointer, + extended_info_offsets + 1, + ARRAY_SIZE(extended_info_offsets) - 1); + else if (test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags)) result = extract_package(battery, buffer.pointer, extended_info_offsets, ARRAY_SIZE(extended_info_offsets)); @@ -753,6 +759,17 @@ static int battery_notify(struct notifier_block *nb, return 0; } +static struct dmi_system_id bat_dmi_table[] = { + { + .ident = "NEC LZ750/LS", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "NEC"), + DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"), + }, + }, + {}, +}; + static int acpi_battery_add(struct acpi_device *device) { int result = 0; @@ -845,6 +862,9 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) { if (acpi_disabled) return; + + if (dmi_check_system(bat_dmi_table)) + battery_bix_broken_package = 1; acpi_bus_register_driver(&acpi_battery_driver); }