]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
i2c: Let framebuffer drivers set their I2C bus class to DDC
authorJean Delvare <khali@linux-fr.org>
Mon, 14 Jul 2008 20:38:28 +0000 (22:38 +0200)
committerJean Delvare <khali@mahadeva.delvare>
Mon, 14 Jul 2008 20:38:28 +0000 (22:38 +0200)
Let framebuffer drivers set their I2C bus class to DDC. Once this is
done, we will be able to tell the eeprom driver to only probe for
EDID EEPROMs on these buses.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/video/fb_ddc.c
drivers/video/intelfb/intelfb_i2c.c
drivers/video/matrox/i2c-matroxfb.c
include/linux/i2c.h

index a0df63289b5f83ed9007be92df25c9c5f7065b4c..0cf96eb8a60f610b3fc26f0bc827453eb1c201fc 100644 (file)
@@ -106,6 +106,7 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
        algo_data->setsda(algo_data->data, 1);
        algo_data->setscl(algo_data->data, 1);
 
+       adapter->class |= I2C_CLASS_DDC;
        return edid;
 }
 
index ca95f09d8b43f7e9f88ddf7681e361f386493c0c..fcf9fadbf5722d328f521af00aa8fe5675e16da0 100644 (file)
@@ -100,7 +100,8 @@ static int intelfb_gpio_getsda(void *data)
 
 static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo,
                                 struct intelfb_i2c_chan *chan,
-                                const u32 reg, const char *name)
+                                const u32 reg, const char *name,
+                                int class)
 {
        int rc;
 
@@ -108,6 +109,7 @@ static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo,
        chan->reg                       = reg;
        snprintf(chan->adapter.name, sizeof(chan->adapter.name),
                 "intelfb %s", name);
+       chan->adapter.class             = class;
        chan->adapter.owner             = THIS_MODULE;
        chan->adapter.id                = I2C_HW_B_INTELFB;
        chan->adapter.algo_data         = &chan->algo;
@@ -145,7 +147,7 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo)
 
        /* setup the DDC bus for analog output */
        intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOA,
-                             "CRTDDC_A");
+                             "CRTDDC_A", I2C_CLASS_DDC);
        i++;
 
        /* need to add the output busses for each device
@@ -159,9 +161,9 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo)
        case INTEL_865G:
                dinfo->output[i].type = INTELFB_OUTPUT_DVO;
                intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus,
-                                     GPIOD, "DVODDC_D");
+                                     GPIOD, "DVODDC_D", I2C_CLASS_DDC);
                intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus,
-                                     GPIOE, "DVOI2C_E");
+                                     GPIOE, "DVOI2C_E", 0);
                i++;
                break;
        case INTEL_915G:
@@ -174,7 +176,7 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo)
                /* SDVO ports have a single control bus - 2 devices */
                dinfo->output[i].type = INTELFB_OUTPUT_SDVO;
                intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus,
-                                     GPIOE, "SDVOCTRL_E");
+                                     GPIOE, "SDVOCTRL_E", 0);
                /* TODO: initialize the SDVO */
                /* I830SDVOInit(pScrn, i, DVOB); */
                i++;
index 4baab7be58de4f075de0f197ac5b019da3d35eb4..75ee5a12e549ec703a0974c984975c1cdf2ac29a 100644 (file)
@@ -104,7 +104,9 @@ static struct i2c_algo_bit_data matrox_i2c_algo_template =
 };
 
 static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo, 
-               unsigned int data, unsigned int clock, const char* name) {
+               unsigned int data, unsigned int clock, const char *name,
+               int class)
+{
        int err;
 
        b->minfo = minfo;
@@ -114,6 +116,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo,
        snprintf(b->adapter.name, sizeof(b->adapter.name), name,
                minfo->fbcon.node);
        i2c_set_adapdata(&b->adapter, b);
+       b->adapter.class = class;
        b->adapter.algo_data = &b->bac;
        b->adapter.dev.parent = &ACCESS_FBINFO(pcidev)->dev;
        b->bac = matrox_i2c_algo_template;
@@ -159,22 +162,29 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
        switch (ACCESS_FBINFO(chip)) {
                case MGA_2064:
                case MGA_2164:
-                       err = i2c_bus_reg(&m2info->ddc1, minfo, DDC1B_DATA, DDC1B_CLK, "DDC:fb%u #0");
+                       err = i2c_bus_reg(&m2info->ddc1, minfo,
+                                         DDC1B_DATA, DDC1B_CLK,
+                                         "DDC:fb%u #0", I2C_CLASS_DDC);
                        break;
                default:
-                       err = i2c_bus_reg(&m2info->ddc1, minfo, DDC1_DATA, DDC1_CLK, "DDC:fb%u #0");
+                       err = i2c_bus_reg(&m2info->ddc1, minfo,
+                                         DDC1_DATA, DDC1_CLK,
+                                         "DDC:fb%u #0", I2C_CLASS_DDC);
                        break;
        }
        if (err)
                goto fail_ddc1;
        if (ACCESS_FBINFO(devflags.dualhead)) {
-               err = i2c_bus_reg(&m2info->ddc2, minfo, DDC2_DATA, DDC2_CLK, "DDC:fb%u #1");
+               err = i2c_bus_reg(&m2info->ddc2, minfo,
+                                 DDC2_DATA, DDC2_CLK,
+                                 "DDC:fb%u #1", I2C_CLASS_DDC);
                if (err == -ENODEV) {
                        printk(KERN_INFO "i2c-matroxfb: VGA->TV plug detected, DDC unavailable.\n");
                } else if (err)
                        printk(KERN_INFO "i2c-matroxfb: Could not register secondary output i2c bus. Continuing anyway.\n");
                /* Register maven bus even on G450/G550 */
-               err = i2c_bus_reg(&m2info->maven, minfo, MAT_DATA, MAT_CLK, "MAVEN:fb%u");
+               err = i2c_bus_reg(&m2info->maven, minfo,
+                                 MAT_DATA, MAT_CLK, "MAVEN:fb%u", 0);
                if (err)
                        printk(KERN_INFO "i2c-matroxfb: Could not register Maven i2c bus. Continuing anyway.\n");
        }
index 7c36d5188d397a59c58d640885809e6d776fec08..145797fe6a310b128f42396619264638f131c71e 100644 (file)
@@ -349,7 +349,7 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
 #define I2C_CLASS_HWMON                (1<<0)  /* lm_sensors, ... */
 #define I2C_CLASS_TV_ANALOG    (1<<1)  /* bttv + friends */
 #define I2C_CLASS_TV_DIGITAL   (1<<2)  /* dvb cards */
-#define I2C_CLASS_DDC          (1<<3)  /* i2c-matroxfb ? */
+#define I2C_CLASS_DDC          (1<<3)  /* DDC bus on graphics adapters */
 #define I2C_CLASS_CAM_ANALOG   (1<<4)  /* camera with analog CCD */
 #define I2C_CLASS_CAM_DIGITAL  (1<<5)  /* most webcams */
 #define I2C_CLASS_SOUND                (1<<6)  /* sound devices */