summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/au0828/au0828-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/au0828/au0828-i2c.c')
-rw-r--r--linux/drivers/media/video/au0828/au0828-i2c.c86
1 files changed, 14 insertions, 72 deletions
diff --git a/linux/drivers/media/video/au0828/au0828-i2c.c b/linux/drivers/media/video/au0828/au0828-i2c.c
index a051f7129..783f86dd9 100644
--- a/linux/drivers/media/video/au0828/au0828-i2c.c
+++ b/linux/drivers/media/video/au0828/au0828-i2c.c
@@ -30,19 +30,14 @@
#include <media/v4l2-common.h>
-static unsigned int i2c_debug;
-module_param(i2c_debug, int, 0644);
+unsigned int i2c_debug = 0;
+module_param(i2c_debug, int, 0444);
MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
-static unsigned int i2c_scan = 0;
+unsigned int i2c_scan = 0;
module_param(i2c_scan, int, 0444);
MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time");
-#define dprintk(level, fmt, arg...)\
- do { if (i2c_debug >= level)\
- printk(KERN_DEBUG "%s/0: " fmt, DRIVER_NAME, ## arg);\
- } while (0)
-
#define I2C_WAIT_DELAY 512
#define I2C_WAIT_RETRY 64
@@ -147,7 +142,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
int i, strobe = 0;
struct au0828_dev *dev = i2c_adap->algo_data;
- dprintk(1, "%s()\n", __FUNCTION__);
+ dprintk(4, "%s()\n", __FUNCTION__);
au0828_write(dev, REG_2FF, 0x01);
au0828_write(dev, REG_202, 0x07);
@@ -155,13 +150,11 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
/* Hardware needs 8 bit addresses */
au0828_write(dev, REG_203, msg->addr << 1);
- if (i2c_debug)
- dprintk(1, "SEND: %02x\n", msg->addr);
+ dprintk(4, "SEND: %02x\n", msg->addr);
for (i=0; i < msg->len;) {
- if (i2c_debug)
- dprintk(1, " %02x\n", msg->buf[i]);
+ dprintk(4, " %02x\n", msg->buf[i]);
au0828_write(dev, REG_205, msg->buf[i]);
@@ -192,8 +185,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
if (!i2c_wait_done(i2c_adap))
return -EIO;
- if (i2c_debug)
- dprintk(1, "\n");
+ dprintk(4, "\n");
return msg->len;
}
@@ -205,7 +197,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
struct au0828_dev *dev = i2c_adap->algo_data;
int i;
- dprintk(1, "%s()\n", __FUNCTION__);
+ dprintk(4, "%s()\n", __FUNCTION__);
au0828_write(dev, REG_2FF, 0x01);
au0828_write(dev, REG_202, 0x07);
@@ -213,8 +205,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
/* Hardware needs 8 bit addresses */
au0828_write(dev, REG_203, msg->addr << 1);
- if (i2c_debug)
- dprintk(1, " RECV:\n");
+ dprintk(4, " RECV:\n");
/* Deal with i2c_scan */
if (msg->len == 0) {
@@ -238,14 +229,12 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
msg->buf[i-1] = au0828_read(dev, REG_209) & 0xff;
- if (i2c_debug)
- dprintk(1, " %02x\n", msg->buf[i-1]);
+ dprintk(4, " %02x\n", msg->buf[i-1]);
}
if (!i2c_wait_done(i2c_adap))
return -EIO;
- if (i2c_debug)
- dprintk(1, "\n");
+ dprintk(4, "\n");
return msg->len;
}
@@ -255,10 +244,10 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap,
{
int i, retval = 0;
- dprintk(1, "%s(num = %d)\n", __FUNCTION__, num);
+ dprintk(4, "%s(num = %d)\n", __FUNCTION__, num);
for (i = 0 ; i < num; i++) {
- dprintk(1, "%s(num = %d) addr = 0x%02x len = 0x%x\n",
+ dprintk(4, "%s(num = %d) addr = 0x%02x len = 0x%x\n",
__FUNCTION__, num, msgs[i].addr, msgs[i].len);
if (msgs[i].flags & I2C_M_RD) {
/* read */
@@ -346,44 +335,6 @@ static char *i2c_devs[128] = {
[ 0xc2 >> 1 ] = "tuner/xc5000",
};
-#if 0
-static void dump_eeprom(struct i2c_adapter *a)
-{
- unsigned char buf[16];
- int i, ret;
- u8 b0[] = { 0 };
-
- struct i2c_msg msg [] = {
- { .addr = 0xa0 >> 1, .flags = 0,
- .buf = b0, .len = 1 },
- { .addr = 0xa0 >> 1, .flags = I2C_M_RD,
- .buf = buf, .len = sizeof(buf) } };
-
- dprintk(1, "%s()\n", __FUNCTION__);
-
- memset(&buf[0], 0, sizeof(buf));
- ret = i2c_transfer(a, msg, 2);
- if (ret != 2)
- printk("%s() ERR ret = %d\n", __FUNCTION__, ret);
-
- for(i=0;i<sizeof(buf);i+=16) {
- printk("%04x: %02x %02x %02x %02x %02x %02x %02x %02x "
- "%02x %02x %02x %02x %02x %02x %02x %02x\n"
- , i
- , buf[i+0], buf[i+1]
- , buf[i+2], buf[i+3]
- , buf[i+4], buf[i+5]
- , buf[i+6], buf[i+7]
- , buf[i+8], buf[i+9]
- , buf[i+10], buf[i+11]
- , buf[i+12], buf[i+13]
- , buf[i+14], buf[i+15]
- );
- }
-
-
-}
-#endif
static void do_i2c_scan(char *name, struct i2c_client *c)
{
unsigned char buf;
@@ -429,9 +380,7 @@ int au0828_i2c_register(struct au0828_dev *dev)
do_i2c_scan(DRIVER_NAME, &dev->i2c_client);
} else
printk("%s: i2c bus register FAILED\n", DRIVER_NAME);
-#if 0
- dump_eeprom(&dev->i2c_adap);
-#endif
+
return dev->i2c_rc;
}
@@ -441,10 +390,3 @@ int au0828_i2c_unregister(struct au0828_dev *dev)
return 0;
}
-/* ----------------------------------------------------------------------- */
-
-/*
- * Local variables:
- * c-basic-offset: 8
- * End:
- */