diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-03-28 07:29:00 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:46 -0400 |
commit | 859f0277a6c3ba59b0a5a1eb183f8f6ce661a95d (patch) | |
tree | 47d9d7ee5b1cb7899db12c881d27cd373254e4f8 /drivers/media/video/bt8xx/bttv-i2c.c | |
parent | e4129a9ccea54e8f4fbc408476120059809a4627 (diff) |
V4L/DVB (11278): bttv: convert to v4l2_subdev since i2c autoprobing will disappear.
Since i2c autoprobing will disappear bttv needs to be converted to use
v4l2_subdev instead.
Without autoprobing the autoload module option has become obsolete. A warning
is generated if it is set, but it is otherwise ignored.
Since the bttv card definitions are of questionable value a new option was
introduced to allow the user to control which audio module is selected:
msp3400, tda7432 or tvaudio (or none at all).
By default bttv will use the card definitions and fallback on tvaudio as the
last resort.
If no audio device was found a warning is printed.
The saa6588 RDS device is now also explicitly probed since it is no longer
possible to autoprobe it. A new saa6588 module option was added to override
the card definition since I suspect more cards have this device than one
would guess from the card definitions.
Note that the probe addresses of the i2c modules are hardcoded in this
driver. Once all v4l drivers are converted to v4l2_subdev this will be
cleaned up. Such data belongs in an i2c driver header.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-i2c.c')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-i2c.c | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/drivers/media/video/bt8xx/bttv-i2c.c b/drivers/media/video/bt8xx/bttv-i2c.c index 9b66c5b09321..a99d92fac3dc 100644 --- a/drivers/media/video/bt8xx/bttv-i2c.c +++ b/drivers/media/video/bt8xx/bttv-i2c.c | |||
@@ -36,8 +36,6 @@ | |||
36 | #include <linux/jiffies.h> | 36 | #include <linux/jiffies.h> |
37 | #include <asm/io.h> | 37 | #include <asm/io.h> |
38 | 38 | ||
39 | static int attach_inform(struct i2c_client *client); | ||
40 | |||
41 | static int i2c_debug; | 39 | static int i2c_debug; |
42 | static int i2c_hw; | 40 | static int i2c_hw; |
43 | static int i2c_scan; | 41 | static int i2c_scan; |
@@ -266,51 +264,6 @@ static const struct i2c_algorithm bttv_algo = { | |||
266 | /* ----------------------------------------------------------------------- */ | 264 | /* ----------------------------------------------------------------------- */ |
267 | /* I2C functions - common stuff */ | 265 | /* I2C functions - common stuff */ |
268 | 266 | ||
269 | static int attach_inform(struct i2c_client *client) | ||
270 | { | ||
271 | struct v4l2_device *v4l2_dev = i2c_get_adapdata(client->adapter); | ||
272 | struct bttv *btv = to_bttv(v4l2_dev); | ||
273 | int addr=ADDR_UNSET; | ||
274 | |||
275 | |||
276 | if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr) | ||
277 | addr = bttv_tvcards[btv->c.type].tuner_addr; | ||
278 | |||
279 | |||
280 | if (bttv_debug) | ||
281 | printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", | ||
282 | btv->c.nr, client->driver->driver.name, client->addr, | ||
283 | client->name); | ||
284 | if (!client->driver->command) | ||
285 | return 0; | ||
286 | |||
287 | if (client->driver->id == I2C_DRIVERID_MSP3400) | ||
288 | btv->i2c_msp34xx_client = client; | ||
289 | if (client->driver->id == I2C_DRIVERID_TVAUDIO) | ||
290 | btv->i2c_tvaudio_client = client; | ||
291 | if (btv->tuner_type != TUNER_ABSENT) { | ||
292 | struct tuner_setup tun_setup; | ||
293 | |||
294 | if (addr == ADDR_UNSET || addr == client->addr) { | ||
295 | tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV | T_RADIO; | ||
296 | tun_setup.type = btv->tuner_type; | ||
297 | tun_setup.addr = addr; | ||
298 | bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
299 | } | ||
300 | |||
301 | } | ||
302 | |||
303 | return 0; | ||
304 | } | ||
305 | |||
306 | void bttv_call_i2c_clients(struct bttv *btv, unsigned int cmd, void *arg) | ||
307 | { | ||
308 | if (0 != btv->i2c_rc) | ||
309 | return; | ||
310 | i2c_clients_command(&btv->c.i2c_adap, cmd, arg); | ||
311 | } | ||
312 | |||
313 | |||
314 | /* read I2C */ | 267 | /* read I2C */ |
315 | int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for) | 268 | int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for) |
316 | { | 269 | { |
@@ -417,8 +370,6 @@ int __devinit init_bttv_i2c(struct bttv *btv) | |||
417 | btv->c.i2c_adap.algo_data = &btv->i2c_algo; | 370 | btv->c.i2c_adap.algo_data = &btv->i2c_algo; |
418 | } | 371 | } |
419 | btv->c.i2c_adap.owner = THIS_MODULE; | 372 | btv->c.i2c_adap.owner = THIS_MODULE; |
420 | btv->c.i2c_adap.class = I2C_CLASS_TV_ANALOG; | ||
421 | btv->c.i2c_adap.client_register = attach_inform; | ||
422 | 373 | ||
423 | btv->c.i2c_adap.dev.parent = &btv->c.pci->dev; | 374 | btv->c.i2c_adap.dev.parent = &btv->c.pci->dev; |
424 | snprintf(btv->c.i2c_adap.name, sizeof(btv->c.i2c_adap.name), | 375 | snprintf(btv->c.i2c_adap.name, sizeof(btv->c.i2c_adap.name), |
@@ -428,10 +379,6 @@ int __devinit init_bttv_i2c(struct bttv *btv) | |||
428 | i2c_set_adapdata(&btv->c.i2c_adap, &btv->c.v4l2_dev); | 379 | i2c_set_adapdata(&btv->c.i2c_adap, &btv->c.v4l2_dev); |
429 | btv->i2c_client.adapter = &btv->c.i2c_adap; | 380 | btv->i2c_client.adapter = &btv->c.i2c_adap; |
430 | 381 | ||
431 | if (bttv_tvcards[btv->c.type].no_video) | ||
432 | btv->c.i2c_adap.class &= ~I2C_CLASS_TV_ANALOG; | ||
433 | if (bttv_tvcards[btv->c.type].has_dvb) | ||
434 | btv->c.i2c_adap.class |= I2C_CLASS_TV_DIGITAL; | ||
435 | 382 | ||
436 | if (btv->use_i2c_hw) { | 383 | if (btv->use_i2c_hw) { |
437 | btv->i2c_rc = i2c_add_adapter(&btv->c.i2c_adap); | 384 | btv->i2c_rc = i2c_add_adapter(&btv->c.i2c_adap); |