]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/i2c/chips/eeprom.c
i2c/eeprom: Only probe buses with DDC or SPD class
[linux-2.6-omap-h63xx.git] / drivers / i2c / chips / eeprom.c
index 1a7eeebac506d63b05d8f1c96e98c29040bd5f41..213a9f98decc8048c6cb684d207c9f853cb01755 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/mutex.h>
 
 /* Addresses to scan */
-static unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,
+static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,
                                        0x55, 0x56, 0x57, I2C_CLIENT_END };
 
 /* Insmod parameters */
@@ -71,7 +71,6 @@ static struct i2c_driver eeprom_driver = {
        .driver = {
                .name   = "eeprom",
        },
-       .id             = I2C_DRIVERID_EEPROM,
        .attach_adapter = eeprom_attach_adapter,
        .detach_client  = eeprom_detach_client,
 };
@@ -160,6 +159,8 @@ static struct bin_attribute eeprom_attr = {
 
 static int eeprom_attach_adapter(struct i2c_adapter *adapter)
 {
+       if (!(adapter->class & (I2C_CLASS_DDC | I2C_CLASS_SPD)))
+               return 0;
        return i2c_probe(adapter, &addr_data, eeprom_detect);
 }
 
@@ -170,6 +171,12 @@ static int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
        struct eeprom_data *data;
        int err = 0;
 
+       /* EDID EEPROMs are often 24C00 EEPROMs, which answer to all
+          addresses 0x50-0x57, but we only care about 0x50. So decline
+          attaching to addresses >= 0x51 on DDC buses */
+       if (!(adapter->class & I2C_CLASS_SPD) && address >= 0x51)
+               goto exit;
+
        /* There are three ways we can read the EEPROM data:
           (1) I2C block reads (faster, but unsupported by most adapters)
           (2) Consecutive byte reads (100% overhead)