aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-07-14 16:38:28 -0400
committerJean Delvare <khali@mahadeva.delvare>2008-07-14 16:38:28 -0400
commitc1b6b4f2342d073698dfc2547240c35045a1d00e (patch)
tree2aa5024a099e1c4d5a5b4bc0ce5f832d80d6a15e /drivers
parent0d2b405a628309310b4fc02b26d713b855ad5f68 (diff)
i2c: Let framebuffer drivers set their I2C bus class to DDC
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/fb_ddc.c1
-rw-r--r--drivers/video/intelfb/intelfb_i2c.c12
-rw-r--r--drivers/video/matrox/i2c-matroxfb.c20
3 files changed, 23 insertions, 10 deletions
diff --git a/drivers/video/fb_ddc.c b/drivers/video/fb_ddc.c
index a0df63289b5f..0cf96eb8a60f 100644
--- a/drivers/video/fb_ddc.c
+++ b/drivers/video/fb_ddc.c
@@ -106,6 +106,7 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
106 algo_data->setsda(algo_data->data, 1); 106 algo_data->setsda(algo_data->data, 1);
107 algo_data->setscl(algo_data->data, 1); 107 algo_data->setscl(algo_data->data, 1);
108 108
109 adapter->class |= I2C_CLASS_DDC;
109 return edid; 110 return edid;
110} 111}
111 112
diff --git a/drivers/video/intelfb/intelfb_i2c.c b/drivers/video/intelfb/intelfb_i2c.c
index ca95f09d8b43..fcf9fadbf572 100644
--- a/drivers/video/intelfb/intelfb_i2c.c
+++ b/drivers/video/intelfb/intelfb_i2c.c
@@ -100,7 +100,8 @@ static int intelfb_gpio_getsda(void *data)
100 100
101static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo, 101static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo,
102 struct intelfb_i2c_chan *chan, 102 struct intelfb_i2c_chan *chan,
103 const u32 reg, const char *name) 103 const u32 reg, const char *name,
104 int class)
104{ 105{
105 int rc; 106 int rc;
106 107
@@ -108,6 +109,7 @@ static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo,
108 chan->reg = reg; 109 chan->reg = reg;
109 snprintf(chan->adapter.name, sizeof(chan->adapter.name), 110 snprintf(chan->adapter.name, sizeof(chan->adapter.name),
110 "intelfb %s", name); 111 "intelfb %s", name);
112 chan->adapter.class = class;
111 chan->adapter.owner = THIS_MODULE; 113 chan->adapter.owner = THIS_MODULE;
112 chan->adapter.id = I2C_HW_B_INTELFB; 114 chan->adapter.id = I2C_HW_B_INTELFB;
113 chan->adapter.algo_data = &chan->algo; 115 chan->adapter.algo_data = &chan->algo;
@@ -145,7 +147,7 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo)
145 147
146 /* setup the DDC bus for analog output */ 148 /* setup the DDC bus for analog output */
147 intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOA, 149 intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOA,
148 "CRTDDC_A"); 150 "CRTDDC_A", I2C_CLASS_DDC);
149 i++; 151 i++;
150 152
151 /* need to add the output busses for each device 153 /* need to add the output busses for each device
@@ -159,9 +161,9 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo)
159 case INTEL_865G: 161 case INTEL_865G:
160 dinfo->output[i].type = INTELFB_OUTPUT_DVO; 162 dinfo->output[i].type = INTELFB_OUTPUT_DVO;
161 intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, 163 intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus,
162 GPIOD, "DVODDC_D"); 164 GPIOD, "DVODDC_D", I2C_CLASS_DDC);
163 intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, 165 intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus,
164 GPIOE, "DVOI2C_E"); 166 GPIOE, "DVOI2C_E", 0);
165 i++; 167 i++;
166 break; 168 break;
167 case INTEL_915G: 169 case INTEL_915G:
@@ -174,7 +176,7 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo)
174 /* SDVO ports have a single control bus - 2 devices */ 176 /* SDVO ports have a single control bus - 2 devices */
175 dinfo->output[i].type = INTELFB_OUTPUT_SDVO; 177 dinfo->output[i].type = INTELFB_OUTPUT_SDVO;
176 intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, 178 intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus,
177 GPIOE, "SDVOCTRL_E"); 179 GPIOE, "SDVOCTRL_E", 0);
178 /* TODO: initialize the SDVO */ 180 /* TODO: initialize the SDVO */
179 /* I830SDVOInit(pScrn, i, DVOB); */ 181 /* I830SDVOInit(pScrn, i, DVOB); */
180 i++; 182 i++;
diff --git a/drivers/video/matrox/i2c-matroxfb.c b/drivers/video/matrox/i2c-matroxfb.c
index 4baab7be58de..75ee5a12e549 100644
--- a/drivers/video/matrox/i2c-matroxfb.c
+++ b/drivers/video/matrox/i2c-matroxfb.c
@@ -104,7 +104,9 @@ static struct i2c_algo_bit_data matrox_i2c_algo_template =
104}; 104};
105 105
106static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo, 106static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo,
107 unsigned int data, unsigned int clock, const char* name) { 107 unsigned int data, unsigned int clock, const char *name,
108 int class)
109{
108 int err; 110 int err;
109 111
110 b->minfo = minfo; 112 b->minfo = minfo;
@@ -114,6 +116,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo,
114 snprintf(b->adapter.name, sizeof(b->adapter.name), name, 116 snprintf(b->adapter.name, sizeof(b->adapter.name), name,
115 minfo->fbcon.node); 117 minfo->fbcon.node);
116 i2c_set_adapdata(&b->adapter, b); 118 i2c_set_adapdata(&b->adapter, b);
119 b->adapter.class = class;
117 b->adapter.algo_data = &b->bac; 120 b->adapter.algo_data = &b->bac;
118 b->adapter.dev.parent = &ACCESS_FBINFO(pcidev)->dev; 121 b->adapter.dev.parent = &ACCESS_FBINFO(pcidev)->dev;
119 b->bac = matrox_i2c_algo_template; 122 b->bac = matrox_i2c_algo_template;
@@ -159,22 +162,29 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
159 switch (ACCESS_FBINFO(chip)) { 162 switch (ACCESS_FBINFO(chip)) {
160 case MGA_2064: 163 case MGA_2064:
161 case MGA_2164: 164 case MGA_2164:
162 err = i2c_bus_reg(&m2info->ddc1, minfo, DDC1B_DATA, DDC1B_CLK, "DDC:fb%u #0"); 165 err = i2c_bus_reg(&m2info->ddc1, minfo,
166 DDC1B_DATA, DDC1B_CLK,
167 "DDC:fb%u #0", I2C_CLASS_DDC);
163 break; 168 break;
164 default: 169 default:
165 err = i2c_bus_reg(&m2info->ddc1, minfo, DDC1_DATA, DDC1_CLK, "DDC:fb%u #0"); 170 err = i2c_bus_reg(&m2info->ddc1, minfo,
171 DDC1_DATA, DDC1_CLK,
172 "DDC:fb%u #0", I2C_CLASS_DDC);
166 break; 173 break;
167 } 174 }
168 if (err) 175 if (err)
169 goto fail_ddc1; 176 goto fail_ddc1;
170 if (ACCESS_FBINFO(devflags.dualhead)) { 177 if (ACCESS_FBINFO(devflags.dualhead)) {
171 err = i2c_bus_reg(&m2info->ddc2, minfo, DDC2_DATA, DDC2_CLK, "DDC:fb%u #1"); 178 err = i2c_bus_reg(&m2info->ddc2, minfo,
179 DDC2_DATA, DDC2_CLK,
180 "DDC:fb%u #1", I2C_CLASS_DDC);
172 if (err == -ENODEV) { 181 if (err == -ENODEV) {
173 printk(KERN_INFO "i2c-matroxfb: VGA->TV plug detected, DDC unavailable.\n"); 182 printk(KERN_INFO "i2c-matroxfb: VGA->TV plug detected, DDC unavailable.\n");
174 } else if (err) 183 } else if (err)
175 printk(KERN_INFO "i2c-matroxfb: Could not register secondary output i2c bus. Continuing anyway.\n"); 184 printk(KERN_INFO "i2c-matroxfb: Could not register secondary output i2c bus. Continuing anyway.\n");
176 /* Register maven bus even on G450/G550 */ 185 /* Register maven bus even on G450/G550 */
177 err = i2c_bus_reg(&m2info->maven, minfo, MAT_DATA, MAT_CLK, "MAVEN:fb%u"); 186 err = i2c_bus_reg(&m2info->maven, minfo,
187 MAT_DATA, MAT_CLK, "MAVEN:fb%u", 0);
178 if (err) 188 if (err)
179 printk(KERN_INFO "i2c-matroxfb: Could not register Maven i2c bus. Continuing anyway.\n"); 189 printk(KERN_INFO "i2c-matroxfb: Could not register Maven i2c bus. Continuing anyway.\n");
180 } 190 }