From patchwork Fri Oct 23 17:03:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 55598 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9NH3HQF027109 for ; Fri, 23 Oct 2009 17:03:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752478AbZJWRDK (ORCPT ); Fri, 23 Oct 2009 13:03:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752494AbZJWRDK (ORCPT ); Fri, 23 Oct 2009 13:03:10 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:45614 "EHLO e7.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752478AbZJWRDI (ORCPT ); Fri, 23 Oct 2009 13:03:08 -0400 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by e7.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id n9NGxxGV023265; Fri, 23 Oct 2009 12:59:59 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n9NH3DO6082332; Fri, 23 Oct 2009 13:03:13 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id n9NB4jxi005894; Fri, 23 Oct 2009 07:04:45 -0400 Received: from tux1.beaverton.ibm.com (elm3a169.beaverton.ibm.com [9.47.66.169]) by d01av03.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id n9NB4ine005841; Fri, 23 Oct 2009 07:04:45 -0400 Received: by tux1.beaverton.ibm.com (Postfix, from userid 501) id 8AFE413E76E; Fri, 23 Oct 2009 10:03:11 -0700 (PDT) Date: Fri, 23 Oct 2009 10:03:11 -0700 From: "Darrick J. Wong" To: Crane Cai , Bjorn Helgaas , lenb@kernel.org, linux-kernel , linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org, Jean Delvare Subject: [PATCH 2/2] acpi: support IBM SMBus CMI devices Message-ID: <20091023170311.GC21723@tux1.beaverton.ibm.com> Reply-To: djwong@us.ibm.com References: <20091020231149.GM26149@tux1.beaverton.ibm.com> <20091021023016.GC32413@crane-desktop> <200910210857.13978.bjorn.helgaas@hp.com> <20091021173733.GN26149@tux1.beaverton.ibm.com> <20091022071748.GA17917@crane-desktop> <20091022174304.GO26149@tux1.beaverton.ibm.com> <20091023044451.GB1367@crane-desktop> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091023044451.GB1367@crane-desktop> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 14a7481..89f8992 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -8,6 +8,7 @@ #include #include #include +#include #include @@ -1014,6 +1015,41 @@ static void acpi_add_id(struct acpi_device *device, const char *dev_id) list_add_tail(&id->list, &device->pnp.ids); } +/* + * Old IBM workstations have a DSDT bug wherein the SMBus object + * lacks the SMBUS01 HID and the methods do not have the necessary "_" + * prefix. Work around this. + */ +static int probe_ibm_smbus_device(struct acpi_device *device) +{ + acpi_handle h_dummy; + struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER, NULL}; + int result; + + if (!dmi_name_in_vendors("IBM")) + return -ENODEV; + + /* Look for SMBS object */ + result = acpi_get_name(device->handle, ACPI_SINGLE_NAME, &path); + if (result) + return result; + + if (strcmp("SMBS", path.pointer)) { + result = -ENODEV; + goto out; + } + + /* Does it have the necessary (but misnamed) methods? */ + result = -ENODEV; + if (ACPI_SUCCESS(acpi_get_handle(device->handle, "SBI", &h_dummy)) && + ACPI_SUCCESS(acpi_get_handle(device->handle, "SBR", &h_dummy)) && + ACPI_SUCCESS(acpi_get_handle(device->handle, "SBW", &h_dummy))) + result = 0; +out: + kfree(path.pointer); + return result; +} + static void acpi_device_set_id(struct acpi_device *device) { acpi_status status; @@ -1064,6 +1100,8 @@ static void acpi_device_set_id(struct acpi_device *device) acpi_add_id(device, ACPI_BAY_HID); else if (ACPI_SUCCESS(acpi_dock_match(device))) acpi_add_id(device, ACPI_DOCK_HID); + else if (!probe_ibm_smbus_device(device)) + acpi_add_id(device, ACPI_SMBUS_IBM_HID); break; case ACPI_BUS_TYPE_POWER: diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c index a15aaf4..22c26c2 100644 --- a/drivers/i2c/busses/i2c-scmi.c +++ b/drivers/i2c/busses/i2c-scmi.c @@ -51,7 +51,7 @@ static const struct smbus_methods_t ibm_smbus_methods = { static const struct acpi_device_id acpi_smbus_cmi_ids[] = { {"SMBUS01", (kernel_ulong_t)&smbus_methods}, - {"SMBUSIBM", (kernel_ulong_t)&ibm_smbus_methods}, + {ACPI_SMBUS_IBM_HID, (kernel_ulong_t)&ibm_smbus_methods}, {"", 0} }; diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index f4906f6..83a2960 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h @@ -65,6 +65,8 @@ #define ACPI_VIDEO_HID "LNXVIDEO" #define ACPI_BAY_HID "LNXIOBAY" #define ACPI_DOCK_HID "LNXDOCK" +/* Quirk for broken IBM BIOSes */ +#define ACPI_SMBUS_IBM_HID "SMBUSIBM" /* * For fixed hardware buttons, we fabricate acpi_devices with HID