diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/au0828/au0828-cards.c | 13 | ||||
-rw-r--r-- | drivers/media/video/au0828/au0828-core.c | 71 | ||||
-rw-r--r-- | drivers/media/video/au0828/au0828-dvb.c | 53 | ||||
-rw-r--r-- | drivers/media/video/au0828/au0828-i2c.c | 45 | ||||
-rw-r--r-- | drivers/media/video/au0828/au0828.h | 9 |
5 files changed, 95 insertions, 96 deletions
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c index cbcc6f81f460..eafdc552a9fa 100644 --- a/drivers/media/video/au0828/au0828-cards.c +++ b/drivers/media/video/au0828/au0828-cards.c | |||
@@ -22,12 +22,6 @@ | |||
22 | #include "au0828.h" | 22 | #include "au0828.h" |
23 | #include "au0828-cards.h" | 23 | #include "au0828-cards.h" |
24 | 24 | ||
25 | #define _dbg(level, fmt, arg...)\ | ||
26 | do {\ | ||
27 | if (debug >= level) \ | ||
28 | printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\ | ||
29 | } while (0) | ||
30 | |||
31 | struct au0828_board au0828_boards[] = { | 25 | struct au0828_board au0828_boards[] = { |
32 | [AU0828_BOARD_UNKNOWN] = { | 26 | [AU0828_BOARD_UNKNOWN] = { |
33 | .name = "Unknown board", | 27 | .name = "Unknown board", |
@@ -51,6 +45,8 @@ int au0828_tuner_callback(void *priv, int command, int arg) | |||
51 | { | 45 | { |
52 | struct au0828_dev *dev = priv; | 46 | struct au0828_dev *dev = priv; |
53 | 47 | ||
48 | dprintk(1, "%s()\n", __FUNCTION__); | ||
49 | |||
54 | switch(dev->board) { | 50 | switch(dev->board) { |
55 | case AU0828_BOARD_HAUPPAUGE_HVR850: | 51 | case AU0828_BOARD_HAUPPAUGE_HVR850: |
56 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: | 52 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: |
@@ -97,9 +93,10 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) | |||
97 | 93 | ||
98 | void au0828_card_setup(struct au0828_dev *dev) | 94 | void au0828_card_setup(struct au0828_dev *dev) |
99 | { | 95 | { |
100 | |||
101 | static u8 eeprom[256]; | 96 | static u8 eeprom[256]; |
102 | 97 | ||
98 | dprintk(1, "%s()\n", __FUNCTION__); | ||
99 | |||
103 | if (dev->i2c_rc == 0) { | 100 | if (dev->i2c_rc == 0) { |
104 | dev->i2c_client.addr = 0xa0 >> 1; | 101 | dev->i2c_client.addr = 0xa0 >> 1; |
105 | tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom)); | 102 | tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom)); |
@@ -121,6 +118,8 @@ void au0828_card_setup(struct au0828_dev *dev) | |||
121 | */ | 118 | */ |
122 | void au0828_gpio_setup(struct au0828_dev *dev) | 119 | void au0828_gpio_setup(struct au0828_dev *dev) |
123 | { | 120 | { |
121 | dprintk(1, "%s()\n", __FUNCTION__); | ||
122 | |||
124 | switch(dev->board) { | 123 | switch(dev->board) { |
125 | case AU0828_BOARD_HAUPPAUGE_HVR850: | 124 | case AU0828_BOARD_HAUPPAUGE_HVR850: |
126 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: | 125 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: |
diff --git a/drivers/media/video/au0828/au0828-core.c b/drivers/media/video/au0828/au0828-core.c index a3410fc8f5f9..76801d135f2a 100644 --- a/drivers/media/video/au0828/au0828-core.c +++ b/drivers/media/video/au0828/au0828-core.c | |||
@@ -26,25 +26,23 @@ | |||
26 | 26 | ||
27 | #include "au0828.h" | 27 | #include "au0828.h" |
28 | 28 | ||
29 | static unsigned int debug; | 29 | /* |
30 | * 1 = General debug messages | ||
31 | * 2 = USB handling | ||
32 | * 4 = I2C related | ||
33 | * 8 = Bridge related | ||
34 | */ | ||
35 | unsigned int debug = 0; | ||
30 | module_param(debug, int, 0644); | 36 | module_param(debug, int, 0644); |
31 | MODULE_PARM_DESC(debug, "enable debug messages"); | 37 | MODULE_PARM_DESC(debug, "enable debug messages"); |
32 | 38 | ||
33 | #define _err(fmt, arg...)\ | 39 | unsigned int usb_debug = 0; |
34 | do {\ | 40 | module_param(usb_debug, int, 0644); |
35 | printk(KERN_ERR DRIVER_NAME "/0: " fmt, ## arg);\ | 41 | MODULE_PARM_DESC(usb_debug, "enable usb debug messages"); |
36 | } while (0) | ||
37 | |||
38 | #define _info(fmt, arg...)\ | ||
39 | do {\ | ||
40 | printk(KERN_INFO DRIVER_NAME "/0: " fmt, ## arg);\ | ||
41 | } while (0) | ||
42 | 42 | ||
43 | #define _dbg(level, fmt, arg...)\ | 43 | unsigned int bridge_debug = 0; |
44 | do {\ | 44 | module_param(bridge_debug, int, 0644); |
45 | if (debug >= level) \ | 45 | MODULE_PARM_DESC(bridge_debug, "enable bridge debug messages"); |
46 | printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\ | ||
47 | } while (0) | ||
48 | 46 | ||
49 | #define _AU0828_BULKPIPE 0x03 | 47 | #define _AU0828_BULKPIPE 0x03 |
50 | #define _BULKPIPESIZE 0xffff | 48 | #define _BULKPIPESIZE 0xffff |
@@ -61,13 +59,13 @@ static int recv_control_msg(struct au0828_dev *dev, u16 request, u32 value, | |||
61 | u32 au0828_readreg(struct au0828_dev *dev, u16 reg) | 59 | u32 au0828_readreg(struct au0828_dev *dev, u16 reg) |
62 | { | 60 | { |
63 | recv_control_msg(dev, CMD_REQUEST_IN, 0, reg, dev->ctrlmsg, 1); | 61 | recv_control_msg(dev, CMD_REQUEST_IN, 0, reg, dev->ctrlmsg, 1); |
64 | _dbg(3,"%s(0x%x) = 0x%x\n", __FUNCTION__, reg, dev->ctrlmsg[0]); | 62 | dprintk(8, "%s(0x%x) = 0x%x\n", __FUNCTION__, reg, dev->ctrlmsg[0]); |
65 | return dev->ctrlmsg[0]; | 63 | return dev->ctrlmsg[0]; |
66 | } | 64 | } |
67 | 65 | ||
68 | u32 au0828_writereg(struct au0828_dev *dev, u16 reg, u32 val) | 66 | u32 au0828_writereg(struct au0828_dev *dev, u16 reg, u32 val) |
69 | { | 67 | { |
70 | _dbg(3,"%s(0x%x, 0x%x)\n", __FUNCTION__, reg, val); | 68 | dprintk(8, "%s(0x%x, 0x%x)\n", __FUNCTION__, reg, val); |
71 | return send_control_msg(dev, CMD_REQUEST_OUT, val, reg, dev->ctrlmsg, 0); | 69 | return send_control_msg(dev, CMD_REQUEST_OUT, val, reg, dev->ctrlmsg, 0); |
72 | } | 70 | } |
73 | 71 | ||
@@ -76,7 +74,7 @@ static void cmd_msg_dump(struct au0828_dev *dev) | |||
76 | int i; | 74 | int i; |
77 | 75 | ||
78 | for (i = 0;i < sizeof(dev->ctrlmsg); i+=16) | 76 | for (i = 0;i < sizeof(dev->ctrlmsg); i+=16) |
79 | _dbg(1,"%s() %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x " | 77 | dprintk(2,"%s() %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x " |
80 | "%02x %02x %02x %02x %02x %02x\n", | 78 | "%02x %02x %02x %02x %02x %02x\n", |
81 | __FUNCTION__, | 79 | __FUNCTION__, |
82 | dev->ctrlmsg[i+0], dev->ctrlmsg[i+1], | 80 | dev->ctrlmsg[i+0], dev->ctrlmsg[i+1], |
@@ -107,7 +105,7 @@ static int send_control_msg(struct au0828_dev *dev, u16 request, u32 value, | |||
107 | status = min(status, 0); | 105 | status = min(status, 0); |
108 | 106 | ||
109 | if (status < 0) { | 107 | if (status < 0) { |
110 | _err("%s() Failed sending control message, error %d.\n", | 108 | printk(KERN_ERR "%s() Failed sending control message, error %d.\n", |
111 | __FUNCTION__, | 109 | __FUNCTION__, |
112 | status); | 110 | status); |
113 | } | 111 | } |
@@ -137,13 +135,12 @@ static int recv_control_msg(struct au0828_dev *dev, u16 request, u32 value, | |||
137 | status = min(status, 0); | 135 | status = min(status, 0); |
138 | 136 | ||
139 | if (status < 0) { | 137 | if (status < 0) { |
140 | _err("%s() Failed receiving ctrl msg, error %d.\n", | 138 | printk(KERN_ERR "%s() Failed receiving control message, error %d.\n", |
141 | __FUNCTION__, | 139 | __FUNCTION__, |
142 | status); | 140 | status); |
143 | } | 141 | } |
144 | else | 142 | else |
145 | if (debug > 4) | 143 | cmd_msg_dump(dev); |
146 | cmd_msg_dump(dev); | ||
147 | } | 144 | } |
148 | mutex_unlock(&dev->mutex); | 145 | mutex_unlock(&dev->mutex); |
149 | return status; | 146 | return status; |
@@ -152,7 +149,7 @@ static void au0828_usb_disconnect(struct usb_interface *interface) | |||
152 | { | 149 | { |
153 | struct au0828_dev *dev = usb_get_intfdata(interface); | 150 | struct au0828_dev *dev = usb_get_intfdata(interface); |
154 | 151 | ||
155 | _dbg(1,"%s()\n", __FUNCTION__); | 152 | dprintk(1,"%s()\n", __FUNCTION__); |
156 | 153 | ||
157 | /* Digital TV */ | 154 | /* Digital TV */ |
158 | au0828_dvb_unregister(dev); | 155 | au0828_dvb_unregister(dev); |
@@ -182,7 +179,7 @@ static int au0828_usb_probe (struct usb_interface *interface, | |||
182 | if (ifnum != 0) | 179 | if (ifnum != 0) |
183 | return -ENODEV; | 180 | return -ENODEV; |
184 | 181 | ||
185 | _dbg(1,"%s() vendor id 0x%x device id 0x%x ifnum:%d\n", | 182 | dprintk(1,"%s() vendor id 0x%x device id 0x%x ifnum:%d\n", |
186 | __FUNCTION__, | 183 | __FUNCTION__, |
187 | le16_to_cpu(usbdev->descriptor.idVendor), | 184 | le16_to_cpu(usbdev->descriptor.idVendor), |
188 | le16_to_cpu(usbdev->descriptor.idProduct), | 185 | le16_to_cpu(usbdev->descriptor.idProduct), |
@@ -190,7 +187,7 @@ static int au0828_usb_probe (struct usb_interface *interface, | |||
190 | 187 | ||
191 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 188 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
192 | if (dev == NULL) { | 189 | if (dev == NULL) { |
193 | _err("Unable to allocate memory\n"); | 190 | printk(KERN_ERR "%s() Unable to allocate memory\n", __FUNCTION__); |
194 | return -ENOMEM; | 191 | return -ENOMEM; |
195 | } | 192 | } |
196 | 193 | ||
@@ -216,7 +213,7 @@ static int au0828_usb_probe (struct usb_interface *interface, | |||
216 | /* Digital TV */ | 213 | /* Digital TV */ |
217 | au0828_dvb_register(dev); | 214 | au0828_dvb_register(dev); |
218 | 215 | ||
219 | _info("Registered device AU0828 [%s]\n", | 216 | printk(KERN_INFO "Registered device AU0828 [%s]\n", |
220 | au0828_boards[dev->board].name == NULL ? "Unset" : | 217 | au0828_boards[dev->board].name == NULL ? "Unset" : |
221 | au0828_boards[dev->board].name); | 218 | au0828_boards[dev->board].name); |
222 | 219 | ||
@@ -234,11 +231,29 @@ static int __init au0828_init(void) | |||
234 | { | 231 | { |
235 | int ret; | 232 | int ret; |
236 | 233 | ||
237 | _info("au0828 driver loaded\n"); | 234 | if(debug) |
235 | printk(KERN_INFO "%s() Debugging is enabled\n", __FUNCTION__); | ||
236 | |||
237 | if(usb_debug) { | ||
238 | printk(KERN_INFO "%s() USB Debugging is enabled\n", __FUNCTION__); | ||
239 | debug |= 2; | ||
240 | } | ||
241 | |||
242 | if(i2c_debug) { | ||
243 | printk(KERN_INFO "%s() I2C Debugging is enabled\n", __FUNCTION__); | ||
244 | debug |= 4; | ||
245 | } | ||
246 | |||
247 | if(bridge_debug) { | ||
248 | printk(KERN_INFO "%s() Bridge Debugging is enabled\n", __FUNCTION__); | ||
249 | debug |= 8; | ||
250 | } | ||
251 | |||
252 | printk(KERN_INFO "au0828 driver loaded\n"); | ||
238 | 253 | ||
239 | ret = usb_register(&au0828_usb_driver); | 254 | ret = usb_register(&au0828_usb_driver); |
240 | if (ret) | 255 | if (ret) |
241 | _err("usb_register failed, error = %d\n", ret); | 256 | printk(KERN_ERR "usb_register failed, error = %d\n", ret); |
242 | 257 | ||
243 | return ret; | 258 | return ret; |
244 | } | 259 | } |
diff --git a/drivers/media/video/au0828/au0828-dvb.c b/drivers/media/video/au0828/au0828-dvb.c index ecc08a8e31ca..453fb3efa3e0 100644 --- a/drivers/media/video/au0828/au0828-dvb.c +++ b/drivers/media/video/au0828/au0828-dvb.c | |||
@@ -26,19 +26,11 @@ | |||
26 | #include <media/v4l2-common.h> | 26 | #include <media/v4l2-common.h> |
27 | 27 | ||
28 | #include "au0828.h" | 28 | #include "au0828.h" |
29 | |||
30 | #include "au8522.h" | 29 | #include "au8522.h" |
31 | #include "xc5000.h" | 30 | #include "xc5000.h" |
32 | 31 | ||
33 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 32 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
34 | 33 | ||
35 | unsigned int dvb_debug = 1; | ||
36 | |||
37 | #define _dbg(level, fmt, arg...)\ | ||
38 | do { if (dvb_debug >= level)\ | ||
39 | printk(KERN_DEBUG "%s/0: " fmt, DRIVER_NAME, ## arg);\ | ||
40 | } while (0) | ||
41 | |||
42 | static struct au8522_config hauppauge_hvr950q_config = { | 34 | static struct au8522_config hauppauge_hvr950q_config = { |
43 | .demod_address = 0x8e >> 1, | 35 | .demod_address = 0x8e >> 1, |
44 | .status_mode = AU8522_DEMODLOCKING, | 36 | .status_mode = AU8522_DEMODLOCKING, |
@@ -57,6 +49,8 @@ static void urb_completion(struct urb *purb) | |||
57 | struct au0828_dev *dev = purb->context; | 49 | struct au0828_dev *dev = purb->context; |
58 | int ptype = usb_pipetype(purb->pipe); | 50 | int ptype = usb_pipetype(purb->pipe); |
59 | 51 | ||
52 | dprintk(2, "%s()\n", __FUNCTION__); | ||
53 | |||
60 | if (!dev) | 54 | if (!dev) |
61 | return; | 55 | return; |
62 | 56 | ||
@@ -84,7 +78,7 @@ static int stop_urb_transfer(struct au0828_dev *dev) | |||
84 | { | 78 | { |
85 | int i; | 79 | int i; |
86 | 80 | ||
87 | printk(KERN_INFO "%s()\n", __FUNCTION__); | 81 | dprintk(2, "%s()\n", __FUNCTION__); |
88 | 82 | ||
89 | /* FIXME: Do we need to free the transfer_buffers? */ | 83 | /* FIXME: Do we need to free the transfer_buffers? */ |
90 | for (i = 0; i < URB_COUNT; i++) { | 84 | for (i = 0; i < URB_COUNT; i++) { |
@@ -105,15 +99,11 @@ static int start_urb_transfer(struct au0828_dev *dev) | |||
105 | { | 99 | { |
106 | struct urb *purb; | 100 | struct urb *purb; |
107 | int i, ret = -ENOMEM; | 101 | int i, ret = -ENOMEM; |
108 | unsigned int pipe = usb_rcvbulkpipe(dev->usbdev, _AU0828_BULKPIPE); | ||
109 | int pipesize = usb_maxpacket(dev->usbdev, pipe, usb_pipeout(pipe)); | ||
110 | int packets = _BULKPIPESIZE / pipesize; | ||
111 | int transfer_buflen = packets * pipesize; | ||
112 | 102 | ||
113 | printk(KERN_INFO "%s() transfer_buflen = %d\n", __FUNCTION__, transfer_buflen); | 103 | dprintk(2, "%s()\n", __FUNCTION__); |
114 | 104 | ||
115 | if (dev->urb_streaming) { | 105 | if (dev->urb_streaming) { |
116 | printk("%s: iso xfer already running!\n", __FUNCTION__); | 106 | dprintk(2, "%s: iso xfer already running!\n", __FUNCTION__); |
117 | return 0; | 107 | return 0; |
118 | } | 108 | } |
119 | 109 | ||
@@ -167,17 +157,15 @@ static int au0828_dvb_start_feed(struct dvb_demux_feed *feed) | |||
167 | struct au0828_dvb *dvb = &dev->dvb; | 157 | struct au0828_dvb *dvb = &dev->dvb; |
168 | int ret = 0; | 158 | int ret = 0; |
169 | 159 | ||
170 | printk(KERN_INFO "%s() pid = 0x%x index = %d\n", __FUNCTION__, feed->pid, feed->index); | 160 | dprintk(1, "%s()\n", __FUNCTION__); |
171 | 161 | ||
172 | if (!demux->dmx.frontend) | 162 | if (!demux->dmx.frontend) |
173 | return -EINVAL; | 163 | return -EINVAL; |
174 | 164 | ||
175 | printk(KERN_INFO "%s() Preparing, feeding = %d\n", __FUNCTION__, dvb->feeding); | ||
176 | if (dvb) { | 165 | if (dvb) { |
177 | mutex_lock(&dvb->lock); | 166 | mutex_lock(&dvb->lock); |
178 | if (dvb->feeding++ == 0) { | 167 | if (dvb->feeding++ == 0) { |
179 | printk(KERN_INFO "%s() Starting Transport DMA\n", | 168 | /* Start transport */ |
180 | __FUNCTION__); | ||
181 | au0828_write(dev, 0x608, 0x90); | 169 | au0828_write(dev, 0x608, 0x90); |
182 | au0828_write(dev, 0x609, 0x72); | 170 | au0828_write(dev, 0x609, 0x72); |
183 | au0828_write(dev, 0x60a, 0x71); | 171 | au0828_write(dev, 0x60a, 0x71); |
@@ -197,13 +185,12 @@ static int au0828_dvb_stop_feed(struct dvb_demux_feed *feed) | |||
197 | struct au0828_dvb *dvb = &dev->dvb; | 185 | struct au0828_dvb *dvb = &dev->dvb; |
198 | int ret = 0; | 186 | int ret = 0; |
199 | 187 | ||
200 | printk(KERN_INFO "%s() pid = 0x%x index = %d\n", __FUNCTION__, feed->pid, feed->index); | 188 | dprintk(1, "%s()\n", __FUNCTION__); |
201 | 189 | ||
202 | if (dvb) { | 190 | if (dvb) { |
203 | mutex_lock(&dvb->lock); | 191 | mutex_lock(&dvb->lock); |
204 | if (--dvb->feeding == 0) { | 192 | if (--dvb->feeding == 0) { |
205 | printk(KERN_INFO "%s() Stopping Transport DMA\n", | 193 | /* Stop transport */ |
206 | __FUNCTION__); | ||
207 | au0828_write(dev, 0x608, 0x00); | 194 | au0828_write(dev, 0x608, 0x00); |
208 | au0828_write(dev, 0x609, 0x00); | 195 | au0828_write(dev, 0x609, 0x00); |
209 | au0828_write(dev, 0x60a, 0x00); | 196 | au0828_write(dev, 0x60a, 0x00); |
@@ -221,11 +208,13 @@ int dvb_register(struct au0828_dev *dev) | |||
221 | struct au0828_dvb *dvb = &dev->dvb; | 208 | struct au0828_dvb *dvb = &dev->dvb; |
222 | int result; | 209 | int result; |
223 | 210 | ||
211 | dprintk(1, "%s()\n", __FUNCTION__); | ||
212 | |||
224 | /* register adapter */ | 213 | /* register adapter */ |
225 | result = dvb_register_adapter(&dvb->adapter, DRIVER_NAME, THIS_MODULE, | 214 | result = dvb_register_adapter(&dvb->adapter, DRIVER_NAME, THIS_MODULE, |
226 | &dev->usbdev->dev, adapter_nr); | 215 | &dev->usbdev->dev, adapter_nr); |
227 | if (result < 0) { | 216 | if (result < 0) { |
228 | printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n", | 217 | printk(KERN_ERROR "%s: dvb_register_adapter failed (errno = %d)\n", |
229 | DRIVER_NAME, result); | 218 | DRIVER_NAME, result); |
230 | goto fail_adapter; | 219 | goto fail_adapter; |
231 | } | 220 | } |
@@ -234,7 +223,7 @@ int dvb_register(struct au0828_dev *dev) | |||
234 | /* register frontend */ | 223 | /* register frontend */ |
235 | result = dvb_register_frontend(&dvb->adapter, dvb->frontend); | 224 | result = dvb_register_frontend(&dvb->adapter, dvb->frontend); |
236 | if (result < 0) { | 225 | if (result < 0) { |
237 | printk(KERN_WARNING "%s: dvb_register_frontend failed (errno = %d)\n", | 226 | printk(KERN_ERR "%s: dvb_register_frontend failed (errno = %d)\n", |
238 | DRIVER_NAME, result); | 227 | DRIVER_NAME, result); |
239 | goto fail_frontend; | 228 | goto fail_frontend; |
240 | } | 229 | } |
@@ -250,7 +239,7 @@ int dvb_register(struct au0828_dev *dev) | |||
250 | dvb->demux.stop_feed = au0828_dvb_stop_feed; | 239 | dvb->demux.stop_feed = au0828_dvb_stop_feed; |
251 | result = dvb_dmx_init(&dvb->demux); | 240 | result = dvb_dmx_init(&dvb->demux); |
252 | if (result < 0) { | 241 | if (result < 0) { |
253 | printk(KERN_WARNING "%s: dvb_dmx_init failed (errno = %d)\n", | 242 | printk(KERN_ERR "%s: dvb_dmx_init failed (errno = %d)\n", |
254 | DRIVER_NAME, result); | 243 | DRIVER_NAME, result); |
255 | goto fail_dmx; | 244 | goto fail_dmx; |
256 | } | 245 | } |
@@ -260,7 +249,7 @@ int dvb_register(struct au0828_dev *dev) | |||
260 | dvb->dmxdev.capabilities = 0; | 249 | dvb->dmxdev.capabilities = 0; |
261 | result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter); | 250 | result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter); |
262 | if (result < 0) { | 251 | if (result < 0) { |
263 | printk(KERN_WARNING "%s: dvb_dmxdev_init failed (errno = %d)\n", | 252 | printk(KERN_ERR "%s: dvb_dmxdev_init failed (errno = %d)\n", |
264 | DRIVER_NAME, result); | 253 | DRIVER_NAME, result); |
265 | goto fail_dmxdev; | 254 | goto fail_dmxdev; |
266 | } | 255 | } |
@@ -268,7 +257,7 @@ int dvb_register(struct au0828_dev *dev) | |||
268 | dvb->fe_hw.source = DMX_FRONTEND_0; | 257 | dvb->fe_hw.source = DMX_FRONTEND_0; |
269 | result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw); | 258 | result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw); |
270 | if (result < 0) { | 259 | if (result < 0) { |
271 | printk(KERN_WARNING "%s: add_frontend failed (DMX_FRONTEND_0, errno = %d)\n", | 260 | printk(KERN_ERR "%s: add_frontend failed (DMX_FRONTEND_0, errno = %d)\n", |
272 | DRIVER_NAME, result); | 261 | DRIVER_NAME, result); |
273 | goto fail_fe_hw; | 262 | goto fail_fe_hw; |
274 | } | 263 | } |
@@ -276,14 +265,14 @@ int dvb_register(struct au0828_dev *dev) | |||
276 | dvb->fe_mem.source = DMX_MEMORY_FE; | 265 | dvb->fe_mem.source = DMX_MEMORY_FE; |
277 | result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem); | 266 | result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem); |
278 | if (result < 0) { | 267 | if (result < 0) { |
279 | printk(KERN_WARNING "%s: add_frontend failed (DMX_MEMORY_FE, errno = %d)\n", | 268 | printk(KERN_ERR "%s: add_frontend failed (DMX_MEMORY_FE, errno = %d)\n", |
280 | DRIVER_NAME, result); | 269 | DRIVER_NAME, result); |
281 | goto fail_fe_mem; | 270 | goto fail_fe_mem; |
282 | } | 271 | } |
283 | 272 | ||
284 | result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw); | 273 | result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw); |
285 | if (result < 0) { | 274 | if (result < 0) { |
286 | printk(KERN_WARNING "%s: connect_frontend failed (errno = %d)\n", | 275 | printk(KERN_ERR "%s: connect_frontend failed (errno = %d)\n", |
287 | DRIVER_NAME, result); | 276 | DRIVER_NAME, result); |
288 | goto fail_fe_conn; | 277 | goto fail_fe_conn; |
289 | } | 278 | } |
@@ -313,6 +302,8 @@ void au0828_dvb_unregister(struct au0828_dev *dev) | |||
313 | { | 302 | { |
314 | struct au0828_dvb *dvb = &dev->dvb; | 303 | struct au0828_dvb *dvb = &dev->dvb; |
315 | 304 | ||
305 | dprintk(1, "%s()\n", __FUNCTION__); | ||
306 | |||
316 | if(dvb->frontend == NULL) | 307 | if(dvb->frontend == NULL) |
317 | return; | 308 | return; |
318 | 309 | ||
@@ -335,6 +326,8 @@ int au0828_dvb_register(struct au0828_dev *dev) | |||
335 | struct au0828_dvb *dvb = &dev->dvb; | 326 | struct au0828_dvb *dvb = &dev->dvb; |
336 | int ret; | 327 | int ret; |
337 | 328 | ||
329 | dprintk(1, "%s()\n", __FUNCTION__); | ||
330 | |||
338 | /* init frontend */ | 331 | /* init frontend */ |
339 | switch (dev->board) { | 332 | switch (dev->board) { |
340 | case AU0828_BOARD_HAUPPAUGE_HVR850: | 333 | case AU0828_BOARD_HAUPPAUGE_HVR850: |
@@ -355,7 +348,7 @@ int au0828_dvb_register(struct au0828_dev *dev) | |||
355 | break; | 348 | break; |
356 | } | 349 | } |
357 | if (NULL == dvb->frontend) { | 350 | if (NULL == dvb->frontend) { |
358 | printk("Frontend initialization failed\n"); | 351 | printk(KERN_ERR "%s() Frontend initialization failed\n", __FUNCTION__); |
359 | return -1; | 352 | return -1; |
360 | } | 353 | } |
361 | 354 | ||
diff --git a/drivers/media/video/au0828/au0828-i2c.c b/drivers/media/video/au0828/au0828-i2c.c index 3e7482481152..4545a9cbaa6d 100644 --- a/drivers/media/video/au0828/au0828-i2c.c +++ b/drivers/media/video/au0828/au0828-i2c.c | |||
@@ -29,19 +29,14 @@ | |||
29 | 29 | ||
30 | #include <media/v4l2-common.h> | 30 | #include <media/v4l2-common.h> |
31 | 31 | ||
32 | static unsigned int i2c_debug; | 32 | unsigned int i2c_debug = 0; |
33 | module_param(i2c_debug, int, 0644); | 33 | module_param(i2c_debug, int, 0444); |
34 | MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); | 34 | MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); |
35 | 35 | ||
36 | static unsigned int i2c_scan = 0; | 36 | unsigned int i2c_scan = 0; |
37 | module_param(i2c_scan, int, 0444); | 37 | module_param(i2c_scan, int, 0444); |
38 | MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); | 38 | MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); |
39 | 39 | ||
40 | #define dprintk(level, fmt, arg...)\ | ||
41 | do { if (i2c_debug >= level)\ | ||
42 | printk(KERN_DEBUG "%s/0: " fmt, DRIVER_NAME, ## arg);\ | ||
43 | } while (0) | ||
44 | |||
45 | #define I2C_WAIT_DELAY 512 | 40 | #define I2C_WAIT_DELAY 512 |
46 | #define I2C_WAIT_RETRY 64 | 41 | #define I2C_WAIT_RETRY 64 |
47 | 42 | ||
@@ -146,7 +141,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, | |||
146 | int i, strobe = 0; | 141 | int i, strobe = 0; |
147 | struct au0828_dev *dev = i2c_adap->algo_data; | 142 | struct au0828_dev *dev = i2c_adap->algo_data; |
148 | 143 | ||
149 | dprintk(1, "%s()\n", __FUNCTION__); | 144 | dprintk(4, "%s()\n", __FUNCTION__); |
150 | 145 | ||
151 | au0828_write(dev, REG_2FF, 0x01); | 146 | au0828_write(dev, REG_2FF, 0x01); |
152 | au0828_write(dev, REG_202, 0x07); | 147 | au0828_write(dev, REG_202, 0x07); |
@@ -154,13 +149,11 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, | |||
154 | /* Hardware needs 8 bit addresses */ | 149 | /* Hardware needs 8 bit addresses */ |
155 | au0828_write(dev, REG_203, msg->addr << 1); | 150 | au0828_write(dev, REG_203, msg->addr << 1); |
156 | 151 | ||
157 | if (i2c_debug) | 152 | dprintk(4, "SEND: %02x\n", msg->addr); |
158 | dprintk(1, "SEND: %02x\n", msg->addr); | ||
159 | 153 | ||
160 | for (i=0; i < msg->len;) { | 154 | for (i=0; i < msg->len;) { |
161 | 155 | ||
162 | if (i2c_debug) | 156 | dprintk(4, " %02x\n", msg->buf[i]); |
163 | dprintk(1, " %02x\n", msg->buf[i]); | ||
164 | 157 | ||
165 | au0828_write(dev, REG_205, msg->buf[i]); | 158 | au0828_write(dev, REG_205, msg->buf[i]); |
166 | 159 | ||
@@ -187,8 +180,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, | |||
187 | if (!i2c_wait_done(i2c_adap)) | 180 | if (!i2c_wait_done(i2c_adap)) |
188 | return -EIO; | 181 | return -EIO; |
189 | 182 | ||
190 | if (i2c_debug) | 183 | dprintk(4, "\n"); |
191 | dprintk(1, "\n"); | ||
192 | 184 | ||
193 | return msg->len; | 185 | return msg->len; |
194 | } | 186 | } |
@@ -200,7 +192,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, | |||
200 | struct au0828_dev *dev = i2c_adap->algo_data; | 192 | struct au0828_dev *dev = i2c_adap->algo_data; |
201 | int i; | 193 | int i; |
202 | 194 | ||
203 | dprintk(1, "%s()\n", __FUNCTION__); | 195 | dprintk(4, "%s()\n", __FUNCTION__); |
204 | 196 | ||
205 | au0828_write(dev, REG_2FF, 0x01); | 197 | au0828_write(dev, REG_2FF, 0x01); |
206 | au0828_write(dev, REG_202, 0x07); | 198 | au0828_write(dev, REG_202, 0x07); |
@@ -208,8 +200,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, | |||
208 | /* Hardware needs 8 bit addresses */ | 200 | /* Hardware needs 8 bit addresses */ |
209 | au0828_write(dev, REG_203, msg->addr << 1); | 201 | au0828_write(dev, REG_203, msg->addr << 1); |
210 | 202 | ||
211 | if (i2c_debug) | 203 | dprintk(4, " RECV:\n"); |
212 | dprintk(1, " RECV:\n"); | ||
213 | 204 | ||
214 | /* Deal with i2c_scan */ | 205 | /* Deal with i2c_scan */ |
215 | if (msg->len == 0) { | 206 | if (msg->len == 0) { |
@@ -233,14 +224,12 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, | |||
233 | 224 | ||
234 | msg->buf[i-1] = au0828_read(dev, REG_209) & 0xff; | 225 | msg->buf[i-1] = au0828_read(dev, REG_209) & 0xff; |
235 | 226 | ||
236 | if (i2c_debug) | 227 | dprintk(4, " %02x\n", msg->buf[i-1]); |
237 | dprintk(1, " %02x\n", msg->buf[i-1]); | ||
238 | } | 228 | } |
239 | if (!i2c_wait_done(i2c_adap)) | 229 | if (!i2c_wait_done(i2c_adap)) |
240 | return -EIO; | 230 | return -EIO; |
241 | 231 | ||
242 | if (i2c_debug) | 232 | dprintk(4, "\n"); |
243 | dprintk(1, "\n"); | ||
244 | 233 | ||
245 | return msg->len; | 234 | return msg->len; |
246 | } | 235 | } |
@@ -250,10 +239,10 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap, | |||
250 | { | 239 | { |
251 | int i, retval = 0; | 240 | int i, retval = 0; |
252 | 241 | ||
253 | dprintk(1, "%s(num = %d)\n", __FUNCTION__, num); | 242 | dprintk(4, "%s(num = %d)\n", __FUNCTION__, num); |
254 | 243 | ||
255 | for (i = 0 ; i < num; i++) { | 244 | for (i = 0 ; i < num; i++) { |
256 | dprintk(1, "%s(num = %d) addr = 0x%02x len = 0x%x\n", | 245 | dprintk(4, "%s(num = %d) addr = 0x%02x len = 0x%x\n", |
257 | __FUNCTION__, num, msgs[i].addr, msgs[i].len); | 246 | __FUNCTION__, num, msgs[i].addr, msgs[i].len); |
258 | if (msgs[i].flags & I2C_M_RD) { | 247 | if (msgs[i].flags & I2C_M_RD) { |
259 | /* read */ | 248 | /* read */ |
@@ -384,6 +373,7 @@ int au0828_i2c_register(struct au0828_dev *dev) | |||
384 | do_i2c_scan(DRIVER_NAME, &dev->i2c_client); | 373 | do_i2c_scan(DRIVER_NAME, &dev->i2c_client); |
385 | } else | 374 | } else |
386 | printk("%s: i2c bus register FAILED\n", DRIVER_NAME); | 375 | printk("%s: i2c bus register FAILED\n", DRIVER_NAME); |
376 | |||
387 | return dev->i2c_rc; | 377 | return dev->i2c_rc; |
388 | } | 378 | } |
389 | 379 | ||
@@ -393,10 +383,3 @@ int au0828_i2c_unregister(struct au0828_dev *dev) | |||
393 | return 0; | 383 | return 0; |
394 | } | 384 | } |
395 | 385 | ||
396 | /* ----------------------------------------------------------------------- */ | ||
397 | |||
398 | /* | ||
399 | * Local variables: | ||
400 | * c-basic-offset: 8 | ||
401 | * End: | ||
402 | */ | ||
diff --git a/drivers/media/video/au0828/au0828.h b/drivers/media/video/au0828/au0828.h index 3dc09f8ffef7..94426770a6df 100644 --- a/drivers/media/video/au0828/au0828.h +++ b/drivers/media/video/au0828/au0828.h | |||
@@ -96,6 +96,9 @@ struct au0828_buff { | |||
96 | /* au0828-core.c */ | 96 | /* au0828-core.c */ |
97 | extern u32 au0828_read(struct au0828_dev *dev, u16 reg); | 97 | extern u32 au0828_read(struct au0828_dev *dev, u16 reg); |
98 | extern u32 au0828_write(struct au0828_dev *dev, u16 reg, u32 val); | 98 | extern u32 au0828_write(struct au0828_dev *dev, u16 reg, u32 val); |
99 | extern unsigned int debug; | ||
100 | extern unsigned int usb_debug; | ||
101 | extern unsigned int bridge_debug; | ||
99 | 102 | ||
100 | /* ----------------------------------------------------------- */ | 103 | /* ----------------------------------------------------------- */ |
101 | /* au0828-cards.c */ | 104 | /* au0828-cards.c */ |
@@ -112,8 +115,14 @@ extern int au0828_i2c_register(struct au0828_dev *dev); | |||
112 | extern int au0828_i2c_unregister(struct au0828_dev *dev); | 115 | extern int au0828_i2c_unregister(struct au0828_dev *dev); |
113 | extern void au0828_call_i2c_clients(struct au0828_dev *dev, | 116 | extern void au0828_call_i2c_clients(struct au0828_dev *dev, |
114 | unsigned int cmd, void *arg); | 117 | unsigned int cmd, void *arg); |
118 | extern unsigned int i2c_debug; | ||
115 | 119 | ||
116 | /* ----------------------------------------------------------- */ | 120 | /* ----------------------------------------------------------- */ |
117 | /* au0828-dvb.c */ | 121 | /* au0828-dvb.c */ |
118 | extern int au0828_dvb_register(struct au0828_dev *dev); | 122 | extern int au0828_dvb_register(struct au0828_dev *dev); |
119 | extern void au0828_dvb_unregister(struct au0828_dev *dev); | 123 | extern void au0828_dvb_unregister(struct au0828_dev *dev); |
124 | |||
125 | #define dprintk(level, fmt, arg...)\ | ||
126 | do { if (debug & level)\ | ||
127 | printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\ | ||
128 | } while (0) | ||