提交 c1b6b4f2 编写于 作者: J Jean Delvare 提交者: Jean Delvare

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: NJean Delvare <khali@linux-fr.org>
上级 0d2b405a
...@@ -106,6 +106,7 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter) ...@@ -106,6 +106,7 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
algo_data->setsda(algo_data->data, 1); algo_data->setsda(algo_data->data, 1);
algo_data->setscl(algo_data->data, 1); algo_data->setscl(algo_data->data, 1);
adapter->class |= I2C_CLASS_DDC;
return edid; return edid;
} }
......
...@@ -100,7 +100,8 @@ static int intelfb_gpio_getsda(void *data) ...@@ -100,7 +100,8 @@ static int intelfb_gpio_getsda(void *data)
static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo, static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo,
struct intelfb_i2c_chan *chan, struct intelfb_i2c_chan *chan,
const u32 reg, const char *name) const u32 reg, const char *name,
int class)
{ {
int rc; int rc;
...@@ -108,6 +109,7 @@ static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo, ...@@ -108,6 +109,7 @@ static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo,
chan->reg = reg; chan->reg = reg;
snprintf(chan->adapter.name, sizeof(chan->adapter.name), snprintf(chan->adapter.name, sizeof(chan->adapter.name),
"intelfb %s", name); "intelfb %s", name);
chan->adapter.class = class;
chan->adapter.owner = THIS_MODULE; chan->adapter.owner = THIS_MODULE;
chan->adapter.id = I2C_HW_B_INTELFB; chan->adapter.id = I2C_HW_B_INTELFB;
chan->adapter.algo_data = &chan->algo; chan->adapter.algo_data = &chan->algo;
...@@ -145,7 +147,7 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo) ...@@ -145,7 +147,7 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo)
/* setup the DDC bus for analog output */ /* setup the DDC bus for analog output */
intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOA, intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOA,
"CRTDDC_A"); "CRTDDC_A", I2C_CLASS_DDC);
i++; i++;
/* need to add the output busses for each device /* need to add the output busses for each device
...@@ -159,9 +161,9 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo) ...@@ -159,9 +161,9 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo)
case INTEL_865G: case INTEL_865G:
dinfo->output[i].type = INTELFB_OUTPUT_DVO; dinfo->output[i].type = INTELFB_OUTPUT_DVO;
intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, 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, intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus,
GPIOE, "DVOI2C_E"); GPIOE, "DVOI2C_E", 0);
i++; i++;
break; break;
case INTEL_915G: case INTEL_915G:
...@@ -174,7 +176,7 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo) ...@@ -174,7 +176,7 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo)
/* SDVO ports have a single control bus - 2 devices */ /* SDVO ports have a single control bus - 2 devices */
dinfo->output[i].type = INTELFB_OUTPUT_SDVO; dinfo->output[i].type = INTELFB_OUTPUT_SDVO;
intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus,
GPIOE, "SDVOCTRL_E"); GPIOE, "SDVOCTRL_E", 0);
/* TODO: initialize the SDVO */ /* TODO: initialize the SDVO */
/* I830SDVOInit(pScrn, i, DVOB); */ /* I830SDVOInit(pScrn, i, DVOB); */
i++; i++;
......
...@@ -104,7 +104,9 @@ static struct i2c_algo_bit_data matrox_i2c_algo_template = ...@@ -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, 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; int err;
b->minfo = minfo; b->minfo = minfo;
...@@ -114,6 +116,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* 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, snprintf(b->adapter.name, sizeof(b->adapter.name), name,
minfo->fbcon.node); minfo->fbcon.node);
i2c_set_adapdata(&b->adapter, b); i2c_set_adapdata(&b->adapter, b);
b->adapter.class = class;
b->adapter.algo_data = &b->bac; b->adapter.algo_data = &b->bac;
b->adapter.dev.parent = &ACCESS_FBINFO(pcidev)->dev; b->adapter.dev.parent = &ACCESS_FBINFO(pcidev)->dev;
b->bac = matrox_i2c_algo_template; b->bac = matrox_i2c_algo_template;
...@@ -159,22 +162,29 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) { ...@@ -159,22 +162,29 @@ static void* i2c_matroxfb_probe(struct matrox_fb_info* minfo) {
switch (ACCESS_FBINFO(chip)) { switch (ACCESS_FBINFO(chip)) {
case MGA_2064: case MGA_2064:
case MGA_2164: 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; break;
default: 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; break;
} }
if (err) if (err)
goto fail_ddc1; goto fail_ddc1;
if (ACCESS_FBINFO(devflags.dualhead)) { 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) { if (err == -ENODEV) {
printk(KERN_INFO "i2c-matroxfb: VGA->TV plug detected, DDC unavailable.\n"); printk(KERN_INFO "i2c-matroxfb: VGA->TV plug detected, DDC unavailable.\n");
} else if (err) } else if (err)
printk(KERN_INFO "i2c-matroxfb: Could not register secondary output i2c bus. Continuing anyway.\n"); printk(KERN_INFO "i2c-matroxfb: Could not register secondary output i2c bus. Continuing anyway.\n");
/* Register maven bus even on G450/G550 */ /* 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) if (err)
printk(KERN_INFO "i2c-matroxfb: Could not register Maven i2c bus. Continuing anyway.\n"); printk(KERN_INFO "i2c-matroxfb: Could not register Maven i2c bus. Continuing anyway.\n");
} }
......
...@@ -349,7 +349,7 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) ...@@ -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_HWMON (1<<0) /* lm_sensors, ... */
#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ #define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */
#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ #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_ANALOG (1<<4) /* camera with analog CCD */
#define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */ #define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */
#define I2C_CLASS_SOUND (1<<6) /* sound devices */ #define I2C_CLASS_SOUND (1<<6) /* sound devices */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册