aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx231xx/cx231xx-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx231xx/cx231xx-i2c.c')
-rw-r--r--drivers/media/video/cx231xx/cx231xx-i2c.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-i2c.c b/drivers/media/video/cx231xx/cx231xx-i2c.c
index c250ad27e1d..1af87579ab4 100644
--- a/drivers/media/video/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/video/cx231xx/cx231xx-i2c.c
@@ -2,8 +2,8 @@
2 cx231xx-i2c.c - driver for Conexant Cx23100/101/102 USB video capture devices 2 cx231xx-i2c.c - driver for Conexant Cx23100/101/102 USB video capture devices
3 3
4 Copyright (C) 2008 <srinivasa.deevi at conexant dot com> 4 Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
5 Based on em28xx driver 5 Based on em28xx driver
6 Based on Cx23885 driver 6 Based on Cx23885 driver
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
@@ -42,8 +42,8 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
42#define dprintk1(lvl, fmt, args...) \ 42#define dprintk1(lvl, fmt, args...) \
43do { \ 43do { \
44 if (i2c_debug >= lvl) { \ 44 if (i2c_debug >= lvl) { \
45 printk(fmt, ##args); \ 45 printk(fmt, ##args); \
46 } \ 46 } \
47} while (0) 47} while (0)
48 48
49#define dprintk2(lvl, fmt, args...) \ 49#define dprintk2(lvl, fmt, args...) \
@@ -78,8 +78,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap,
78 78
79 if (size == 2) { /* register write sub addr */ 79 if (size == 2) { /* register write sub addr */
80 80
81 /* Just writing sub address will cause problem to XC5000 81 /* Just writing sub address will cause problem to XC5000
82 So ignore the request */ 82 So ignore the request */
83 return 0; 83 return 0;
84 84
85 } else if (size == 4) { /* register write with sub addr */ 85 } else if (size == 4) { /* register write with sub addr */
@@ -92,7 +92,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap,
92 switch (saddr) { 92 switch (saddr) {
93 case 0x0000: /* start tuner calibration mode */ 93 case 0x0000: /* start tuner calibration mode */
94 need_gpio = 1; 94 need_gpio = 1;
95 dev->xc_fw_load_done = 1; /* FW Loading is done */ 95 /* FW Loading is done */
96 dev->xc_fw_load_done = 1;
96 break; 97 break;
97 case 0x000D: /* Set signal source */ 98 case 0x000D: /* Set signal source */
98 case 0x0001: /* Set TV standard - Video */ 99 case 0x0001: /* Set TV standard - Video */
@@ -108,8 +109,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap,
108 109
109 if (need_gpio) { 110 if (need_gpio) {
110 dprintk1(1, 111 dprintk1(1,
111 " GPIO W R I T E : addr 0x%x, len %d, saddr 0x%x\n", 112 "GPIO WRITE: addr 0x%x, len %d, saddr 0x%x\n",
112 msg->addr, msg->len, saddr); 113 msg->addr, msg->len, saddr);
113 114
114 return dev->cx231xx_gpio_i2c_write(dev, 115 return dev->cx231xx_gpio_i2c_write(dev,
115 msg->addr, 116 msg->addr,
@@ -196,8 +197,8 @@ static int cx231xx_i2c_recv_bytes(struct i2c_adapter *i2c_adap,
196 switch (saddr) { 197 switch (saddr) {
197 case 0x0009: /* BUSY check */ 198 case 0x0009: /* BUSY check */
198 dprintk1(1, 199 dprintk1(1,
199 " GPIO R E A D : Special case BUSY check \n"); 200 "GPIO R E A D: Special case BUSY check \n");
200 /* Try to read BUSY register, just set it to zero */ 201 /*Try read BUSY register, just set it to zero*/
201 msg->buf[0] = 0; 202 msg->buf[0] = 0;
202 if (msg->len == 2) 203 if (msg->len == 2)
203 msg->buf[1] = 0; 204 msg->buf[1] = 0;
@@ -209,12 +210,14 @@ static int cx231xx_i2c_recv_bytes(struct i2c_adapter *i2c_adap,
209 } 210 }
210 211
211 if (need_gpio) { 212 if (need_gpio) {
212 /* this is a special case to handle Xceive tuner clock stretch issue 213 /* this is a special case to handle Xceive tuner
213 with gpio based I2C interface */ 214 clock stretch issue with gpio based I2C */
215
214 dprintk1(1, 216 dprintk1(1,
215 " GPIO R E A D : addr 0x%x, len %d, saddr 0x%x\n", 217 "GPIO R E A D: addr 0x%x, len %d, saddr 0x%x\n",
216 msg->addr, msg->len, 218 msg->addr, msg->len,
217 msg->buf[0] << 8 | msg->buf[1]); 219 msg->buf[0] << 8 | msg->buf[1]);
220
218 status = 221 status =
219 dev->cx231xx_gpio_i2c_write(dev, msg->addr, 222 dev->cx231xx_gpio_i2c_write(dev, msg->addr,
220 msg->buf, 223 msg->buf,
@@ -281,8 +284,8 @@ static int cx231xx_i2c_recv_bytes_with_saddr(struct i2c_adapter *i2c_adap,
281 if ((msg2->len < 16)) { 284 if ((msg2->len < 16)) {
282 285
283 dprintk1(1, 286 dprintk1(1,
284 " i2c_read : addr 0x%x, len %d, subaddr 0x%x, leng %d\n", 287 "i2c_read: addr 0x%x, len %d, saddr 0x%x, len %d\n",
285 msg2->addr, msg2->len, saddr, msg1->len); 288 msg2->addr, msg2->len, saddr, msg1->len);
286 289
287 switch (saddr) { 290 switch (saddr) {
288 case 0x0008: /* read FW load status */ 291 case 0x0008: /* read FW load status */
@@ -368,7 +371,8 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
368 dprintk2(2, "%s %s addr=%x len=%d:", 371 dprintk2(2, "%s %s addr=%x len=%d:",
369 (msgs[i].flags & I2C_M_RD) ? "read" : "write", 372 (msgs[i].flags & I2C_M_RD) ? "read" : "write",
370 i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); 373 i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len);
371 if (!msgs[i].len) { /* no len: check only for device presence */ 374 if (!msgs[i].len) {
375 /* no len: check only for device presence */
372 rc = cx231xx_i2c_check_for_device(i2c_adap, &msgs[i]); 376 rc = cx231xx_i2c_check_for_device(i2c_adap, &msgs[i]);
373 if (rc < 0) { 377 if (rc < 0) {
374 dprintk2(2, " no device\n"); 378 dprintk2(2, " no device\n");
@@ -409,7 +413,7 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
409 } 413 }
410 414
411 return num; 415 return num;
412 err: 416err:
413 dprintk2(2, " ERROR: %i\n", rc); 417 dprintk2(2, " ERROR: %i\n", rc);
414 return rc; 418 return rc;
415} 419}