summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-04-18 18:39:11 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-18 18:39:11 -0300
commit8d8ffa5f1f9595b7109db94523ed92e050d32c3e (patch)
tree69b029e0baaf4cb9bd0d9288774199712d3a9297 /linux/drivers
parentc6b588f3025b68a7ca872fc58abe1bd2ff6198d8 (diff)
downloadmediapointer-dvb-s2-8d8ffa5f1f9595b7109db94523ed92e050d32c3e.tar.gz
mediapointer-dvb-s2-8d8ffa5f1f9595b7109db94523ed92e050d32c3e.tar.bz2
au0828: Cleanup
From: Steven Toth <stoth@hauppauge.com> Signed-off-by: Steven Toth <stoth@hauppauge.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/video/au0828/au0828-cards.c13
-rw-r--r--linux/drivers/media/video/au0828/au0828-core.c105
-rw-r--r--linux/drivers/media/video/au0828/au0828-dvb.c53
-rw-r--r--linux/drivers/media/video/au0828/au0828-i2c.c86
-rw-r--r--linux/drivers/media/video/au0828/au0828.h9
5 files changed, 110 insertions, 156 deletions
diff --git a/linux/drivers/media/video/au0828/au0828-cards.c b/linux/drivers/media/video/au0828/au0828-cards.c
index cbcc6f81f..eafdc552a 100644
--- a/linux/drivers/media/video/au0828/au0828-cards.c
+++ b/linux/drivers/media/video/au0828/au0828-cards.c
@@ -22,12 +22,6 @@
#include "au0828.h"
#include "au0828-cards.h"
-#define _dbg(level, fmt, arg...)\
- do {\
- if (debug >= level) \
- printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\
- } while (0)
-
struct au0828_board au0828_boards[] = {
[AU0828_BOARD_UNKNOWN] = {
.name = "Unknown board",
@@ -51,6 +45,8 @@ int au0828_tuner_callback(void *priv, int command, int arg)
{
struct au0828_dev *dev = priv;
+ dprintk(1, "%s()\n", __FUNCTION__);
+
switch(dev->board) {
case AU0828_BOARD_HAUPPAUGE_HVR850:
case AU0828_BOARD_HAUPPAUGE_HVR950Q:
@@ -97,9 +93,10 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
void au0828_card_setup(struct au0828_dev *dev)
{
-
static u8 eeprom[256];
+ dprintk(1, "%s()\n", __FUNCTION__);
+
if (dev->i2c_rc == 0) {
dev->i2c_client.addr = 0xa0 >> 1;
tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom));
@@ -121,6 +118,8 @@ void au0828_card_setup(struct au0828_dev *dev)
*/
void au0828_gpio_setup(struct au0828_dev *dev)
{
+ dprintk(1, "%s()\n", __FUNCTION__);
+
switch(dev->board) {
case AU0828_BOARD_HAUPPAUGE_HVR850:
case AU0828_BOARD_HAUPPAUGE_HVR950Q:
diff --git a/linux/drivers/media/video/au0828/au0828-core.c b/linux/drivers/media/video/au0828/au0828-core.c
index d4d8ac369..0878b8503 100644
--- a/linux/drivers/media/video/au0828/au0828-core.c
+++ b/linux/drivers/media/video/au0828/au0828-core.c
@@ -29,25 +29,23 @@
#include "au0828.h"
-static unsigned int debug;
+/*
+ * 1 = General debug messages
+ * 2 = USB handling
+ * 4 = I2C related
+ * 8 = Bridge related
+ */
+unsigned int debug = 0;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "enable debug messages");
-#define _err(fmt, arg...)\
- do {\
- printk(KERN_ERR DRIVER_NAME "/0: " fmt, ## arg);\
- } while (0)
-
-#define _info(fmt, arg...)\
- do {\
- printk(KERN_INFO DRIVER_NAME "/0: " fmt, ## arg);\
- } while (0)
+unsigned int usb_debug = 0;
+module_param(usb_debug, int, 0644);
+MODULE_PARM_DESC(usb_debug, "enable usb debug messages");
-#define _dbg(level, fmt, arg...)\
- do {\
- if (debug >= level) \
- printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\
- } while (0)
+unsigned int bridge_debug = 0;
+module_param(bridge_debug, int, 0644);
+MODULE_PARM_DESC(bridge_debug, "enable bridge debug messages");
#define _AU0828_BULKPIPE 0x03
#define _BULKPIPESIZE 0xffff
@@ -64,17 +62,13 @@ static int recv_control_msg(struct au0828_dev *dev, u16 request, u32 value,
u32 au0828_readreg(struct au0828_dev *dev, u16 reg)
{
recv_control_msg(dev, CMD_REQUEST_IN, 0, reg, dev->ctrlmsg, 1);
-#if 1
- _dbg(3,"%s(0x%x) = 0x%x\n", __FUNCTION__, reg, dev->ctrlmsg[0]);
-#endif
+ dprintk(8, "%s(0x%x) = 0x%x\n", __FUNCTION__, reg, dev->ctrlmsg[0]);
return dev->ctrlmsg[0];
}
u32 au0828_writereg(struct au0828_dev *dev, u16 reg, u32 val)
{
-#if 1
- _dbg(3,"%s(0x%x, 0x%x)\n", __FUNCTION__, reg, val);
-#endif
+ dprintk(8, "%s(0x%x, 0x%x)\n", __FUNCTION__, reg, val);
return send_control_msg(dev, CMD_REQUEST_OUT, val, reg, dev->ctrlmsg, 0);
}
@@ -83,7 +77,7 @@ static void cmd_msg_dump(struct au0828_dev *dev)
int i;
for (i = 0;i < sizeof(dev->ctrlmsg); i+=16)
- _dbg(1,"%s() %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x "
+ dprintk(2,"%s() %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x "
"%02x %02x %02x %02x %02x %02x\n",
__FUNCTION__,
dev->ctrlmsg[i+0], dev->ctrlmsg[i+1],
@@ -114,7 +108,7 @@ static int send_control_msg(struct au0828_dev *dev, u16 request, u32 value,
status = min(status, 0);
if (status < 0) {
- _err("%s() Failed sending control message, error %d.\n",
+ printk(KERN_ERR "%s() Failed sending control message, error %d.\n",
__FUNCTION__,
status);
}
@@ -144,13 +138,12 @@ static int recv_control_msg(struct au0828_dev *dev, u16 request, u32 value,
status = min(status, 0);
if (status < 0) {
- _err("%s() Failed receiving ctrl msg, error %d.\n",
+ printk(KERN_ERR "%s() Failed receiving control message, error %d.\n",
__FUNCTION__,
status);
}
else
- if (debug > 4)
- cmd_msg_dump(dev);
+ cmd_msg_dump(dev);
}
mutex_unlock(&dev->mutex);
return status;
@@ -158,28 +151,28 @@ static int recv_control_msg(struct au0828_dev *dev, u16 request, u32 value,
#if 0
static void dump_urb(struct urb *urb)
{
- _dbg(1,"urb :%p\n", urb);
- _dbg(1,"dev :%p\n", urb->dev);
- _dbg(1,"pipe :%08x\n", urb->pipe);
- _dbg(1,"status :%d\n", urb->status);
- _dbg(1,"transfer_flags :%08x\n", urb->transfer_flags);
- _dbg(1,"transfer_buffer :%p\n", urb->transfer_buffer);
- _dbg(1,"transfer_buffer_length:%d\n", urb->transfer_buffer_length);
- _dbg(1,"actual_length :%d\n", urb->actual_length);
- _dbg(1,"setup_packet :%p\n", urb->setup_packet);
- _dbg(1,"start_frame :%d\n", urb->start_frame);
- _dbg(1,"number_of_packets :%d\n", urb->number_of_packets);
- _dbg(1,"interval :%d\n", urb->interval);
- _dbg(1,"error_count :%d\n", urb->error_count);
- _dbg(1,"context :%p\n", urb->context);
- _dbg(1,"complete :%p\n", urb->complete);
+ dprintk(2, "urb :%p\n", urb);
+ dprintk(2, "dev :%p\n", urb->dev);
+ dprintk(2, "pipe :%08x\n", urb->pipe);
+ dprintk(2, "status :%d\n", urb->status);
+ dprintk(2, "transfer_flags :%08x\n", urb->transfer_flags);
+ dprintk(2, "transfer_buffer :%p\n", urb->transfer_buffer);
+ dprintk(2, "transfer_buffer_length:%d\n", urb->transfer_buffer_length);
+ dprintk(2, "actual_length :%d\n", urb->actual_length);
+ dprintk(2, "setup_packet :%p\n", urb->setup_packet);
+ dprintk(2, "start_frame :%d\n", urb->start_frame);
+ dprintk(2, "number_of_packets :%d\n", urb->number_of_packets);
+ dprintk(2, "interval :%d\n", urb->interval);
+ dprintk(2, "error_count :%d\n", urb->error_count);
+ dprintk(2, "context :%p\n", urb->context);
+ dprintk(2, "complete :%p\n", urb->complete);
}
#endif
static void au0828_usb_disconnect(struct usb_interface *interface)
{
struct au0828_dev *dev = usb_get_intfdata(interface);
- _dbg(1,"%s()\n", __FUNCTION__);
+ dprintk(1,"%s()\n", __FUNCTION__);
/* Digital TV */
au0828_dvb_unregister(dev);
@@ -209,7 +202,7 @@ static int au0828_usb_probe (struct usb_interface *interface,
if (ifnum != 0)
return -ENODEV;
- _dbg(1,"%s() vendor id 0x%x device id 0x%x ifnum:%d\n",
+ dprintk(1,"%s() vendor id 0x%x device id 0x%x ifnum:%d\n",
__FUNCTION__,
le16_to_cpu(usbdev->descriptor.idVendor),
le16_to_cpu(usbdev->descriptor.idProduct),
@@ -217,7 +210,7 @@ static int au0828_usb_probe (struct usb_interface *interface,
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL) {
- _err("Unable to allocate memory\n");
+ printk(KERN_ERR "%s() Unable to allocate memory\n", __FUNCTION__);
return -ENOMEM;
}
@@ -243,7 +236,7 @@ static int au0828_usb_probe (struct usb_interface *interface,
/* Digital TV */
au0828_dvb_register(dev);
- _info("Registered device AU0828 [%s]\n",
+ printk(KERN_INFO "Registered device AU0828 [%s]\n",
au0828_boards[dev->board].name == NULL ? "Unset" :
au0828_boards[dev->board].name);
@@ -264,11 +257,29 @@ static int __init au0828_init(void)
{
int ret;
- _info("au0828 driver loaded\n");
+ if(debug)
+ printk(KERN_INFO "%s() Debugging is enabled\n", __FUNCTION__);
+
+ if(usb_debug) {
+ printk(KERN_INFO "%s() USB Debugging is enabled\n", __FUNCTION__);
+ debug |= 2;
+ }
+
+ if(i2c_debug) {
+ printk(KERN_INFO "%s() I2C Debugging is enabled\n", __FUNCTION__);
+ debug |= 4;
+ }
+
+ if(bridge_debug) {
+ printk(KERN_INFO "%s() Bridge Debugging is enabled\n", __FUNCTION__);
+ debug |= 8;
+ }
+
+ printk(KERN_INFO "au0828 driver loaded\n");
ret = usb_register(&au0828_usb_driver);
if (ret)
- _err("usb_register failed, error = %d\n", ret);
+ printk(KERN_ERR "usb_register failed, error = %d\n", ret);
return ret;
}
diff --git a/linux/drivers/media/video/au0828/au0828-dvb.c b/linux/drivers/media/video/au0828/au0828-dvb.c
index bb9f3db5e..052bf09ea 100644
--- a/linux/drivers/media/video/au0828/au0828-dvb.c
+++ b/linux/drivers/media/video/au0828/au0828-dvb.c
@@ -27,19 +27,11 @@
#include "compat.h"
#include "au0828.h"
-
#include "au8522.h"
#include "xc5000.h"
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
-unsigned int dvb_debug = 1;
-
-#define _dbg(level, fmt, arg...)\
- do { if (dvb_debug >= level)\
- printk(KERN_DEBUG "%s/0: " fmt, DRIVER_NAME, ## arg);\
- } while (0)
-
static struct au8522_config hauppauge_hvr950q_config = {
.demod_address = 0x8e >> 1,
.status_mode = AU8522_DEMODLOCKING,
@@ -62,6 +54,8 @@ static void urb_completion(struct urb *purb)
struct au0828_dev *dev = purb->context;
int ptype = usb_pipetype(purb->pipe);
+ dprintk(2, "%s()\n", __FUNCTION__);
+
if (!dev)
return;
@@ -89,7 +83,7 @@ static int stop_urb_transfer(struct au0828_dev *dev)
{
int i;
- printk(KERN_INFO "%s()\n", __FUNCTION__);
+ dprintk(2, "%s()\n", __FUNCTION__);
/* FIXME: Do we need to free the transfer_buffers? */
for (i = 0; i < URB_COUNT; i++) {
@@ -110,15 +104,11 @@ static int start_urb_transfer(struct au0828_dev *dev)
{
struct urb *purb;
int i, ret = -ENOMEM;
- unsigned int pipe = usb_rcvbulkpipe(dev->usbdev, _AU0828_BULKPIPE);
- int pipesize = usb_maxpacket(dev->usbdev, pipe, usb_pipeout(pipe));
- int packets = _BULKPIPESIZE / pipesize;
- int transfer_buflen = packets * pipesize;
- printk(KERN_INFO "%s() transfer_buflen = %d\n", __FUNCTION__, transfer_buflen);
+ dprintk(2, "%s()\n", __FUNCTION__);
if (dev->urb_streaming) {
- printk("%s: iso xfer already running!\n", __FUNCTION__);
+ dprintk(2, "%s: iso xfer already running!\n", __FUNCTION__);
return 0;
}
@@ -172,17 +162,15 @@ static int au0828_dvb_start_feed(struct dvb_demux_feed *feed)
struct au0828_dvb *dvb = &dev->dvb;
int ret = 0;
- printk(KERN_INFO "%s() pid = 0x%x index = %d\n", __FUNCTION__, feed->pid, feed->index);
+ dprintk(1, "%s()\n", __FUNCTION__);
if (!demux->dmx.frontend)
return -EINVAL;
- printk(KERN_INFO "%s() Preparing, feeding = %d\n", __FUNCTION__, dvb->feeding);
if (dvb) {
mutex_lock(&dvb->lock);
if (dvb->feeding++ == 0) {
- printk(KERN_INFO "%s() Starting Transport DMA\n",
- __FUNCTION__);
+ /* Start transport */
au0828_write(dev, 0x608, 0x90);
au0828_write(dev, 0x609, 0x72);
au0828_write(dev, 0x60a, 0x71);
@@ -202,13 +190,12 @@ static int au0828_dvb_stop_feed(struct dvb_demux_feed *feed)
struct au0828_dvb *dvb = &dev->dvb;
int ret = 0;
- printk(KERN_INFO "%s() pid = 0x%x index = %d\n", __FUNCTION__, feed->pid, feed->index);
+ dprintk(1, "%s()\n", __FUNCTION__);
if (dvb) {
mutex_lock(&dvb->lock);
if (--dvb->feeding == 0) {
- printk(KERN_INFO "%s() Stopping Transport DMA\n",
- __FUNCTION__);
+ /* Stop transport */
au0828_write(dev, 0x608, 0x00);
au0828_write(dev, 0x609, 0x00);
au0828_write(dev, 0x60a, 0x00);
@@ -226,11 +213,13 @@ int dvb_register(struct au0828_dev *dev)
struct au0828_dvb *dvb = &dev->dvb;
int result;
+ dprintk(1, "%s()\n", __FUNCTION__);
+
/* register adapter */
result = dvb_register_adapter(&dvb->adapter, DRIVER_NAME, THIS_MODULE,
&dev->usbdev->dev, adapter_nr);
if (result < 0) {
- printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n",
+ printk(KERN_ERROR "%s: dvb_register_adapter failed (errno = %d)\n",
DRIVER_NAME, result);
goto fail_adapter;
}
@@ -246,7 +235,7 @@ int dvb_register(struct au0828_dev *dev)
result = dvb_register_frontend(dvb->adapter, dvb->frontend);
#endif
if (result < 0) {
- printk(KERN_WARNING "%s: dvb_register_frontend failed (errno = %d)\n",
+ printk(KERN_ERR "%s: dvb_register_frontend failed (errno = %d)\n",
DRIVER_NAME, result);
goto fail_frontend;
}
@@ -262,7 +251,7 @@ int dvb_register(struct au0828_dev *dev)
dvb->demux.stop_feed = au0828_dvb_stop_feed;
result = dvb_dmx_init(&dvb->demux);
if (result < 0) {
- printk(KERN_WARNING "%s: dvb_dmx_init failed (errno = %d)\n",
+ printk(KERN_ERR "%s: dvb_dmx_init failed (errno = %d)\n",
DRIVER_NAME, result);
goto fail_dmx;
}
@@ -276,7 +265,7 @@ int dvb_register(struct au0828_dev *dev)
result = dvb_dmxdev_init(&dvb->dmxdev, dvb->adapter);
#endif
if (result < 0) {
- printk(KERN_WARNING "%s: dvb_dmxdev_init failed (errno = %d)\n",
+ printk(KERN_ERR "%s: dvb_dmxdev_init failed (errno = %d)\n",
DRIVER_NAME, result);
goto fail_dmxdev;
}
@@ -284,7 +273,7 @@ int dvb_register(struct au0828_dev *dev)
dvb->fe_hw.source = DMX_FRONTEND_0;
result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw);
if (result < 0) {
- printk(KERN_WARNING "%s: add_frontend failed (DMX_FRONTEND_0, errno = %d)\n",
+ printk(KERN_ERR "%s: add_frontend failed (DMX_FRONTEND_0, errno = %d)\n",
DRIVER_NAME, result);
goto fail_fe_hw;
}
@@ -292,14 +281,14 @@ int dvb_register(struct au0828_dev *dev)
dvb->fe_mem.source = DMX_MEMORY_FE;
result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem);
if (result < 0) {
- printk(KERN_WARNING "%s: add_frontend failed (DMX_MEMORY_FE, errno = %d)\n",
+ printk(KERN_ERR "%s: add_frontend failed (DMX_MEMORY_FE, errno = %d)\n",
DRIVER_NAME, result);
goto fail_fe_mem;
}
result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw);
if (result < 0) {
- printk(KERN_WARNING "%s: connect_frontend failed (errno = %d)\n",
+ printk(KERN_ERR "%s: connect_frontend failed (errno = %d)\n",
DRIVER_NAME, result);
goto fail_fe_conn;
}
@@ -337,6 +326,8 @@ void au0828_dvb_unregister(struct au0828_dev *dev)
{
struct au0828_dvb *dvb = &dev->dvb;
+ dprintk(1, "%s()\n", __FUNCTION__);
+
if(dvb->frontend == NULL)
return;
@@ -363,6 +354,8 @@ int au0828_dvb_register(struct au0828_dev *dev)
struct au0828_dvb *dvb = &dev->dvb;
int ret;
+ dprintk(1, "%s()\n", __FUNCTION__);
+
/* init frontend */
switch (dev->board) {
case AU0828_BOARD_HAUPPAUGE_HVR850:
@@ -383,7 +376,7 @@ int au0828_dvb_register(struct au0828_dev *dev)
break;
}
if (NULL == dvb->frontend) {
- printk("Frontend initialization failed\n");
+ printk(KERN_ERR "%s() Frontend initialization failed\n", __FUNCTION__);
return -1;
}
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:
- */
diff --git a/linux/drivers/media/video/au0828/au0828.h b/linux/drivers/media/video/au0828/au0828.h
index 606327944..3e0dbda0c 100644
--- a/linux/drivers/media/video/au0828/au0828.h
+++ b/linux/drivers/media/video/au0828/au0828.h
@@ -104,6 +104,9 @@ struct au0828_buff {
/* au0828-core.c */
extern u32 au0828_read(struct au0828_dev *dev, u16 reg);
extern u32 au0828_write(struct au0828_dev *dev, u16 reg, u32 val);
+extern unsigned int debug;
+extern unsigned int usb_debug;
+extern unsigned int bridge_debug;
/* ----------------------------------------------------------- */
/* au0828-cards.c */
@@ -120,9 +123,15 @@ extern int au0828_i2c_register(struct au0828_dev *dev);
extern int au0828_i2c_unregister(struct au0828_dev *dev);
extern void au0828_call_i2c_clients(struct au0828_dev *dev,
unsigned int cmd, void *arg);
+extern unsigned int i2c_debug;
/* ----------------------------------------------------------- */
/* au0828-dvb.c */
extern int au0828_dvb_register(struct au0828_dev *dev);
extern void au0828_dvb_unregister(struct au0828_dev *dev);
+#define dprintk(level, fmt, arg...)\
+ do { if (debug & level)\
+ printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\
+ } while (0)
+