aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2010-04-25 10:30:41 -0400
committerJonathan Corbet <corbet@lwn.net>2010-04-27 15:01:45 -0400
commit4da62e6c6e056d709e5dc04ac7c5e81692cf924f (patch)
tree915fc051ab8ff1efdaf5b4ca03f5354a478d798b /drivers/video/via
parentc774c13dd2826eb91ab6396fd8501df2fc2d83b3 (diff)
viafb: Only establish i2c busses on ports that always had them
...otherwise it seems we run into conflicts with shadowy other users which don't expect to see i2c taking control of ports it never used to do anything with. Reported-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/video/via')
-rw-r--r--drivers/video/via/via_i2c.c19
-rw-r--r--drivers/video/via/via_i2c.h1
2 files changed, 14 insertions, 6 deletions
diff --git a/drivers/video/via/via_i2c.c b/drivers/video/via/via_i2c.c
index fe5535cf1480..b5253e3099f8 100644
--- a/drivers/video/via/via_i2c.c
+++ b/drivers/video/via/via_i2c.c
@@ -170,13 +170,18 @@ static int create_i2c_bus(struct i2c_adapter *adapter,
170 return i2c_bit_add_bus(adapter); 170 return i2c_bit_add_bus(adapter);
171} 171}
172 172
173/*
174 * By default, we only activate busses on ports 2c and 31 to avoid
175 * conflicts with other possible users; that default can be changed
176 * below.
177 */
173static struct via_i2c_adap_cfg adap_configs[] = { 178static struct via_i2c_adap_cfg adap_configs[] = {
174 [VIA_I2C_ADAP_26] = { VIA_I2C_I2C, VIASR, 0x26 }, 179 [VIA_I2C_ADAP_26] = { VIA_I2C_I2C, VIASR, 0x26, 0 },
175 [VIA_I2C_ADAP_31] = { VIA_I2C_I2C, VIASR, 0x31 }, 180 [VIA_I2C_ADAP_31] = { VIA_I2C_I2C, VIASR, 0x31, 1 },
176 [VIA_I2C_ADAP_25] = { VIA_I2C_GPIO, VIASR, 0x25 }, 181 [VIA_I2C_ADAP_25] = { VIA_I2C_GPIO, VIASR, 0x25, 0 },
177 [VIA_I2C_ADAP_2C] = { VIA_I2C_GPIO, VIASR, 0x2c }, 182 [VIA_I2C_ADAP_2C] = { VIA_I2C_GPIO, VIASR, 0x2c, 1 },
178 [VIA_I2C_ADAP_3D] = { VIA_I2C_GPIO, VIASR, 0x3d }, 183 [VIA_I2C_ADAP_3D] = { VIA_I2C_GPIO, VIASR, 0x3d, 0 },
179 { 0, 0, 0 } 184 { 0, 0, 0, 0 }
180}; 185};
181 186
182int viafb_create_i2c_busses(struct viafb_par *viapar) 187int viafb_create_i2c_busses(struct viafb_par *viapar)
@@ -189,6 +194,8 @@ int viafb_create_i2c_busses(struct viafb_par *viapar)
189 194
190 if (adap_cfg->type == 0) 195 if (adap_cfg->type == 0)
191 break; 196 break;
197 if (!adap_cfg->is_active)
198 continue;
192 199
193 ret = create_i2c_bus(&i2c_stuff->adapter, 200 ret = create_i2c_bus(&i2c_stuff->adapter,
194 &i2c_stuff->algo, adap_cfg, 201 &i2c_stuff->algo, adap_cfg,
diff --git a/drivers/video/via/via_i2c.h b/drivers/video/via/via_i2c.h
index 00ed97886842..73d682fcf269 100644
--- a/drivers/video/via/via_i2c.h
+++ b/drivers/video/via/via_i2c.h
@@ -35,6 +35,7 @@ struct via_i2c_adap_cfg {
35 enum via_i2c_type type; 35 enum via_i2c_type type;
36 u_int16_t io_port; 36 u_int16_t io_port;
37 u_int8_t ioport_index; 37 u_int8_t ioport_index;
38 u8 is_active;
38}; 39};
39 40
40struct via_i2c_stuff { 41struct via_i2c_stuff {