linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: djwong@us.ibm.com, lenb@kernel.org, Crane Cai <crane.cai@amd.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: [RESEND PATCH v2 1/2] ACPI: Quirk to make SMBus objects work on IBM machines with broken BIOSes
Date: Thu, 17 Dec 2009 15:02:43 +0100	[thread overview]
Message-ID: <20091217150243.0d2749a2@hyperion.delvare> (raw)
In-Reply-To: <20091204181103.GN10295@tux1.beaverton.ibm.com>

On Fri, 4 Dec 2009 10:11:03 -0800, Darrick J. Wong wrote:
> On some old IBM workstations and desktop computers, the BIOS presents in the
> DSDT an SMBus object that is missing the HID identifier that the i2c-scmi
> driver looks for.  Modify the ACPI device scan code to insert the missing HID
> if it finds an IBM system with such an object.  This patch requires Crane Cai's
> update to i2c-scmi to work around incorrectly named methods within the SMBus
> control object.
> 
> Affected machines: ThinkCenter M52, IntelliStation Z20/Z30.  Note that the
> i2c-i801 driver no longer works on these machines because of ACPI resource
> conflicts.
> 
> Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
> ---
> 
>  drivers/acpi/scan.c         |   38 ++++++++++++++++++++++++++++++++++++++
>  include/acpi/acpi_drivers.h |    2 ++
>  2 files changed, 40 insertions(+), 0 deletions(-)
> 
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 14a7481..5a24429 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -8,6 +8,7 @@
>  #include <linux/acpi.h>
>  #include <linux/signal.h>
>  #include <linux/kthread.h>
> +#include <linux/dmi.h>
>  
>  #include <acpi/acpi_drivers.h>
>  
> @@ -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 acpi_ibm_smbus_match(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 (!acpi_ibm_smbus_match(device))
> +			acpi_add_id(device, ACPI_SMBUS_IBM_HID);
>  
>  		break;
>  	case ACPI_BUS_TYPE_POWER:
> 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

Bjorn, Len, can you please apply this quickly? The i2c-scmi side of the
changes is pending for weeks now, but I can't apply it as long as the
ACPI parts aren't in.

Thanks,
-- 
Jean Delvare

  reply	other threads:[~2009-12-17 14:02 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-20 23:11 [PATCH] i2c-scmi: Quirk to work on IBM machines with broken BIOSes Darrick J. Wong
2009-10-21  2:30 ` Crane Cai
2009-10-21 14:57   ` Bjorn Helgaas
     [not found]     ` <200910210857.13978.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2009-10-21 17:37       ` Darrick J. Wong
2009-10-22  7:17         ` Crane Cai
2009-10-22 17:43           ` Darrick J. Wong
2009-10-22 18:37             ` Jean Delvare
2009-10-23  4:44             ` Crane Cai
2009-10-23 17:03               ` [PATCH 1/2] i2c-scmi: support IBM SMBus CMI devices Darrick J. Wong
     [not found]                 ` <20091023170306.GP26149-bjhdApgbSaxhsM67afOH+sxtgHpCUUYS@public.gmane.org>
2009-10-25  9:39                   ` Jean Delvare
     [not found]                     ` <20091025103932.31ce9a6d-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-10-26  2:54                       ` Crane Cai
2009-10-23 17:03               ` [PATCH 2/2] acpi: " Darrick J. Wong
2009-10-25 11:53                 ` Jean Delvare
2009-10-26 20:53                   ` Darrick J. Wong
2009-10-26 20:58                   ` [PATCH v2 1/2] " Darrick J. Wong
2009-10-27 17:03                     ` Jean Delvare
2009-10-27 17:30                       ` Darrick J. Wong
     [not found]                         ` <20091027173001.GT26149-bjhdApgbSaxhsM67afOH+sxtgHpCUUYS@public.gmane.org>
2009-10-27 17:36                           ` Jean Delvare
2009-12-04 17:06                             ` Darrick J. Wong
     [not found]                               ` <20091204170621.GA10356-bjhdApgbSaxhsM67afOH+sxtgHpCUUYS@public.gmane.org>
2009-12-04 17:36                                 ` Bjorn Helgaas
     [not found]                                   ` <200912041036.36686.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2009-12-04 18:07                                     ` Darrick J. Wong
2009-12-04 18:11                                     ` [RESEND PATCH v2 1/2] ACPI: Quirk to make SMBus objects work on IBM machines with broken BIOSes Darrick J. Wong
2009-12-17 14:02                                       ` Jean Delvare [this message]
2010-01-05 12:30                                         ` Jean Delvare
2009-12-04 18:13                                     ` [RESEND PATCH v2 2/2] i2c-scmi: support IBM SMBus CMI devices Darrick J. Wong
2009-10-26 21:00                   ` [PATCH " Darrick J. Wong
2009-10-27 17:24                     ` Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091217150243.0d2749a2@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=bjorn.helgaas@hp.com \
    --cc=crane.cai@amd.com \
    --cc=djwong@us.ibm.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).