]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/i2c/busses/i2c-i801.c
Merge git://git.infradead.org/mtd-2.6
[linux-2.6-omap-h63xx.git] / drivers / i2c / busses / i2c-i801.c
index 5123eb69a971b22e267d5de0213276c93eee3a1c..230238df56c4d238d3fd4e9d184c7e1d1f608968 100644 (file)
@@ -64,7 +64,7 @@
 #include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/acpi.h>
-#include <asm/io.h>
+#include <linux/io.h>
 
 /* I801 SMBus address offsets */
 #define SMBHSTSTS      (0 + i801_smba)
@@ -556,7 +556,6 @@ static const struct i2c_algorithm smbus_algorithm = {
 
 static struct i2c_adapter i801_adapter = {
        .owner          = THIS_MODULE,
-       .id             = I2C_HW_SMBUS_I801,
        .class          = I2C_CLASS_HWMON | I2C_CLASS_SPD,
        .algo           = &smbus_algorithm,
 };
@@ -583,6 +582,40 @@ static struct pci_device_id i801_ids[] = {
 
 MODULE_DEVICE_TABLE (pci, i801_ids);
 
+#if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE
+static unsigned char apanel_addr;
+
+/* Scan the system ROM for the signature "FJKEYINF" */
+static __init const void __iomem *bios_signature(const void __iomem *bios)
+{
+       ssize_t offset;
+       const unsigned char signature[] = "FJKEYINF";
+
+       for (offset = 0; offset < 0x10000; offset += 0x10) {
+               if (check_signature(bios + offset, signature,
+                                   sizeof(signature)-1))
+                       return bios + offset;
+       }
+       return NULL;
+}
+
+static void __init input_apanel_init(void)
+{
+       void __iomem *bios;
+       const void __iomem *p;
+
+       bios = ioremap(0xF0000, 0x10000); /* Can't fail */
+       p = bios_signature(bios);
+       if (p) {
+               /* just use the first address */
+               apanel_addr = readb(p + 8 + 3) >> 1;
+       }
+       iounmap(bios);
+}
+#else
+static void __init input_apanel_init(void) {}
+#endif
+
 static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
        unsigned char temp;
@@ -667,6 +700,19 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
                dev_err(&dev->dev, "Failed to add SMBus adapter\n");
                goto exit_release;
        }
+
+       /* Register optional slaves */
+#if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE
+       if (apanel_addr) {
+               struct i2c_board_info info;
+
+               memset(&info, 0, sizeof(struct i2c_board_info));
+               info.addr = apanel_addr;
+               strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE);
+               i2c_new_device(&i801_adapter, &info);
+       }
+#endif
+
        return 0;
 
 exit_release:
@@ -717,6 +763,7 @@ static struct pci_driver i801_driver = {
 
 static int __init i2c_i801_init(void)
 {
+       input_apanel_init();
        return pci_register_driver(&i801_driver);
 }