From: "Darrick J. Wong" <djwong-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Crane Cai <crane.cai-5C7GfCeVMHo@public.gmane.org>,
Bjorn Helgaas <bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>,
lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
linux-kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-acpi-u79uwXL29TaqPxH82wqD4g@public.gmane.org
Subject: [PATCH 1/2] i2c-scmi: support IBM SMBus CMI devices
Date: Fri, 23 Oct 2009 10:03:07 -0700 [thread overview]
Message-ID: <20091023170306.GP26149@tux1.beaverton.ibm.com> (raw)
In-Reply-To: <20091023044451.GB1367@crane-desktop>
*) add a new HID for IBM SMBus CMI devices
*) add methods for IBM SMBus CMI devices
*) hook different HID with different control methods set
Signed-off-by: Crane Cai <crane.cai-5C7GfCeVMHo@public.gmane.org>
---
drivers/i2c/busses/i2c-scmi.c | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c
index b4a55d4..a15aaf4 100644
--- a/drivers/i2c/busses/i2c-scmi.c
+++ b/drivers/i2c/busses/i2c-scmi.c
@@ -33,6 +33,7 @@ struct acpi_smbus_cmi {
u8 cap_info:1;
u8 cap_read:1;
u8 cap_write:1;
+ struct smbus_methods_t *methods;
};
static const struct smbus_methods_t smbus_methods = {
@@ -41,8 +42,16 @@ static const struct smbus_methods_t smbus_methods = {
.mt_sbw = "_SBW",
};
+/* Some IBM BIOSes omit the leading underscore */
+static const struct smbus_methods_t ibm_smbus_methods = {
+ .mt_info = "SBI_",
+ .mt_sbr = "SBR_",
+ .mt_sbw = "SBW_",
+};
+
static const struct acpi_device_id acpi_smbus_cmi_ids[] = {
- {"SMBUS01", 0},
+ {"SMBUS01", (kernel_ulong_t)&smbus_methods},
+ {"SMBUSIBM", (kernel_ulong_t)&ibm_smbus_methods},
{"", 0}
};
@@ -150,11 +159,11 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
if (read_write == I2C_SMBUS_READ) {
protocol |= ACPI_SMBUS_PRTCL_READ;
- method = smbus_methods.mt_sbr;
+ method = smbus_cmi->methods->mt_sbr;
input.count = 3;
} else {
protocol |= ACPI_SMBUS_PRTCL_WRITE;
- method = smbus_methods.mt_sbw;
+ method = smbus_cmi->methods->mt_sbw;
input.count = 5;
}
@@ -290,13 +299,13 @@ static int acpi_smbus_cmi_add_cap(struct acpi_smbus_cmi *smbus_cmi,
union acpi_object *obj;
acpi_status status;
- if (!strcmp(name, smbus_methods.mt_info)) {
+ if (!strcmp(name, smbus_cmi->methods->mt_info)) {
status = acpi_evaluate_object(smbus_cmi->handle,
- smbus_methods.mt_info,
+ smbus_cmi->methods->mt_info,
NULL, &buffer);
if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO, "Evaluating %s: %i",
- smbus_methods.mt_info, status));
+ smbus_cmi->methods->mt_info, status));
return -EIO;
}
@@ -319,9 +328,9 @@ static int acpi_smbus_cmi_add_cap(struct acpi_smbus_cmi *smbus_cmi,
kfree(buffer.pointer);
smbus_cmi->cap_info = 1;
- } else if (!strcmp(name, smbus_methods.mt_sbr))
+ } else if (!strcmp(name, smbus_cmi->methods->mt_sbr))
smbus_cmi->cap_read = 1;
- else if (!strcmp(name, smbus_methods.mt_sbw))
+ else if (!strcmp(name, smbus_cmi->methods->mt_sbw))
smbus_cmi->cap_write = 1;
else
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported CMI method: %s\n",
@@ -349,6 +358,7 @@ static acpi_status acpi_smbus_cmi_query_methods(acpi_handle handle, u32 level,
static int acpi_smbus_cmi_add(struct acpi_device *device)
{
struct acpi_smbus_cmi *smbus_cmi;
+ struct acpi_device_id *id;
smbus_cmi = kzalloc(sizeof(struct acpi_smbus_cmi), GFP_KERNEL);
if (!smbus_cmi)
@@ -362,6 +372,11 @@ static int acpi_smbus_cmi_add(struct acpi_device *device)
smbus_cmi->cap_read = 0;
smbus_cmi->cap_write = 0;
+ for (id = (struct acpi_device_id *)acpi_smbus_cmi_ids; id->id[0]; id++)
+ if (!strcmp((char *) id->id, acpi_device_hid(device)))
+ smbus_cmi->methods =
+ (struct smbus_methods_t *) id->driver_data;
+
acpi_walk_namespace(ACPI_TYPE_METHOD, smbus_cmi->handle, 1,
acpi_smbus_cmi_query_methods, smbus_cmi, NULL);
next prev parent reply other threads:[~2009-10-23 17:03 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 ` Darrick J. Wong [this message]
[not found] ` <20091023170306.GP26149-bjhdApgbSaxhsM67afOH+sxtgHpCUUYS@public.gmane.org>
2009-10-25 9:39 ` [PATCH 1/2] i2c-scmi: support IBM SMBus CMI devices 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
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=20091023170306.GP26149@tux1.beaverton.ibm.com \
--to=djwong-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
--cc=bjorn.helgaas-VXdhtT5mjnY@public.gmane.org \
--cc=crane.cai-5C7GfCeVMHo@public.gmane.org \
--cc=lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-acpi-u79uwXL29TaqPxH82wqD4g@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).