aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885/cx23885-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx23885/cx23885-i2c.c')
-rw-r--r--drivers/media/video/cx23885/cx23885-i2c.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/drivers/media/video/cx23885/cx23885-i2c.c b/drivers/media/video/cx23885/cx23885-i2c.c
index 92fe0bd37c84..c6bb0a05bc1c 100644
--- a/drivers/media/video/cx23885/cx23885-i2c.c
+++ b/drivers/media/video/cx23885/cx23885-i2c.c
@@ -33,7 +33,7 @@ static unsigned int i2c_debug;
33module_param(i2c_debug, int, 0644); 33module_param(i2c_debug, int, 0644);
34MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); 34MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
35 35
36static unsigned int i2c_scan = 0; 36static unsigned int i2c_scan;
37module_param(i2c_scan, int, 0444); 37module_param(i2c_scan, int, 0444);
38MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); 38MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time");
39 39
@@ -87,10 +87,10 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
87 int retval, cnt; 87 int retval, cnt;
88 88
89 if (joined_rlen) 89 if (joined_rlen)
90 dprintk(1, "%s(msg->wlen=%d, nextmsg->rlen=%d)\n", __FUNCTION__, 90 dprintk(1, "%s(msg->wlen=%d, nextmsg->rlen=%d)\n", __func__,
91 msg->len, joined_rlen); 91 msg->len, joined_rlen);
92 else 92 else
93 dprintk(1, "%s(msg->len=%d)\n", __FUNCTION__, msg->len); 93 dprintk(1, "%s(msg->len=%d)\n", __func__, msg->len);
94 94
95 /* Deal with i2c probe functions with zero payload */ 95 /* Deal with i2c probe functions with zero payload */
96 if (msg->len == 0) { 96 if (msg->len == 0) {
@@ -101,7 +101,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
101 if (!i2c_slave_did_ack(i2c_adap)) 101 if (!i2c_slave_did_ack(i2c_adap))
102 return -EIO; 102 return -EIO;
103 103
104 dprintk(1, "%s() returns 0\n", __FUNCTION__); 104 dprintk(1, "%s() returns 0\n", __func__);
105 return 0; 105 return 0;
106 } 106 }
107 107
@@ -176,7 +176,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
176 176
177 177
178 if (i2c_debug && !joined) 178 if (i2c_debug && !joined)
179 dprintk(1, "%s(msg->len=%d)\n", __FUNCTION__, msg->len); 179 dprintk(1, "%s(msg->len=%d)\n", __func__, msg->len);
180 180
181 /* Deal with i2c probe functions with zero payload */ 181 /* Deal with i2c probe functions with zero payload */
182 if (msg->len == 0) { 182 if (msg->len == 0) {
@@ -188,7 +188,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
188 return -EIO; 188 return -EIO;
189 189
190 190
191 dprintk(1, "%s() returns 0\n", __FUNCTION__); 191 dprintk(1, "%s() returns 0\n", __func__);
192 return 0; 192 return 0;
193 } 193 }
194 194
@@ -238,11 +238,11 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap,
238 struct cx23885_dev *dev = bus->dev; 238 struct cx23885_dev *dev = bus->dev;
239 int i, retval = 0; 239 int i, retval = 0;
240 240
241 dprintk(1, "%s(num = %d)\n", __FUNCTION__, num); 241 dprintk(1, "%s(num = %d)\n", __func__, num);
242 242
243 for (i = 0 ; i < num; i++) { 243 for (i = 0 ; i < num; i++) {
244 dprintk(1, "%s(num = %d) addr = 0x%02x len = 0x%x\n", 244 dprintk(1, "%s(num = %d) addr = 0x%02x len = 0x%x\n",
245 __FUNCTION__, num, msgs[i].addr, msgs[i].len); 245 __func__, num, msgs[i].addr, msgs[i].len);
246 if (msgs[i].flags & I2C_M_RD) { 246 if (msgs[i].flags & I2C_M_RD) {
247 /* read */ 247 /* read */
248 retval = i2c_readbytes(i2c_adap, &msgs[i], 0); 248 retval = i2c_readbytes(i2c_adap, &msgs[i], 0);
@@ -353,6 +353,8 @@ static struct i2c_client cx23885_i2c_client_template = {
353}; 353};
354 354
355static char *i2c_devs[128] = { 355static char *i2c_devs[128] = {
356 [0x10 >> 1] = "tda10048",
357 [0x12 >> 1] = "dib7000pc",
356 [ 0x1c >> 1 ] = "lgdt3303", 358 [ 0x1c >> 1 ] = "lgdt3303",
357 [ 0x86 >> 1 ] = "tda9887", 359 [ 0x86 >> 1 ] = "tda9887",
358 [ 0x32 >> 1 ] = "cx24227", 360 [ 0x32 >> 1 ] = "cx24227",
@@ -360,7 +362,8 @@ static char *i2c_devs[128] = {
360 [ 0x84 >> 1 ] = "tda8295", 362 [ 0x84 >> 1 ] = "tda8295",
361 [ 0xa0 >> 1 ] = "eeprom", 363 [ 0xa0 >> 1 ] = "eeprom",
362 [ 0xc0 >> 1 ] = "tuner/mt2131/tda8275", 364 [ 0xc0 >> 1 ] = "tuner/mt2131/tda8275",
363 [ 0xc2 >> 1 ] = "tuner/mt2131/tda8275/xc5000", 365 [0xc2 >> 1] = "tuner/mt2131/tda8275/xc5000/xc3028",
366 [0xc8 >> 1] = "tuner/xc3028L",
364}; 367};
365 368
366static void do_i2c_scan(char *name, struct i2c_client *c) 369static void do_i2c_scan(char *name, struct i2c_client *c)
@@ -383,7 +386,7 @@ int cx23885_i2c_register(struct cx23885_i2c *bus)
383{ 386{
384 struct cx23885_dev *dev = bus->dev; 387 struct cx23885_dev *dev = bus->dev;
385 388
386 dprintk(1, "%s(bus = %d)\n", __FUNCTION__, bus->nr); 389 dprintk(1, "%s(bus = %d)\n", __func__, bus->nr);
387 390
388 memcpy(&bus->i2c_adap, &cx23885_i2c_adap_template, 391 memcpy(&bus->i2c_adap, &cx23885_i2c_adap_template,
389 sizeof(bus->i2c_adap)); 392 sizeof(bus->i2c_adap));
@@ -420,6 +423,29 @@ int cx23885_i2c_unregister(struct cx23885_i2c *bus)
420 return 0; 423 return 0;
421} 424}
422 425
426void cx23885_av_clk(struct cx23885_dev *dev, int enable)
427{
428 /* write 0 to bus 2 addr 0x144 via i2x_xfer() */
429 char buffer[3];
430 struct i2c_msg msg;
431 dprintk(1, "%s(enabled = %d)\n", __func__, enable);
432
433 /* Register 0x144 */
434 buffer[0] = 0x01;
435 buffer[1] = 0x44;
436 if (enable == 1)
437 buffer[2] = 0x05;
438 else
439 buffer[2] = 0x00;
440
441 msg.addr = 0x44;
442 msg.flags = I2C_M_TEN;
443 msg.len = 3;
444 msg.buf = buffer;
445
446 i2c_xfer(&dev->i2c_bus[2].i2c_adap, &msg, 1);
447}
448
423/* ----------------------------------------------------------------------- */ 449/* ----------------------------------------------------------------------- */
424 450
425/* 451/*