rename patch (v2.6.22.24-op1)
[linux-2.6.22.y-op-patches.git] / backport / i2c-i801-smb / 07-i2c-i801-spec_mode.patch
blobab79d6a6b3b6ba1adb579c2b7eeda828a8a113d2
1 From a0921b6c07dfbb59ac2d497e96438adaf4940f16 Mon Sep 17 00:00:00 2001
2 From: Jean Delvare <khali@linux-fr.org>
3 Date: Sun, 27 Jan 2008 18:14:50 +0100
4 Subject: [PATCH] i2c-i801: Clear special mode bits as needed
6 Clear special mode bits (PEC, block buffer) at driver load time,
7 you never know in which state the device was left by its last user.
9 Also make sure that we reset the block buffer mode at the end of every
10 transaction, not only when PEC was used.
12 Signed-off-by: Jean Delvare <khali@linux-fr.org>
14 diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
15 index c31699d..0b1b1ae 100644
16 --- a/drivers/i2c/busses/i2c-i801.c
17 +++ b/drivers/i2c/busses/i2c-i801.c
18 @@ -502,7 +502,7 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
19 /* Some BIOSes don't like it when PEC is enabled at reboot or resume
20 time, so we forcibly disable it after every transaction. Turn off
21 E32B for the same reason. */
22 - if (hwpec)
23 + if (hwpec || block)
24 outb_p(inb_p(SMBAUXCTL) & ~(SMBAUXCTL_CRC | SMBAUXCTL_E32B),
25 SMBAUXCTL);
27 @@ -625,6 +625,11 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
28 else
29 dev_dbg(&dev->dev, "SMBus using PCI Interrupt\n");
31 + /* Clear special mode bits */
32 + if (i801_features & (FEATURE_SMBUS_PEC | FEATURE_BLOCK_BUFFER))
33 + outb_p(inb_p(SMBAUXCTL) & ~(SMBAUXCTL_CRC | SMBAUXCTL_E32B),
34 + SMBAUXCTL);
36 /* set up the sysfs linkage to our parent device */
37 i801_adapter.dev.parent = &dev->dev;