aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bttv-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bttv-i2c.c')
-rw-r--r--drivers/media/video/bttv-i2c.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c
index e684df37eb0e..06c5965b5616 100644
--- a/drivers/media/video/bttv-i2c.c
+++ b/drivers/media/video/bttv-i2c.c
@@ -5,7 +5,7 @@
5 bttv - Bt848 frame grabber driver 5 bttv - Bt848 frame grabber driver
6 6
7 Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) 7 Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
8 & Marcus Metzler (mocm@thp.uni-koeln.de) 8 & Marcus Metzler (mocm@thp.uni-koeln.de)
9 (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org> 9 (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
10 10
11 This program is free software; you can redistribute it and/or modify 11 This program is free software; you can redistribute it and/or modify
@@ -237,7 +237,7 @@ bttv_i2c_readbytes(struct bttv *btv, const struct i2c_msg *msg, int last)
237 err: 237 err:
238 if (i2c_debug) 238 if (i2c_debug)
239 printk(" ERR: %d\n",retval); 239 printk(" ERR: %d\n",retval);
240 return retval; 240 return retval;
241} 241}
242 242
243static int bttv_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) 243static int bttv_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num)
@@ -290,7 +290,7 @@ static struct i2c_adapter bttv_i2c_adap_hw_template = {
290 290
291static int attach_inform(struct i2c_client *client) 291static int attach_inform(struct i2c_client *client)
292{ 292{
293 struct bttv *btv = i2c_get_adapdata(client->adapter); 293 struct bttv *btv = i2c_get_adapdata(client->adapter);
294 294
295 if (bttv_debug) 295 if (bttv_debug)
296 printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", 296 printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n",
@@ -300,9 +300,9 @@ static int attach_inform(struct i2c_client *client)
300 return 0; 300 return 0;
301 301
302 if (btv->tuner_type != UNSET) { 302 if (btv->tuner_type != UNSET) {
303 struct tuner_setup tun_setup; 303 struct tuner_setup tun_setup;
304 304
305 tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; 305 tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
306 tun_setup.type = btv->tuner_type; 306 tun_setup.type = btv->tuner_type;
307 tun_setup.addr = ADDR_UNSET; 307 tun_setup.addr = ADDR_UNSET;
308 308
@@ -312,7 +312,7 @@ static int attach_inform(struct i2c_client *client)
312 if (btv->pinnacle_id != UNSET) 312 if (btv->pinnacle_id != UNSET)
313 client->driver->command(client,AUDC_CONFIG_PINNACLE, 313 client->driver->command(client,AUDC_CONFIG_PINNACLE,
314 &btv->pinnacle_id); 314 &btv->pinnacle_id);
315 return 0; 315 return 0;
316} 316}
317 317
318void bttv_call_i2c_clients(struct bttv *btv, unsigned int cmd, void *arg) 318void bttv_call_i2c_clients(struct bttv *btv, unsigned int cmd, void *arg)
@@ -330,43 +330,43 @@ static struct i2c_client bttv_i2c_client_template = {
330/* read I2C */ 330/* read I2C */
331int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for) 331int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for)
332{ 332{
333 unsigned char buffer = 0; 333 unsigned char buffer = 0;
334 334
335 if (0 != btv->i2c_rc) 335 if (0 != btv->i2c_rc)
336 return -1; 336 return -1;
337 if (bttv_verbose && NULL != probe_for) 337 if (bttv_verbose && NULL != probe_for)
338 printk(KERN_INFO "bttv%d: i2c: checking for %s @ 0x%02x... ", 338 printk(KERN_INFO "bttv%d: i2c: checking for %s @ 0x%02x... ",
339 btv->c.nr,probe_for,addr); 339 btv->c.nr,probe_for,addr);
340 btv->i2c_client.addr = addr >> 1; 340 btv->i2c_client.addr = addr >> 1;
341 if (1 != i2c_master_recv(&btv->i2c_client, &buffer, 1)) { 341 if (1 != i2c_master_recv(&btv->i2c_client, &buffer, 1)) {
342 if (NULL != probe_for) { 342 if (NULL != probe_for) {
343 if (bttv_verbose) 343 if (bttv_verbose)
344 printk("not found\n"); 344 printk("not found\n");
345 } else 345 } else
346 printk(KERN_WARNING "bttv%d: i2c read 0x%x: error\n", 346 printk(KERN_WARNING "bttv%d: i2c read 0x%x: error\n",
347 btv->c.nr,addr); 347 btv->c.nr,addr);
348 return -1; 348 return -1;
349 } 349 }
350 if (bttv_verbose && NULL != probe_for) 350 if (bttv_verbose && NULL != probe_for)
351 printk("found\n"); 351 printk("found\n");
352 return buffer; 352 return buffer;
353} 353}
354 354
355/* write I2C */ 355/* write I2C */
356int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1, 356int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1,
357 unsigned char b2, int both) 357 unsigned char b2, int both)
358{ 358{
359 unsigned char buffer[2]; 359 unsigned char buffer[2];
360 int bytes = both ? 2 : 1; 360 int bytes = both ? 2 : 1;
361 361
362 if (0 != btv->i2c_rc) 362 if (0 != btv->i2c_rc)
363 return -1; 363 return -1;
364 btv->i2c_client.addr = addr >> 1; 364 btv->i2c_client.addr = addr >> 1;
365 buffer[0] = b1; 365 buffer[0] = b1;
366 buffer[1] = b2; 366 buffer[1] = b2;
367 if (bytes != i2c_master_send(&btv->i2c_client, buffer, bytes)) 367 if (bytes != i2c_master_send(&btv->i2c_client, buffer, bytes))
368 return -1; 368 return -1;
369 return 0; 369 return 0;
370} 370}
371 371
372/* read EEPROM content */ 372/* read EEPROM content */
@@ -431,8 +431,8 @@ int __devinit init_bttv_i2c(struct bttv *btv)
431 "bt%d #%d [%s]", btv->id, btv->c.nr, 431 "bt%d #%d [%s]", btv->id, btv->c.nr,
432 btv->use_i2c_hw ? "hw" : "sw"); 432 btv->use_i2c_hw ? "hw" : "sw");
433 433
434 i2c_set_adapdata(&btv->c.i2c_adap, btv); 434 i2c_set_adapdata(&btv->c.i2c_adap, btv);
435 btv->i2c_client.adapter = &btv->c.i2c_adap; 435 btv->i2c_client.adapter = &btv->c.i2c_adap;
436 436
437#ifdef I2C_CLASS_TV_ANALOG 437#ifdef I2C_CLASS_TV_ANALOG
438 if (bttv_tvcards[btv->c.type].no_video) 438 if (bttv_tvcards[btv->c.type].no_video)