aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx23885')
-rw-r--r--drivers/media/video/cx23885/cx23885-cards.c152
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c267
-rw-r--r--drivers/media/video/cx23885/cx23885-dvb.c36
-rw-r--r--drivers/media/video/cx23885/cx23885-i2c.c47
-rw-r--r--drivers/media/video/cx23885/cx23885-video.c25
-rw-r--r--drivers/media/video/cx23885/cx23885.h21
6 files changed, 297 insertions, 251 deletions
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index 2cda15f829fd..dac5ccc9ba72 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -39,16 +39,16 @@ struct cx23885_board cx23885_boards[] = {
39 .input = {{ 39 .input = {{
40 .type = CX23885_VMUX_COMPOSITE1, 40 .type = CX23885_VMUX_COMPOSITE1,
41 .vmux = 0, 41 .vmux = 0,
42 },{ 42 }, {
43 .type = CX23885_VMUX_COMPOSITE2, 43 .type = CX23885_VMUX_COMPOSITE2,
44 .vmux = 1, 44 .vmux = 1,
45 },{ 45 }, {
46 .type = CX23885_VMUX_COMPOSITE3, 46 .type = CX23885_VMUX_COMPOSITE3,
47 .vmux = 2, 47 .vmux = 2,
48 },{ 48 }, {
49 .type = CX23885_VMUX_COMPOSITE4, 49 .type = CX23885_VMUX_COMPOSITE4,
50 .vmux = 3, 50 .vmux = 3,
51 }}, 51 } },
52 }, 52 },
53 [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = { 53 [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = {
54 .name = "Hauppauge WinTV-HVR1800lp", 54 .name = "Hauppauge WinTV-HVR1800lp",
@@ -57,19 +57,19 @@ struct cx23885_board cx23885_boards[] = {
57 .type = CX23885_VMUX_TELEVISION, 57 .type = CX23885_VMUX_TELEVISION,
58 .vmux = 0, 58 .vmux = 0,
59 .gpio0 = 0xff00, 59 .gpio0 = 0xff00,
60 },{ 60 }, {
61 .type = CX23885_VMUX_DEBUG, 61 .type = CX23885_VMUX_DEBUG,
62 .vmux = 0, 62 .vmux = 0,
63 .gpio0 = 0xff01, 63 .gpio0 = 0xff01,
64 },{ 64 }, {
65 .type = CX23885_VMUX_COMPOSITE1, 65 .type = CX23885_VMUX_COMPOSITE1,
66 .vmux = 1, 66 .vmux = 1,
67 .gpio0 = 0xff02, 67 .gpio0 = 0xff02,
68 },{ 68 }, {
69 .type = CX23885_VMUX_SVIDEO, 69 .type = CX23885_VMUX_SVIDEO,
70 .vmux = 2, 70 .vmux = 2,
71 .gpio0 = 0xff02, 71 .gpio0 = 0xff02,
72 }}, 72 } },
73 }, 73 },
74 [CX23885_BOARD_HAUPPAUGE_HVR1800] = { 74 [CX23885_BOARD_HAUPPAUGE_HVR1800] = {
75 .name = "Hauppauge WinTV-HVR1800", 75 .name = "Hauppauge WinTV-HVR1800",
@@ -84,20 +84,20 @@ struct cx23885_board cx23885_boards[] = {
84 CX25840_VIN5_CH2 | 84 CX25840_VIN5_CH2 |
85 CX25840_VIN2_CH1, 85 CX25840_VIN2_CH1,
86 .gpio0 = 0, 86 .gpio0 = 0,
87 },{ 87 }, {
88 .type = CX23885_VMUX_COMPOSITE1, 88 .type = CX23885_VMUX_COMPOSITE1,
89 .vmux = CX25840_VIN7_CH3 | 89 .vmux = CX25840_VIN7_CH3 |
90 CX25840_VIN4_CH2 | 90 CX25840_VIN4_CH2 |
91 CX25840_VIN6_CH1, 91 CX25840_VIN6_CH1,
92 .gpio0 = 0, 92 .gpio0 = 0,
93 },{ 93 }, {
94 .type = CX23885_VMUX_SVIDEO, 94 .type = CX23885_VMUX_SVIDEO,
95 .vmux = CX25840_VIN7_CH3 | 95 .vmux = CX25840_VIN7_CH3 |
96 CX25840_VIN4_CH2 | 96 CX25840_VIN4_CH2 |
97 CX25840_VIN8_CH1 | 97 CX25840_VIN8_CH1 |
98 CX25840_SVIDEO_ON, 98 CX25840_SVIDEO_ON,
99 .gpio0 = 0, 99 .gpio0 = 0,
100 }}, 100 } },
101 }, 101 },
102 [CX23885_BOARD_HAUPPAUGE_HVR1250] = { 102 [CX23885_BOARD_HAUPPAUGE_HVR1250] = {
103 .name = "Hauppauge WinTV-HVR1250", 103 .name = "Hauppauge WinTV-HVR1250",
@@ -106,19 +106,19 @@ struct cx23885_board cx23885_boards[] = {
106 .type = CX23885_VMUX_TELEVISION, 106 .type = CX23885_VMUX_TELEVISION,
107 .vmux = 0, 107 .vmux = 0,
108 .gpio0 = 0xff00, 108 .gpio0 = 0xff00,
109 },{ 109 }, {
110 .type = CX23885_VMUX_DEBUG, 110 .type = CX23885_VMUX_DEBUG,
111 .vmux = 0, 111 .vmux = 0,
112 .gpio0 = 0xff01, 112 .gpio0 = 0xff01,
113 },{ 113 }, {
114 .type = CX23885_VMUX_COMPOSITE1, 114 .type = CX23885_VMUX_COMPOSITE1,
115 .vmux = 1, 115 .vmux = 1,
116 .gpio0 = 0xff02, 116 .gpio0 = 0xff02,
117 },{ 117 }, {
118 .type = CX23885_VMUX_SVIDEO, 118 .type = CX23885_VMUX_SVIDEO,
119 .vmux = 2, 119 .vmux = 2,
120 .gpio0 = 0xff02, 120 .gpio0 = 0xff02,
121 }}, 121 } },
122 }, 122 },
123 [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP] = { 123 [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP] = {
124 .name = "DViCO FusionHDTV5 Express", 124 .name = "DViCO FusionHDTV5 Express",
@@ -169,43 +169,43 @@ struct cx23885_subid cx23885_subids[] = {
169 .subvendor = 0x0070, 169 .subvendor = 0x0070,
170 .subdevice = 0x3400, 170 .subdevice = 0x3400,
171 .card = CX23885_BOARD_UNKNOWN, 171 .card = CX23885_BOARD_UNKNOWN,
172 },{ 172 }, {
173 .subvendor = 0x0070, 173 .subvendor = 0x0070,
174 .subdevice = 0x7600, 174 .subdevice = 0x7600,
175 .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp, 175 .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp,
176 },{ 176 }, {
177 .subvendor = 0x0070, 177 .subvendor = 0x0070,
178 .subdevice = 0x7800, 178 .subdevice = 0x7800,
179 .card = CX23885_BOARD_HAUPPAUGE_HVR1800, 179 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
180 },{ 180 }, {
181 .subvendor = 0x0070, 181 .subvendor = 0x0070,
182 .subdevice = 0x7801, 182 .subdevice = 0x7801,
183 .card = CX23885_BOARD_HAUPPAUGE_HVR1800, 183 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
184 },{ 184 }, {
185 .subvendor = 0x0070, 185 .subvendor = 0x0070,
186 .subdevice = 0x7809, 186 .subdevice = 0x7809,
187 .card = CX23885_BOARD_HAUPPAUGE_HVR1800, 187 .card = CX23885_BOARD_HAUPPAUGE_HVR1800,
188 },{ 188 }, {
189 .subvendor = 0x0070, 189 .subvendor = 0x0070,
190 .subdevice = 0x7911, 190 .subdevice = 0x7911,
191 .card = CX23885_BOARD_HAUPPAUGE_HVR1250, 191 .card = CX23885_BOARD_HAUPPAUGE_HVR1250,
192 },{ 192 }, {
193 .subvendor = 0x18ac, 193 .subvendor = 0x18ac,
194 .subdevice = 0xd500, 194 .subdevice = 0xd500,
195 .card = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP, 195 .card = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP,
196 },{ 196 }, {
197 .subvendor = 0x0070, 197 .subvendor = 0x0070,
198 .subdevice = 0x7790, 198 .subdevice = 0x7790,
199 .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q, 199 .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
200 },{ 200 }, {
201 .subvendor = 0x0070, 201 .subvendor = 0x0070,
202 .subdevice = 0x7797, 202 .subdevice = 0x7797,
203 .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q, 203 .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q,
204 },{ 204 }, {
205 .subvendor = 0x0070, 205 .subvendor = 0x0070,
206 .subdevice = 0x7710, 206 .subdevice = 0x7710,
207 .card = CX23885_BOARD_HAUPPAUGE_HVR1500, 207 .card = CX23885_BOARD_HAUPPAUGE_HVR1500,
208 },{ 208 }, {
209 .subvendor = 0x0070, 209 .subvendor = 0x0070,
210 .subdevice = 0x7717, 210 .subdevice = 0x7717,
211 .card = CX23885_BOARD_HAUPPAUGE_HVR1500, 211 .card = CX23885_BOARD_HAUPPAUGE_HVR1500,
@@ -225,11 +225,11 @@ struct cx23885_subid cx23885_subids[] = {
225 .subvendor = 0x0070, 225 .subvendor = 0x0070,
226 .subdevice = 0x8010, 226 .subdevice = 0x8010,
227 .card = CX23885_BOARD_HAUPPAUGE_HVR1400, 227 .card = CX23885_BOARD_HAUPPAUGE_HVR1400,
228 },{ 228 }, {
229 .subvendor = 0x18ac, 229 .subvendor = 0x18ac,
230 .subdevice = 0xd618, 230 .subdevice = 0xd618,
231 .card = CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP, 231 .card = CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP,
232 },{ 232 }, {
233 .subvendor = 0x18ac, 233 .subvendor = 0x18ac,
234 .subdevice = 0xdb78, 234 .subdevice = 0xdb78,
235 .card = CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP, 235 .card = CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP,
@@ -247,23 +247,25 @@ void cx23885_card_list(struct cx23885_dev *dev)
247 247
248 if (0 == dev->pci->subsystem_vendor && 248 if (0 == dev->pci->subsystem_vendor &&
249 0 == dev->pci->subsystem_device) { 249 0 == dev->pci->subsystem_device) {
250 printk("%s: Your board has no valid PCIe Subsystem ID and thus can't\n" 250 printk(KERN_INFO
251 "%s: be autodetected. Please pass card=<n> insmod option to\n" 251 "%s: Board has no valid PCIe Subsystem ID and can't\n"
252 "%s: workaround that. Redirect complaints to the vendor of\n" 252 "%s: be autodetected. Pass card=<n> insmod option\n"
253 "%s: the TV card. Best regards,\n" 253 "%s: to workaround that. Redirect complaints to the\n"
254 "%s: vendor of the TV card. Best regards,\n"
254 "%s: -- tux\n", 255 "%s: -- tux\n",
255 dev->name, dev->name, dev->name, dev->name, dev->name); 256 dev->name, dev->name, dev->name, dev->name, dev->name);
256 } else { 257 } else {
257 printk("%s: Your board isn't known (yet) to the driver. You can\n" 258 printk(KERN_INFO
258 "%s: try to pick one of the existing card configs via\n" 259 "%s: Your board isn't known (yet) to the driver.\n"
260 "%s: Try to pick one of the existing card configs via\n"
259 "%s: card=<n> insmod option. Updating to the latest\n" 261 "%s: card=<n> insmod option. Updating to the latest\n"
260 "%s: version might help as well.\n", 262 "%s: version might help as well.\n",
261 dev->name, dev->name, dev->name, dev->name); 263 dev->name, dev->name, dev->name, dev->name);
262 } 264 }
263 printk("%s: Here is a list of valid choices for the card=<n> insmod option:\n", 265 printk(KERN_INFO "%s: Here is a list of valid choices for the card=<n> insmod option:\n",
264 dev->name); 266 dev->name);
265 for (i = 0; i < cx23885_bcount; i++) 267 for (i = 0; i < cx23885_bcount; i++)
266 printk("%s: card=%d -> %s\n", 268 printk(KERN_INFO "%s: card=%d -> %s\n",
267 dev->name, i, cx23885_boards[i].name); 269 dev->name, i, cx23885_boards[i].name);
268} 270}
269 271
@@ -271,11 +273,11 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
271{ 273{
272 struct tveeprom tv; 274 struct tveeprom tv;
273 275
274 tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv, eeprom_data); 276 tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv,
277 eeprom_data);
275 278
276 /* Make sure we support the board model */ 279 /* Make sure we support the board model */
277 switch (tv.model) 280 switch (tv.model) {
278 {
279 case 71009: 281 case 71009:
280 /* WinTV-HVR1200 (PCIe, Retail, full height) 282 /* WinTV-HVR1200 (PCIe, Retail, full height)
281 * DVB-T and basic analog */ 283 * DVB-T and basic analog */
@@ -303,21 +305,51 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
303 case 71999: 305 case 71999:
304 /* WinTV-HVR1200 (PCIe, OEM, full height) 306 /* WinTV-HVR1200 (PCIe, OEM, full height)
305 * DVB-T and basic analog */ 307 * DVB-T and basic analog */
306 case 76601: /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual channel ATSC and MPEG2 HW Encoder */ 308 case 76601:
307 case 77001: /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC and Basic analog */ 309 /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual
308 case 77011: /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC and Basic analog */ 310 channel ATSC and MPEG2 HW Encoder */
309 case 77041: /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM and Basic analog */ 311 case 77001:
310 case 77051: /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM and Basic analog */ 312 /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC
311 case 78011: /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */ 313 and Basic analog */
312 case 78501: /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, Dual channel ATSC and MPEG2 HW Encoder */ 314 case 77011:
313 case 78521: /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, Dual channel ATSC and MPEG2 HW Encoder */ 315 /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC
314 case 78531: /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */ 316 and Basic analog */
315 case 78631: /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */ 317 case 77041:
316 case 79001: /* WinTV-HVR1250 (PCIe, Retail, IR, full height, ATSC and Basic analog */ 318 /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM
317 case 79101: /* WinTV-HVR1250 (PCIe, Retail, IR, half height, ATSC and Basic analog */ 319 and Basic analog */
318 case 79561: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */ 320 case 77051:
319 case 79571: /* WinTV-HVR1250 (PCIe, OEM, No IR, full height, ATSC and Basic analog */ 321 /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM
320 case 79671: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */ 322 and Basic analog */
323 case 78011:
324 /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM,
325 Dual channel ATSC and MPEG2 HW Encoder */
326 case 78501:
327 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
328 Dual channel ATSC and MPEG2 HW Encoder */
329 case 78521:
330 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM,
331 Dual channel ATSC and MPEG2 HW Encoder */
332 case 78531:
333 /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM,
334 Dual channel ATSC and MPEG2 HW Encoder */
335 case 78631:
336 /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM,
337 Dual channel ATSC and MPEG2 HW Encoder */
338 case 79001:
339 /* WinTV-HVR1250 (PCIe, Retail, IR, full height,
340 ATSC and Basic analog */
341 case 79101:
342 /* WinTV-HVR1250 (PCIe, Retail, IR, half height,
343 ATSC and Basic analog */
344 case 79561:
345 /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
346 ATSC and Basic analog */
347 case 79571:
348 /* WinTV-HVR1250 (PCIe, OEM, No IR, full height,
349 ATSC and Basic analog */
350 case 79671:
351 /* WinTV-HVR1250 (PCIe, OEM, No IR, half height,
352 ATSC and Basic analog */
321 case 80019: 353 case 80019:
322 /* WinTV-HVR1400 (Express Card, Retail, IR, 354 /* WinTV-HVR1400 (Express Card, Retail, IR,
323 * DVB-T and Basic analog */ 355 * DVB-T and Basic analog */
@@ -329,7 +361,8 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
329 * DVB-T and MPEG2 HW Encoder */ 361 * DVB-T and MPEG2 HW Encoder */
330 break; 362 break;
331 default: 363 default:
332 printk("%s: warning: unknown hauppauge model #%d\n", dev->name, tv.model); 364 printk(KERN_WARNING "%s: warning: unknown hauppauge model #%d\n",
365 dev->name, tv.model);
333 break; 366 break;
334 } 367 }
335 368
@@ -352,7 +385,7 @@ int cx23885_tuner_callback(void *priv, int component, int command, int arg)
352 return -EINVAL; 385 return -EINVAL;
353 } 386 }
354 387
355 switch(dev->board) { 388 switch (dev->board) {
356 case CX23885_BOARD_HAUPPAUGE_HVR1400: 389 case CX23885_BOARD_HAUPPAUGE_HVR1400:
357 case CX23885_BOARD_HAUPPAUGE_HVR1500: 390 case CX23885_BOARD_HAUPPAUGE_HVR1500:
358 case CX23885_BOARD_HAUPPAUGE_HVR1500Q: 391 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
@@ -383,7 +416,7 @@ int cx23885_tuner_callback(void *priv, int component, int command, int arg)
383 416
384void cx23885_gpio_setup(struct cx23885_dev *dev) 417void cx23885_gpio_setup(struct cx23885_dev *dev)
385{ 418{
386 switch(dev->board) { 419 switch (dev->board) {
387 case CX23885_BOARD_HAUPPAUGE_HVR1250: 420 case CX23885_BOARD_HAUPPAUGE_HVR1250:
388 /* GPIO-0 cx24227 demodulator reset */ 421 /* GPIO-0 cx24227 demodulator reset */
389 cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */ 422 cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
@@ -617,10 +650,3 @@ void cx23885_card_setup(struct cx23885_dev *dev)
617} 650}
618 651
619/* ------------------------------------------------------------------ */ 652/* ------------------------------------------------------------------ */
620
621/*
622 * Local variables:
623 * c-basic-offset: 8
624 * End:
625 * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off
626 */
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index 0979ba62e33a..110e2ed2061d 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -37,12 +37,12 @@ MODULE_AUTHOR("Steven Toth <stoth@linuxtv.org>");
37MODULE_LICENSE("GPL"); 37MODULE_LICENSE("GPL");
38 38
39static unsigned int debug; 39static unsigned int debug;
40module_param(debug,int,0644); 40module_param(debug, int, 0644);
41MODULE_PARM_DESC(debug,"enable debug messages"); 41MODULE_PARM_DESC(debug, "enable debug messages");
42 42
43static unsigned int card[] = {[0 ... (CX23885_MAXBOARDS - 1)] = UNSET }; 43static unsigned int card[] = {[0 ... (CX23885_MAXBOARDS - 1)] = UNSET };
44module_param_array(card, int, NULL, 0444); 44module_param_array(card, int, NULL, 0444);
45MODULE_PARM_DESC(card,"card type"); 45MODULE_PARM_DESC(card, "card type");
46 46
47#define dprintk(level, fmt, arg...)\ 47#define dprintk(level, fmt, arg...)\
48 do { if (debug >= level)\ 48 do { if (debug >= level)\
@@ -364,13 +364,12 @@ void cx23885_wakeup(struct cx23885_tsport *port,
364 list_del(&buf->vb.queue); 364 list_del(&buf->vb.queue);
365 wake_up(&buf->vb.done); 365 wake_up(&buf->vb.done);
366 } 366 }
367 if (list_empty(&q->active)) { 367 if (list_empty(&q->active))
368 del_timer(&q->timeout); 368 del_timer(&q->timeout);
369 } else { 369 else
370 mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT); 370 mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT);
371 }
372 if (bc != 1) 371 if (bc != 1)
373 printk("%s: %d buffers handled (should be 1)\n", 372 printk(KERN_WARNING "%s: %d buffers handled (should be 1)\n",
374 __func__, bc); 373 __func__, bc);
375} 374}
376 375
@@ -381,8 +380,7 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev,
381 unsigned int i, lines; 380 unsigned int i, lines;
382 u32 cdt; 381 u32 cdt;
383 382
384 if (ch->cmds_start == 0) 383 if (ch->cmds_start == 0) {
385 {
386 dprintk(1, "%s() Erasing channel [%s]\n", __func__, 384 dprintk(1, "%s() Erasing channel [%s]\n", __func__,
387 ch->name); 385 ch->name);
388 cx_write(ch->ptr1_reg, 0); 386 cx_write(ch->ptr1_reg, 0);
@@ -418,15 +416,15 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev,
418 416
419 /* write CMDS */ 417 /* write CMDS */
420 if (ch->jumponly) 418 if (ch->jumponly)
421 cx_write(ch->cmds_start + 0, 8); 419 cx_write(ch->cmds_start + 0, 8);
422 else 420 else
423 cx_write(ch->cmds_start + 0, risc); 421 cx_write(ch->cmds_start + 0, risc);
424 cx_write(ch->cmds_start + 4, 0); /* 64 bits 63-32 */ 422 cx_write(ch->cmds_start + 4, 0); /* 64 bits 63-32 */
425 cx_write(ch->cmds_start + 8, cdt); 423 cx_write(ch->cmds_start + 8, cdt);
426 cx_write(ch->cmds_start + 12, (lines*16) >> 3); 424 cx_write(ch->cmds_start + 12, (lines*16) >> 3);
427 cx_write(ch->cmds_start + 16, ch->ctrl_start); 425 cx_write(ch->cmds_start + 16, ch->ctrl_start);
428 if (ch->jumponly) 426 if (ch->jumponly)
429 cx_write(ch->cmds_start + 20, 0x80000000 | (64 >> 2) ); 427 cx_write(ch->cmds_start + 20, 0x80000000 | (64 >> 2));
430 else 428 else
431 cx_write(ch->cmds_start + 20, 64 >> 2); 429 cx_write(ch->cmds_start + 20, 64 >> 2);
432 for (i = 24; i < 80; i += 4) 430 for (i = 24; i < 80; i += 4)
@@ -436,9 +434,9 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev,
436 cx_write(ch->ptr1_reg, ch->fifo_start); 434 cx_write(ch->ptr1_reg, ch->fifo_start);
437 cx_write(ch->ptr2_reg, cdt); 435 cx_write(ch->ptr2_reg, cdt);
438 cx_write(ch->cnt2_reg, (lines*16) >> 3); 436 cx_write(ch->cnt2_reg, (lines*16) >> 3);
439 cx_write(ch->cnt1_reg, (bpl >> 3) -1); 437 cx_write(ch->cnt1_reg, (bpl >> 3) - 1);
440 438
441 dprintk(2,"[bridge %d] sram setup %s: bpl=%d lines=%d\n", 439 dprintk(2, "[bridge %d] sram setup %s: bpl=%d lines=%d\n",
442 dev->bridge, 440 dev->bridge,
443 ch->name, 441 ch->name,
444 bpl, 442 bpl,
@@ -469,43 +467,43 @@ void cx23885_sram_channel_dump(struct cx23885_dev *dev,
469 u32 risc; 467 u32 risc;
470 unsigned int i, j, n; 468 unsigned int i, j, n;
471 469
472 printk("%s: %s - dma channel status dump\n", 470 printk(KERN_WARNING "%s: %s - dma channel status dump\n",
473 dev->name, ch->name); 471 dev->name, ch->name);
474 for (i = 0; i < ARRAY_SIZE(name); i++) 472 for (i = 0; i < ARRAY_SIZE(name); i++)
475 printk("%s: cmds: %-15s: 0x%08x\n", 473 printk(KERN_WARNING "%s: cmds: %-15s: 0x%08x\n",
476 dev->name, name[i], 474 dev->name, name[i],
477 cx_read(ch->cmds_start + 4*i)); 475 cx_read(ch->cmds_start + 4*i));
478 476
479 for (i = 0; i < 4; i++) { 477 for (i = 0; i < 4; i++) {
480 risc = cx_read(ch->cmds_start + 4 * (i + 14)); 478 risc = cx_read(ch->cmds_start + 4 * (i + 14));
481 printk("%s: risc%d: ", dev->name, i); 479 printk(KERN_WARNING "%s: risc%d: ", dev->name, i);
482 cx23885_risc_decode(risc); 480 cx23885_risc_decode(risc);
483 } 481 }
484 for (i = 0; i < (64 >> 2); i += n) { 482 for (i = 0; i < (64 >> 2); i += n) {
485 risc = cx_read(ch->ctrl_start + 4 * i); 483 risc = cx_read(ch->ctrl_start + 4 * i);
486 /* No consideration for bits 63-32 */ 484 /* No consideration for bits 63-32 */
487 485
488 printk("%s: (0x%08x) iq %x: ", dev->name, 486 printk(KERN_WARNING "%s: (0x%08x) iq %x: ", dev->name,
489 ch->ctrl_start + 4 * i, i); 487 ch->ctrl_start + 4 * i, i);
490 n = cx23885_risc_decode(risc); 488 n = cx23885_risc_decode(risc);
491 for (j = 1; j < n; j++) { 489 for (j = 1; j < n; j++) {
492 risc = cx_read(ch->ctrl_start + 4 * (i + j)); 490 risc = cx_read(ch->ctrl_start + 4 * (i + j));
493 printk("%s: iq %x: 0x%08x [ arg #%d ]\n", 491 printk(KERN_WARNING "%s: iq %x: 0x%08x [ arg #%d ]\n",
494 dev->name, i+j, risc, j); 492 dev->name, i+j, risc, j);
495 } 493 }
496 } 494 }
497 495
498 printk("%s: fifo: 0x%08x -> 0x%x\n", 496 printk(KERN_WARNING "%s: fifo: 0x%08x -> 0x%x\n",
499 dev->name, ch->fifo_start, ch->fifo_start+ch->fifo_size); 497 dev->name, ch->fifo_start, ch->fifo_start+ch->fifo_size);
500 printk("%s: ctrl: 0x%08x -> 0x%x\n", 498 printk(KERN_WARNING "%s: ctrl: 0x%08x -> 0x%x\n",
501 dev->name, ch->ctrl_start, ch->ctrl_start + 6*16); 499 dev->name, ch->ctrl_start, ch->ctrl_start + 6*16);
502 printk("%s: ptr1_reg: 0x%08x\n", 500 printk(KERN_WARNING "%s: ptr1_reg: 0x%08x\n",
503 dev->name, cx_read(ch->ptr1_reg)); 501 dev->name, cx_read(ch->ptr1_reg));
504 printk("%s: ptr2_reg: 0x%08x\n", 502 printk(KERN_WARNING "%s: ptr2_reg: 0x%08x\n",
505 dev->name, cx_read(ch->ptr2_reg)); 503 dev->name, cx_read(ch->ptr2_reg));
506 printk("%s: cnt1_reg: 0x%08x\n", 504 printk(KERN_WARNING "%s: cnt1_reg: 0x%08x\n",
507 dev->name, cx_read(ch->cnt1_reg)); 505 dev->name, cx_read(ch->cnt1_reg));
508 printk("%s: cnt2_reg: 0x%08x\n", 506 printk(KERN_WARNING "%s: cnt2_reg: 0x%08x\n",
509 dev->name, cx_read(ch->cnt2_reg)); 507 dev->name, cx_read(ch->cnt2_reg));
510} 508}
511 509
@@ -515,13 +513,13 @@ static void cx23885_risc_disasm(struct cx23885_tsport *port,
515 struct cx23885_dev *dev = port->dev; 513 struct cx23885_dev *dev = port->dev;
516 unsigned int i, j, n; 514 unsigned int i, j, n;
517 515
518 printk("%s: risc disasm: %p [dma=0x%08lx]\n", 516 printk(KERN_INFO "%s: risc disasm: %p [dma=0x%08lx]\n",
519 dev->name, risc->cpu, (unsigned long)risc->dma); 517 dev->name, risc->cpu, (unsigned long)risc->dma);
520 for (i = 0; i < (risc->size >> 2); i += n) { 518 for (i = 0; i < (risc->size >> 2); i += n) {
521 printk("%s: %04d: ", dev->name, i); 519 printk(KERN_INFO "%s: %04d: ", dev->name, i);
522 n = cx23885_risc_decode(le32_to_cpu(risc->cpu[i])); 520 n = cx23885_risc_decode(le32_to_cpu(risc->cpu[i]));
523 for (j = 1; j < n; j++) 521 for (j = 1; j < n; j++)
524 printk("%s: %04d: 0x%08x [ arg #%d ]\n", 522 printk(KERN_INFO "%s: %04d: 0x%08x [ arg #%d ]\n",
525 dev->name, i + j, risc->cpu[i + j], j); 523 dev->name, i + j, risc->cpu[i + j], j);
526 if (risc->cpu[i] == cpu_to_le32(RISC_JUMP)) 524 if (risc->cpu[i] == cpu_to_le32(RISC_JUMP))
527 break; 525 break;
@@ -600,7 +598,7 @@ static int cx23885_pci_quirks(struct cx23885_dev *dev)
600 * when DMA begins if RDR_TLCTL0 bit4 is not cleared. It does not 598 * when DMA begins if RDR_TLCTL0 bit4 is not cleared. It does not
601 * occur on the cx23887 bridge. 599 * occur on the cx23887 bridge.
602 */ 600 */
603 if(dev->bridge == CX23885_BRIDGE_885) 601 if (dev->bridge == CX23885_BRIDGE_885)
604 cx_clear(RDR_TLCTL0, 1 << 4); 602 cx_clear(RDR_TLCTL0, 1 << 4);
605 603
606 return 0; 604 return 0;
@@ -608,13 +606,13 @@ static int cx23885_pci_quirks(struct cx23885_dev *dev)
608 606
609static int get_resources(struct cx23885_dev *dev) 607static int get_resources(struct cx23885_dev *dev)
610{ 608{
611 if (request_mem_region(pci_resource_start(dev->pci,0), 609 if (request_mem_region(pci_resource_start(dev->pci, 0),
612 pci_resource_len(dev->pci,0), 610 pci_resource_len(dev->pci, 0),
613 dev->name)) 611 dev->name))
614 return 0; 612 return 0;
615 613
616 printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx\n", 614 printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx\n",
617 dev->name, (unsigned long long)pci_resource_start(dev->pci,0)); 615 dev->name, (unsigned long long)pci_resource_start(dev->pci, 0));
618 616
619 return -EBUSY; 617 return -EBUSY;
620} 618}
@@ -623,7 +621,8 @@ static void cx23885_timeout(unsigned long data);
623int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, 621int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
624 u32 reg, u32 mask, u32 value); 622 u32 reg, u32 mask, u32 value);
625 623
626static int cx23885_init_tsport(struct cx23885_dev *dev, struct cx23885_tsport *port, int portno) 624static int cx23885_init_tsport(struct cx23885_dev *dev,
625 struct cx23885_tsport *port, int portno)
627{ 626{
628 dprintk(1, "%s(portno=%d)\n", __func__, portno); 627 dprintk(1, "%s(portno=%d)\n", __func__, portno);
629 628
@@ -651,10 +650,10 @@ static int cx23885_init_tsport(struct cx23885_dev *dev, struct cx23885_tsport *p
651 * attachment to this tsport, keeping the -dvb.c 650 * attachment to this tsport, keeping the -dvb.c
652 * code clean and safe. 651 * code clean and safe.
653 */ 652 */
654 if(!port->num_frontends) 653 if (!port->num_frontends)
655 port->num_frontends = 1; 654 port->num_frontends = 1;
656 655
657 switch(portno) { 656 switch (portno) {
658 case 1: 657 case 1:
659 port->reg_gpcnt = VID_B_GPCNT; 658 port->reg_gpcnt = VID_B_GPCNT;
660 port->reg_gpcnt_ctl = VID_B_GPCNT_CTL; 659 port->reg_gpcnt_ctl = VID_B_GPCNT_CTL;
@@ -755,13 +754,13 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
755 mutex_unlock(&devlist); 754 mutex_unlock(&devlist);
756 755
757 /* Configure the internal memory */ 756 /* Configure the internal memory */
758 if(dev->pci->device == 0x8880) { 757 if (dev->pci->device == 0x8880) {
759 dev->bridge = CX23885_BRIDGE_887; 758 dev->bridge = CX23885_BRIDGE_887;
760 /* Apply a sensible clock frequency for the PCIe bridge */ 759 /* Apply a sensible clock frequency for the PCIe bridge */
761 dev->clk_freq = 25000000; 760 dev->clk_freq = 25000000;
762 dev->sram_channels = cx23887_sram_channels; 761 dev->sram_channels = cx23887_sram_channels;
763 } else 762 } else
764 if(dev->pci->device == 0x8852) { 763 if (dev->pci->device == 0x8852) {
765 dev->bridge = CX23885_BRIDGE_885; 764 dev->bridge = CX23885_BRIDGE_885;
766 /* Apply a sensible clock frequency for the PCIe bridge */ 765 /* Apply a sensible clock frequency for the PCIe bridge */
767 dev->clk_freq = 28000000; 766 dev->clk_freq = 28000000;
@@ -842,8 +841,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
842 } 841 }
843 842
844 /* PCIe stuff */ 843 /* PCIe stuff */
845 dev->lmmio = ioremap(pci_resource_start(dev->pci,0), 844 dev->lmmio = ioremap(pci_resource_start(dev->pci, 0),
846 pci_resource_len(dev->pci,0)); 845 pci_resource_len(dev->pci, 0));
847 846
848 dev->bmmio = (u8 __iomem *)dev->lmmio; 847 dev->bmmio = (u8 __iomem *)dev->lmmio;
849 848
@@ -873,7 +872,7 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
873 cx23885_i2c_register(&dev->i2c_bus[1]); 872 cx23885_i2c_register(&dev->i2c_bus[1]);
874 cx23885_i2c_register(&dev->i2c_bus[2]); 873 cx23885_i2c_register(&dev->i2c_bus[2]);
875 cx23885_card_setup(dev); 874 cx23885_card_setup(dev);
876 cx23885_call_i2c_clients (&dev->i2c_bus[0], TUNER_SET_STANDBY, NULL); 875 cx23885_call_i2c_clients(&dev->i2c_bus[0], TUNER_SET_STANDBY, NULL);
877 cx23885_ir_init(dev); 876 cx23885_ir_init(dev);
878 877
879 if (cx23885_boards[dev->board].porta == CX23885_ANALOG_VIDEO) { 878 if (cx23885_boards[dev->board].porta == CX23885_ANALOG_VIDEO) {
@@ -919,8 +918,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
919 918
920static void cx23885_dev_unregister(struct cx23885_dev *dev) 919static void cx23885_dev_unregister(struct cx23885_dev *dev)
921{ 920{
922 release_mem_region(pci_resource_start(dev->pci,0), 921 release_mem_region(pci_resource_start(dev->pci, 0),
923 pci_resource_len(dev->pci,0)); 922 pci_resource_len(dev->pci, 0));
924 923
925 if (!atomic_dec_and_test(&dev->refcount)) 924 if (!atomic_dec_and_test(&dev->refcount))
926 return; 925 return;
@@ -947,7 +946,7 @@ static void cx23885_dev_unregister(struct cx23885_dev *dev)
947 iounmap(dev->lmmio); 946 iounmap(dev->lmmio);
948} 947}
949 948
950static __le32* cx23885_risc_field(__le32 *rp, struct scatterlist *sglist, 949static __le32 *cx23885_risc_field(__le32 *rp, struct scatterlist *sglist,
951 unsigned int offset, u32 sync_line, 950 unsigned int offset, u32 sync_line,
952 unsigned int bpl, unsigned int padding, 951 unsigned int bpl, unsigned int padding,
953 unsigned int lines) 952 unsigned int lines)
@@ -968,31 +967,31 @@ static __le32* cx23885_risc_field(__le32 *rp, struct scatterlist *sglist,
968 } 967 }
969 if (bpl <= sg_dma_len(sg)-offset) { 968 if (bpl <= sg_dma_len(sg)-offset) {
970 /* fits into current chunk */ 969 /* fits into current chunk */
971 *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL|RISC_EOL|bpl); 970 *(rp++) = cpu_to_le32(RISC_WRITE|RISC_SOL|RISC_EOL|bpl);
972 *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); 971 *(rp++) = cpu_to_le32(sg_dma_address(sg)+offset);
973 *(rp++)=cpu_to_le32(0); /* bits 63-32 */ 972 *(rp++) = cpu_to_le32(0); /* bits 63-32 */
974 offset+=bpl; 973 offset += bpl;
975 } else { 974 } else {
976 /* scanline needs to be split */ 975 /* scanline needs to be split */
977 todo = bpl; 976 todo = bpl;
978 *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL| 977 *(rp++) = cpu_to_le32(RISC_WRITE|RISC_SOL|
979 (sg_dma_len(sg)-offset)); 978 (sg_dma_len(sg)-offset));
980 *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); 979 *(rp++) = cpu_to_le32(sg_dma_address(sg)+offset);
981 *(rp++)=cpu_to_le32(0); /* bits 63-32 */ 980 *(rp++) = cpu_to_le32(0); /* bits 63-32 */
982 todo -= (sg_dma_len(sg)-offset); 981 todo -= (sg_dma_len(sg)-offset);
983 offset = 0; 982 offset = 0;
984 sg++; 983 sg++;
985 while (todo > sg_dma_len(sg)) { 984 while (todo > sg_dma_len(sg)) {
986 *(rp++)=cpu_to_le32(RISC_WRITE| 985 *(rp++) = cpu_to_le32(RISC_WRITE|
987 sg_dma_len(sg)); 986 sg_dma_len(sg));
988 *(rp++)=cpu_to_le32(sg_dma_address(sg)); 987 *(rp++) = cpu_to_le32(sg_dma_address(sg));
989 *(rp++)=cpu_to_le32(0); /* bits 63-32 */ 988 *(rp++) = cpu_to_le32(0); /* bits 63-32 */
990 todo -= sg_dma_len(sg); 989 todo -= sg_dma_len(sg);
991 sg++; 990 sg++;
992 } 991 }
993 *(rp++)=cpu_to_le32(RISC_WRITE|RISC_EOL|todo); 992 *(rp++) = cpu_to_le32(RISC_WRITE|RISC_EOL|todo);
994 *(rp++)=cpu_to_le32(sg_dma_address(sg)); 993 *(rp++) = cpu_to_le32(sg_dma_address(sg));
995 *(rp++)=cpu_to_le32(0); /* bits 63-32 */ 994 *(rp++) = cpu_to_le32(0); /* bits 63-32 */
996 offset += todo; 995 offset += todo;
997 } 996 }
998 offset += padding; 997 offset += padding;
@@ -1021,9 +1020,11 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
1021 can cause next bpl to start close to a page border. First DMA 1020 can cause next bpl to start close to a page border. First DMA
1022 region may be smaller than PAGE_SIZE */ 1021 region may be smaller than PAGE_SIZE */
1023 /* write and jump need and extra dword */ 1022 /* write and jump need and extra dword */
1024 instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines); 1023 instructions = fields * (1 + ((bpl + padding) * lines)
1024 / PAGE_SIZE + lines);
1025 instructions += 2; 1025 instructions += 2;
1026 if ((rc = btcx_riscmem_alloc(pci,risc,instructions*12)) < 0) 1026 rc = btcx_riscmem_alloc(pci, risc, instructions*12);
1027 if (rc < 0)
1027 return rc; 1028 return rc;
1028 1029
1029 /* write risc instructions */ 1030 /* write risc instructions */
@@ -1037,7 +1038,7 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
1037 1038
1038 /* save pointer to jmp instruction address */ 1039 /* save pointer to jmp instruction address */
1039 risc->jmp = rp; 1040 risc->jmp = rp;
1040 BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size); 1041 BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
1041 return 0; 1042 return 0;
1042} 1043}
1043 1044
@@ -1059,7 +1060,8 @@ static int cx23885_risc_databuffer(struct pci_dev *pci,
1059 instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; 1060 instructions = 1 + (bpl * lines) / PAGE_SIZE + lines;
1060 instructions += 1; 1061 instructions += 1;
1061 1062
1062 if ((rc = btcx_riscmem_alloc(pci,risc,instructions*12)) < 0) 1063 rc = btcx_riscmem_alloc(pci, risc, instructions*12);
1064 if (rc < 0)
1063 return rc; 1065 return rc;
1064 1066
1065 /* write risc instructions */ 1067 /* write risc instructions */
@@ -1068,7 +1070,7 @@ static int cx23885_risc_databuffer(struct pci_dev *pci,
1068 1070
1069 /* save pointer to jmp instruction address */ 1071 /* save pointer to jmp instruction address */
1070 risc->jmp = rp; 1072 risc->jmp = rp;
1071 BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size); 1073 BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
1072 return 0; 1074 return 0;
1073} 1075}
1074 1076
@@ -1078,7 +1080,8 @@ int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
1078 __le32 *rp; 1080 __le32 *rp;
1079 int rc; 1081 int rc;
1080 1082
1081 if ((rc = btcx_riscmem_alloc(pci, risc, 4*16)) < 0) 1083 rc = btcx_riscmem_alloc(pci, risc, 4*16);
1084 if (rc < 0)
1082 return rc; 1085 return rc;
1083 1086
1084 /* write risc instructions */ 1087 /* write risc instructions */
@@ -1172,22 +1175,23 @@ static int cx23885_start_dma(struct cx23885_tsport *port,
1172 1175
1173 /* setup fifo + format */ 1176 /* setup fifo + format */
1174 cx23885_sram_channel_setup(dev, 1177 cx23885_sram_channel_setup(dev,
1175 &dev->sram_channels[ port->sram_chno ], 1178 &dev->sram_channels[port->sram_chno],
1176 port->ts_packet_size, buf->risc.dma); 1179 port->ts_packet_size, buf->risc.dma);
1177 if(debug > 5) { 1180 if (debug > 5) {
1178 cx23885_sram_channel_dump(dev, &dev->sram_channels[ port->sram_chno ] ); 1181 cx23885_sram_channel_dump(dev,
1182 &dev->sram_channels[port->sram_chno]);
1179 cx23885_risc_disasm(port, &buf->risc); 1183 cx23885_risc_disasm(port, &buf->risc);
1180 } 1184 }
1181 1185
1182 /* write TS length to chip */ 1186 /* write TS length to chip */
1183 cx_write(port->reg_lngth, buf->vb.width); 1187 cx_write(port->reg_lngth, buf->vb.width);
1184 1188
1185 if ( (!(cx23885_boards[dev->board].portb & CX23885_MPEG_DVB)) && 1189 if ((!(cx23885_boards[dev->board].portb & CX23885_MPEG_DVB)) &&
1186 (!(cx23885_boards[dev->board].portc & CX23885_MPEG_DVB)) ) { 1190 (!(cx23885_boards[dev->board].portc & CX23885_MPEG_DVB))) {
1187 printk( "%s() Failed. Unsupported value in .portb/c (0x%08x)/(0x%08x)\n", 1191 printk("%s() Unsupported .portb/c (0x%08x)/(0x%08x)\n",
1188 __func__, 1192 __func__,
1189 cx23885_boards[dev->board].portb, 1193 cx23885_boards[dev->board].portb,
1190 cx23885_boards[dev->board].portc ); 1194 cx23885_boards[dev->board].portc);
1191 return -EINVAL; 1195 return -EINVAL;
1192 } 1196 }
1193 1197
@@ -1197,7 +1201,7 @@ static int cx23885_start_dma(struct cx23885_tsport *port,
1197 udelay(100); 1201 udelay(100);
1198 1202
1199 /* If the port supports SRC SELECT, configure it */ 1203 /* If the port supports SRC SELECT, configure it */
1200 if(port->reg_src_sel) 1204 if (port->reg_src_sel)
1201 cx_write(port->reg_src_sel, port->src_sel_val); 1205 cx_write(port->reg_src_sel, port->src_sel_val);
1202 1206
1203 cx_write(port->reg_hw_sop_ctrl, port->hw_sop_ctrl_val); 1207 cx_write(port->reg_hw_sop_ctrl, port->hw_sop_ctrl_val);
@@ -1206,7 +1210,7 @@ static int cx23885_start_dma(struct cx23885_tsport *port,
1206 cx_write(port->reg_gen_ctrl, port->gen_ctrl_val); 1210 cx_write(port->reg_gen_ctrl, port->gen_ctrl_val);
1207 udelay(100); 1211 udelay(100);
1208 1212
1209 // NOTE: this is 2 (reserved) for portb, does it matter? 1213 /* NOTE: this is 2 (reserved) for portb, does it matter? */
1210 /* reset counter to zero */ 1214 /* reset counter to zero */
1211 cx_write(port->reg_gpcnt_ctl, 3); 1215 cx_write(port->reg_gpcnt_ctl, 3);
1212 q->count = 1; 1216 q->count = 1;
@@ -1240,11 +1244,11 @@ static int cx23885_start_dma(struct cx23885_tsport *port,
1240 cx_write(ALT_PIN_OUT_SEL, 0x10100045); 1244 cx_write(ALT_PIN_OUT_SEL, 0x10100045);
1241 } 1245 }
1242 1246
1243 switch(dev->bridge) { 1247 switch (dev->bridge) {
1244 case CX23885_BRIDGE_885: 1248 case CX23885_BRIDGE_885:
1245 case CX23885_BRIDGE_887: 1249 case CX23885_BRIDGE_887:
1246 /* enable irqs */ 1250 /* enable irqs */
1247 dprintk(1, "%s() enabling TS int's and DMA\n", __func__ ); 1251 dprintk(1, "%s() enabling TS int's and DMA\n", __func__);
1248 cx_set(port->reg_ts_int_msk, port->ts_int_msk_val); 1252 cx_set(port->reg_ts_int_msk, port->ts_int_msk_val);
1249 cx_set(port->reg_dma_ctl, port->dma_ctl_val); 1253 cx_set(port->reg_dma_ctl, port->dma_ctl_val);
1250 cx_set(PCI_INT_MSK, dev->pci_irqmask | port->pci_irqmask); 1254 cx_set(PCI_INT_MSK, dev->pci_irqmask | port->pci_irqmask);
@@ -1303,8 +1307,7 @@ int cx23885_restart_queue(struct cx23885_tsport *port,
1303 struct cx23885_buffer *buf; 1307 struct cx23885_buffer *buf;
1304 1308
1305 dprintk(5, "%s()\n", __func__); 1309 dprintk(5, "%s()\n", __func__);
1306 if (list_empty(&q->active)) 1310 if (list_empty(&q->active)) {
1307 {
1308 struct cx23885_buffer *prev; 1311 struct cx23885_buffer *prev;
1309 prev = NULL; 1312 prev = NULL;
1310 1313
@@ -1322,7 +1325,7 @@ int cx23885_restart_queue(struct cx23885_tsport *port,
1322 buf->vb.state = VIDEOBUF_ACTIVE; 1325 buf->vb.state = VIDEOBUF_ACTIVE;
1323 buf->count = q->count++; 1326 buf->count = q->count++;
1324 mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); 1327 mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT);
1325 dprintk(5, "[%p/%d] restart_queue - first active\n", 1328 dprintk(5, "[%p/%d] restart_queue - f/active\n",
1326 buf, buf->vb.i); 1329 buf, buf->vb.i);
1327 1330
1328 } else if (prev->vb.width == buf->vb.width && 1331 } else if (prev->vb.width == buf->vb.width &&
@@ -1333,8 +1336,9 @@ int cx23885_restart_queue(struct cx23885_tsport *port,
1333 buf->vb.state = VIDEOBUF_ACTIVE; 1336 buf->vb.state = VIDEOBUF_ACTIVE;
1334 buf->count = q->count++; 1337 buf->count = q->count++;
1335 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); 1338 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
1336 prev->risc.jmp[2] = cpu_to_le32(0); /* 64 bit bits 63-32 */ 1339 /* 64 bit bits 63-32 */
1337 dprintk(5,"[%p/%d] restart_queue - move to active\n", 1340 prev->risc.jmp[2] = cpu_to_le32(0);
1341 dprintk(5, "[%p/%d] restart_queue - m/active\n",
1338 buf, buf->vb.i); 1342 buf, buf->vb.i);
1339 } else { 1343 } else {
1340 return 0; 1344 return 0;
@@ -1373,7 +1377,8 @@ int cx23885_buf_prepare(struct videobuf_queue *q, struct cx23885_tsport *port,
1373 buf->vb.size = size; 1377 buf->vb.size = size;
1374 buf->vb.field = field /*V4L2_FIELD_TOP*/; 1378 buf->vb.field = field /*V4L2_FIELD_TOP*/;
1375 1379
1376 if (0 != (rc = videobuf_iolock(q, &buf->vb, NULL))) 1380 rc = videobuf_iolock(q, &buf->vb, NULL);
1381 if (0 != rc)
1377 goto fail; 1382 goto fail;
1378 cx23885_risc_databuffer(dev->pci, &buf->risc, 1383 cx23885_risc_databuffer(dev->pci, &buf->risc,
1379 videobuf_to_dma(&buf->vb)->sglist, 1384 videobuf_to_dma(&buf->vb)->sglist,
@@ -1399,7 +1404,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf)
1399 buf->risc.jmp[2] = cpu_to_le32(0); /* bits 63-32 */ 1404 buf->risc.jmp[2] = cpu_to_le32(0); /* bits 63-32 */
1400 1405
1401 if (list_empty(&cx88q->active)) { 1406 if (list_empty(&cx88q->active)) {
1402 dprintk( 1, "queue is empty - first active\n" ); 1407 dprintk(1, "queue is empty - first active\n");
1403 list_add_tail(&buf->vb.queue, &cx88q->active); 1408 list_add_tail(&buf->vb.queue, &cx88q->active);
1404 cx23885_start_dma(port, cx88q, buf); 1409 cx23885_start_dma(port, cx88q, buf);
1405 buf->vb.state = VIDEOBUF_ACTIVE; 1410 buf->vb.state = VIDEOBUF_ACTIVE;
@@ -1408,7 +1413,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf)
1408 dprintk(1, "[%p/%d] %s - first active\n", 1413 dprintk(1, "[%p/%d] %s - first active\n",
1409 buf, buf->vb.i, __func__); 1414 buf, buf->vb.i, __func__);
1410 } else { 1415 } else {
1411 dprintk( 1, "queue is not empty - append to active\n" ); 1416 dprintk(1, "queue is not empty - append to active\n");
1412 prev = list_entry(cx88q->active.prev, struct cx23885_buffer, 1417 prev = list_entry(cx88q->active.prev, struct cx23885_buffer,
1413 vb.queue); 1418 vb.queue);
1414 list_add_tail(&buf->vb.queue, &cx88q->active); 1419 list_add_tail(&buf->vb.queue, &cx88q->active);
@@ -1416,7 +1421,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf)
1416 buf->count = cx88q->count++; 1421 buf->count = cx88q->count++;
1417 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); 1422 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
1418 prev->risc.jmp[2] = cpu_to_le32(0); /* 64 bit bits 63-32 */ 1423 prev->risc.jmp[2] = cpu_to_le32(0); /* 64 bit bits 63-32 */
1419 dprintk( 1, "[%p/%d] %s - append to active\n", 1424 dprintk(1, "[%p/%d] %s - append to active\n",
1420 buf, buf->vb.i, __func__); 1425 buf, buf->vb.i, __func__);
1421 } 1426 }
1422} 1427}
@@ -1442,7 +1447,7 @@ static void do_cancel_buffers(struct cx23885_tsport *port, char *reason,
1442 buf, buf->vb.i, reason, (unsigned long)buf->risc.dma); 1447 buf, buf->vb.i, reason, (unsigned long)buf->risc.dma);
1443 } 1448 }
1444 if (restart) { 1449 if (restart) {
1445 dprintk(1, "restarting queue\n" ); 1450 dprintk(1, "restarting queue\n");
1446 cx23885_restart_queue(port, q); 1451 cx23885_restart_queue(port, q);
1447 } 1452 }
1448 spin_unlock_irqrestore(&port->slock, flags); 1453 spin_unlock_irqrestore(&port->slock, flags);
@@ -1464,10 +1469,11 @@ static void cx23885_timeout(unsigned long data)
1464 struct cx23885_tsport *port = (struct cx23885_tsport *)data; 1469 struct cx23885_tsport *port = (struct cx23885_tsport *)data;
1465 struct cx23885_dev *dev = port->dev; 1470 struct cx23885_dev *dev = port->dev;
1466 1471
1467 dprintk(1, "%s()\n",__func__); 1472 dprintk(1, "%s()\n", __func__);
1468 1473
1469 if (debug > 5) 1474 if (debug > 5)
1470 cx23885_sram_channel_dump(dev, &dev->sram_channels[ port->sram_chno ]); 1475 cx23885_sram_channel_dump(dev,
1476 &dev->sram_channels[port->sram_chno]);
1471 1477
1472 cx23885_stop_dma(port); 1478 cx23885_stop_dma(port);
1473 do_cancel_buffers(port, "timeout", 1); 1479 do_cancel_buffers(port, "timeout", 1);
@@ -1543,16 +1549,23 @@ static int cx23885_irq_ts(struct cx23885_tsport *port, u32 status)
1543 if ((status & VID_BC_MSK_OPC_ERR) || 1549 if ((status & VID_BC_MSK_OPC_ERR) ||
1544 (status & VID_BC_MSK_BAD_PKT) || 1550 (status & VID_BC_MSK_BAD_PKT) ||
1545 (status & VID_BC_MSK_SYNC) || 1551 (status & VID_BC_MSK_SYNC) ||
1546 (status & VID_BC_MSK_OF)) 1552 (status & VID_BC_MSK_OF)) {
1547 { 1553
1548 if (status & VID_BC_MSK_OPC_ERR) 1554 if (status & VID_BC_MSK_OPC_ERR)
1549 dprintk(7, " (VID_BC_MSK_OPC_ERR 0x%08x)\n", VID_BC_MSK_OPC_ERR); 1555 dprintk(7, " (VID_BC_MSK_OPC_ERR 0x%08x)\n",
1556 VID_BC_MSK_OPC_ERR);
1557
1550 if (status & VID_BC_MSK_BAD_PKT) 1558 if (status & VID_BC_MSK_BAD_PKT)
1551 dprintk(7, " (VID_BC_MSK_BAD_PKT 0x%08x)\n", VID_BC_MSK_BAD_PKT); 1559 dprintk(7, " (VID_BC_MSK_BAD_PKT 0x%08x)\n",
1560 VID_BC_MSK_BAD_PKT);
1561
1552 if (status & VID_BC_MSK_SYNC) 1562 if (status & VID_BC_MSK_SYNC)
1553 dprintk(7, " (VID_BC_MSK_SYNC 0x%08x)\n", VID_BC_MSK_SYNC); 1563 dprintk(7, " (VID_BC_MSK_SYNC 0x%08x)\n",
1564 VID_BC_MSK_SYNC);
1565
1554 if (status & VID_BC_MSK_OF) 1566 if (status & VID_BC_MSK_OF)
1555 dprintk(7, " (VID_BC_MSK_OF 0x%08x)\n", VID_BC_MSK_OF); 1567 dprintk(7, " (VID_BC_MSK_OF 0x%08x)\n",
1568 VID_BC_MSK_OF);
1556 1569
1557 printk(KERN_ERR "%s: mpeg risc op code error\n", dev->name); 1570 printk(KERN_ERR "%s: mpeg risc op code error\n", dev->name);
1558 1571
@@ -1606,7 +1619,7 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id)
1606 ts2_status = cx_read(VID_C_INT_STAT); 1619 ts2_status = cx_read(VID_C_INT_STAT);
1607 ts2_mask = cx_read(VID_C_INT_MSK); 1620 ts2_mask = cx_read(VID_C_INT_MSK);
1608 1621
1609 if ( (pci_status == 0) && (ts2_status == 0) && (ts1_status == 0) ) 1622 if ((pci_status == 0) && (ts2_status == 0) && (ts1_status == 0))
1610 goto out; 1623 goto out;
1611 1624
1612 vida_count = cx_read(VID_A_GPCNT); 1625 vida_count = cx_read(VID_A_GPCNT);
@@ -1621,38 +1634,56 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id)
1621 dprintk(7, "ts2_status: 0x%08x ts2_mask: 0x%08x count: 0x%x\n", 1634 dprintk(7, "ts2_status: 0x%08x ts2_mask: 0x%08x count: 0x%x\n",
1622 ts2_status, ts2_mask, ts2_count); 1635 ts2_status, ts2_mask, ts2_count);
1623 1636
1624 if ( (pci_status & PCI_MSK_RISC_RD) || 1637 if ((pci_status & PCI_MSK_RISC_RD) ||
1625 (pci_status & PCI_MSK_RISC_WR) || 1638 (pci_status & PCI_MSK_RISC_WR) ||
1626 (pci_status & PCI_MSK_AL_RD) || 1639 (pci_status & PCI_MSK_AL_RD) ||
1627 (pci_status & PCI_MSK_AL_WR) || 1640 (pci_status & PCI_MSK_AL_WR) ||
1628 (pci_status & PCI_MSK_APB_DMA) || 1641 (pci_status & PCI_MSK_APB_DMA) ||
1629 (pci_status & PCI_MSK_VID_C) || 1642 (pci_status & PCI_MSK_VID_C) ||
1630 (pci_status & PCI_MSK_VID_B) || 1643 (pci_status & PCI_MSK_VID_B) ||
1631 (pci_status & PCI_MSK_VID_A) || 1644 (pci_status & PCI_MSK_VID_A) ||
1632 (pci_status & PCI_MSK_AUD_INT) || 1645 (pci_status & PCI_MSK_AUD_INT) ||
1633 (pci_status & PCI_MSK_AUD_EXT) ) 1646 (pci_status & PCI_MSK_AUD_EXT)) {
1634 {
1635 1647
1636 if (pci_status & PCI_MSK_RISC_RD) 1648 if (pci_status & PCI_MSK_RISC_RD)
1637 dprintk(7, " (PCI_MSK_RISC_RD 0x%08x)\n", PCI_MSK_RISC_RD); 1649 dprintk(7, " (PCI_MSK_RISC_RD 0x%08x)\n",
1650 PCI_MSK_RISC_RD);
1651
1638 if (pci_status & PCI_MSK_RISC_WR) 1652 if (pci_status & PCI_MSK_RISC_WR)
1639 dprintk(7, " (PCI_MSK_RISC_WR 0x%08x)\n", PCI_MSK_RISC_WR); 1653 dprintk(7, " (PCI_MSK_RISC_WR 0x%08x)\n",
1654 PCI_MSK_RISC_WR);
1655
1640 if (pci_status & PCI_MSK_AL_RD) 1656 if (pci_status & PCI_MSK_AL_RD)
1641 dprintk(7, " (PCI_MSK_AL_RD 0x%08x)\n", PCI_MSK_AL_RD); 1657 dprintk(7, " (PCI_MSK_AL_RD 0x%08x)\n",
1658 PCI_MSK_AL_RD);
1659
1642 if (pci_status & PCI_MSK_AL_WR) 1660 if (pci_status & PCI_MSK_AL_WR)
1643 dprintk(7, " (PCI_MSK_AL_WR 0x%08x)\n", PCI_MSK_AL_WR); 1661 dprintk(7, " (PCI_MSK_AL_WR 0x%08x)\n",
1662 PCI_MSK_AL_WR);
1663
1644 if (pci_status & PCI_MSK_APB_DMA) 1664 if (pci_status & PCI_MSK_APB_DMA)
1645 dprintk(7, " (PCI_MSK_APB_DMA 0x%08x)\n", PCI_MSK_APB_DMA); 1665 dprintk(7, " (PCI_MSK_APB_DMA 0x%08x)\n",
1666 PCI_MSK_APB_DMA);
1667
1646 if (pci_status & PCI_MSK_VID_C) 1668 if (pci_status & PCI_MSK_VID_C)
1647 dprintk(7, " (PCI_MSK_VID_C 0x%08x)\n", PCI_MSK_VID_C); 1669 dprintk(7, " (PCI_MSK_VID_C 0x%08x)\n",
1670 PCI_MSK_VID_C);
1671
1648 if (pci_status & PCI_MSK_VID_B) 1672 if (pci_status & PCI_MSK_VID_B)
1649 dprintk(7, " (PCI_MSK_VID_B 0x%08x)\n", PCI_MSK_VID_B); 1673 dprintk(7, " (PCI_MSK_VID_B 0x%08x)\n",
1674 PCI_MSK_VID_B);
1675
1650 if (pci_status & PCI_MSK_VID_A) 1676 if (pci_status & PCI_MSK_VID_A)
1651 dprintk(7, " (PCI_MSK_VID_A 0x%08x)\n", PCI_MSK_VID_A); 1677 dprintk(7, " (PCI_MSK_VID_A 0x%08x)\n",
1678 PCI_MSK_VID_A);
1679
1652 if (pci_status & PCI_MSK_AUD_INT) 1680 if (pci_status & PCI_MSK_AUD_INT)
1653 dprintk(7, " (PCI_MSK_AUD_INT 0x%08x)\n", PCI_MSK_AUD_INT); 1681 dprintk(7, " (PCI_MSK_AUD_INT 0x%08x)\n",
1682 PCI_MSK_AUD_INT);
1683
1654 if (pci_status & PCI_MSK_AUD_EXT) 1684 if (pci_status & PCI_MSK_AUD_EXT)
1655 dprintk(7, " (PCI_MSK_AUD_EXT 0x%08x)\n", PCI_MSK_AUD_EXT); 1685 dprintk(7, " (PCI_MSK_AUD_EXT 0x%08x)\n",
1686 PCI_MSK_AUD_EXT);
1656 1687
1657 } 1688 }
1658 1689
@@ -1764,13 +1795,13 @@ static struct pci_device_id cx23885_pci_tbl[] = {
1764 .device = 0x8852, 1795 .device = 0x8852,
1765 .subvendor = PCI_ANY_ID, 1796 .subvendor = PCI_ANY_ID,
1766 .subdevice = PCI_ANY_ID, 1797 .subdevice = PCI_ANY_ID,
1767 },{ 1798 }, {
1768 /* CX23887 Rev 2 */ 1799 /* CX23887 Rev 2 */
1769 .vendor = 0x14f1, 1800 .vendor = 0x14f1,
1770 .device = 0x8880, 1801 .device = 0x8880,
1771 .subvendor = PCI_ANY_ID, 1802 .subvendor = PCI_ANY_ID,
1772 .subdevice = PCI_ANY_ID, 1803 .subdevice = PCI_ANY_ID,
1773 },{ 1804 }, {
1774 /* --- end of list --- */ 1805 /* --- end of list --- */
1775 } 1806 }
1776}; 1807};
@@ -1808,9 +1839,3 @@ module_init(cx23885_init);
1808module_exit(cx23885_fini); 1839module_exit(cx23885_fini);
1809 1840
1810/* ----------------------------------------------------------- */ 1841/* ----------------------------------------------------------- */
1811/*
1812 * Local variables:
1813 * c-basic-offset: 8
1814 * End:
1815 * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off
1816 */
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index 9dfc96008551..8e9871106afa 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -78,19 +78,19 @@ static int dvb_buf_prepare(struct videobuf_queue *q,
78 struct videobuf_buffer *vb, enum v4l2_field field) 78 struct videobuf_buffer *vb, enum v4l2_field field)
79{ 79{
80 struct cx23885_tsport *port = q->priv_data; 80 struct cx23885_tsport *port = q->priv_data;
81 return cx23885_buf_prepare(q, port, (struct cx23885_buffer*)vb, field); 81 return cx23885_buf_prepare(q, port, (struct cx23885_buffer *)vb, field);
82} 82}
83 83
84static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) 84static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
85{ 85{
86 struct cx23885_tsport *port = q->priv_data; 86 struct cx23885_tsport *port = q->priv_data;
87 cx23885_buf_queue(port, (struct cx23885_buffer*)vb); 87 cx23885_buf_queue(port, (struct cx23885_buffer *)vb);
88} 88}
89 89
90static void dvb_buf_release(struct videobuf_queue *q, 90static void dvb_buf_release(struct videobuf_queue *q,
91 struct videobuf_buffer *vb) 91 struct videobuf_buffer *vb)
92{ 92{
93 cx23885_free_buffer(q, (struct cx23885_buffer*)vb); 93 cx23885_free_buffer(q, (struct cx23885_buffer *)vb);
94} 94}
95 95
96static struct videobuf_queue_ops dvb_qops = { 96static struct videobuf_queue_ops dvb_qops = {
@@ -450,7 +450,8 @@ static int dvb_register(struct cx23885_tsport *port)
450 .fname = XC3028L_DEFAULT_FIRMWARE, 450 .fname = XC3028L_DEFAULT_FIRMWARE,
451 .max_len = 64, 451 .max_len = 64,
452 .demod = 5000, 452 .demod = 5000,
453 /* This is true for all demods with v36 firmware? */ 453 /* This is true for all demods with
454 v36 firmware? */
454 .type = XC2028_D2633, 455 .type = XC2028_D2633,
455 }; 456 };
456 457
@@ -525,12 +526,14 @@ static int dvb_register(struct cx23885_tsport *port)
525 } 526 }
526 break; 527 break;
527 default: 528 default:
528 printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", 529 printk(KERN_INFO "%s: The frontend of your DVB/ATSC card "
530 " isn't supported yet\n",
529 dev->name); 531 dev->name);
530 break; 532 break;
531 } 533 }
532 if (NULL == fe0->dvb.frontend) { 534 if (NULL == fe0->dvb.frontend) {
533 printk("%s: frontend initialization failed\n", dev->name); 535 printk(KERN_ERR "%s: frontend initialization failed\n",
536 dev->name);
534 return -1; 537 return -1;
535 } 538 }
536 /* define general-purpose callback pointer */ 539 /* define general-purpose callback pointer */
@@ -568,7 +571,8 @@ int cx23885_dvb_register(struct cx23885_tsport *port)
568 port->num_frontends); 571 port->num_frontends);
569 572
570 for (i = 1; i <= port->num_frontends; i++) { 573 for (i = 1; i <= port->num_frontends; i++) {
571 if (videobuf_dvb_alloc_frontend(dev, &port->frontends, i) == NULL) { 574 if (videobuf_dvb_alloc_frontend(dev,
575 &port->frontends, i) == NULL) {
572 printk(KERN_ERR "%s() failed to alloc\n", __func__); 576 printk(KERN_ERR "%s() failed to alloc\n", __func__);
573 return -ENOMEM; 577 return -ENOMEM;
574 } 578 }
@@ -578,7 +582,7 @@ int cx23885_dvb_register(struct cx23885_tsport *port)
578 err = -EINVAL; 582 err = -EINVAL;
579 583
580 dprintk(1, "%s\n", __func__); 584 dprintk(1, "%s\n", __func__);
581 dprintk(1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", 585 dprintk(1, " ->probed by Card=%d Name=%s, PCI %02x:%02x\n",
582 dev->board, 586 dev->board,
583 dev->name, 587 dev->name,
584 dev->pci_bus, 588 dev->pci_bus,
@@ -588,14 +592,16 @@ int cx23885_dvb_register(struct cx23885_tsport *port)
588 592
589 /* dvb stuff */ 593 /* dvb stuff */
590 /* We have to init the queue for each frontend on a port. */ 594 /* We have to init the queue for each frontend on a port. */
591 printk("%s: cx23885 based dvb card\n", dev->name); 595 printk(KERN_INFO "%s: cx23885 based dvb card\n", dev->name);
592 videobuf_queue_sg_init(&fe0->dvb.dvbq, &dvb_qops, &dev->pci->dev, &port->slock, 596 videobuf_queue_sg_init(&fe0->dvb.dvbq, &dvb_qops,
597 &dev->pci->dev, &port->slock,
593 V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP, 598 V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP,
594 sizeof(struct cx23885_buffer), port); 599 sizeof(struct cx23885_buffer), port);
595 } 600 }
596 err = dvb_register(port); 601 err = dvb_register(port);
597 if (err != 0) 602 if (err != 0)
598 printk("%s() dvb_register failed err = %d\n", __func__, err); 603 printk(KERN_ERR "%s() dvb_register failed err = %d\n",
604 __func__, err);
599 605
600 return err; 606 return err;
601} 607}
@@ -612,15 +618,9 @@ int cx23885_dvb_unregister(struct cx23885_tsport *port)
612 * implement MFE support. 618 * implement MFE support.
613 */ 619 */
614 fe0 = videobuf_dvb_get_frontend(&port->frontends, 1); 620 fe0 = videobuf_dvb_get_frontend(&port->frontends, 1);
615 if(fe0->dvb.frontend) 621 if (fe0->dvb.frontend)
616 videobuf_dvb_unregister_bus(&port->frontends); 622 videobuf_dvb_unregister_bus(&port->frontends);
617 623
618 return 0; 624 return 0;
619} 625}
620 626
621/*
622 * Local variables:
623 * c-basic-offset: 8
624 * End:
625 * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off
626*/
diff --git a/drivers/media/video/cx23885/cx23885-i2c.c b/drivers/media/video/cx23885/cx23885-i2c.c
index f98e476e9617..bb7f71a1fcbe 100644
--- a/drivers/media/video/cx23885/cx23885-i2c.c
+++ b/drivers/media/video/cx23885/cx23885-i2c.c
@@ -131,7 +131,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
131 printk(" >\n"); 131 printk(" >\n");
132 } 132 }
133 133
134 for (cnt = 1; cnt < msg->len; cnt++ ) { 134 for (cnt = 1; cnt < msg->len; cnt++) {
135 /* following bytes */ 135 /* following bytes */
136 wdata = msg->buf[cnt]; 136 wdata = msg->buf[cnt];
137 ctrl = bus->i2c_period | (1 << 12) | (1 << 2); 137 ctrl = bus->i2c_period | (1 << 12) | (1 << 2);
@@ -151,9 +151,9 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
151 if (retval == 0) 151 if (retval == 0)
152 goto eio; 152 goto eio;
153 if (i2c_debug) { 153 if (i2c_debug) {
154 printk(" %02x", msg->buf[cnt]); 154 dprintk(1, " %02x", msg->buf[cnt]);
155 if (!(ctrl & I2C_NOSTOP)) 155 if (!(ctrl & I2C_NOSTOP))
156 printk(" >\n"); 156 dprintk(1, " >\n");
157 } 157 }
158 } 158 }
159 return msg->len; 159 return msg->len;
@@ -162,7 +162,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
162 retval = -EIO; 162 retval = -EIO;
163 err: 163 err:
164 if (i2c_debug) 164 if (i2c_debug)
165 printk(" ERR: %d\n", retval); 165 printk(KERN_ERR " ERR: %d\n", retval);
166 return retval; 166 return retval;
167} 167}
168 168
@@ -194,12 +194,12 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
194 194
195 if (i2c_debug) { 195 if (i2c_debug) {
196 if (joined) 196 if (joined)
197 printk(" R"); 197 dprintk(1, " R");
198 else 198 else
199 printk(" <R %02x", (msg->addr << 1) + 1); 199 dprintk(1, " <R %02x", (msg->addr << 1) + 1);
200 } 200 }
201 201
202 for(cnt = 0; cnt < msg->len; cnt++) { 202 for (cnt = 0; cnt < msg->len; cnt++) {
203 203
204 ctrl = bus->i2c_period | (1 << 12) | (1 << 2) | 1; 204 ctrl = bus->i2c_period | (1 << 12) | (1 << 2) | 1;
205 205
@@ -216,9 +216,9 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
216 goto eio; 216 goto eio;
217 msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff; 217 msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff;
218 if (i2c_debug) { 218 if (i2c_debug) {
219 printk(" %02x", msg->buf[cnt]); 219 dprintk(1, " %02x", msg->buf[cnt]);
220 if (!(ctrl & I2C_NOSTOP)) 220 if (!(ctrl & I2C_NOSTOP))
221 printk(" >\n"); 221 dprintk(1, " >\n");
222 } 222 }
223 } 223 }
224 return msg->len; 224 return msg->len;
@@ -227,7 +227,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
227 retval = -EIO; 227 retval = -EIO;
228 err: 228 err:
229 if (i2c_debug) 229 if (i2c_debug)
230 printk(" ERR: %d\n", retval); 230 printk(KERN_ERR " ERR: %d\n", retval);
231 return retval; 231 return retval;
232} 232}
233 233
@@ -353,17 +353,17 @@ 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", 356 [0x10 >> 1] = "tda10048",
357 [0x12 >> 1] = "dib7000pc", 357 [0x12 >> 1] = "dib7000pc",
358 [ 0x1c >> 1 ] = "lgdt3303", 358 [0x1c >> 1] = "lgdt3303",
359 [ 0x86 >> 1 ] = "tda9887", 359 [0x86 >> 1] = "tda9887",
360 [ 0x32 >> 1 ] = "cx24227", 360 [0x32 >> 1] = "cx24227",
361 [ 0x88 >> 1 ] = "cx25837", 361 [0x88 >> 1] = "cx25837",
362 [ 0x84 >> 1 ] = "tda8295", 362 [0x84 >> 1] = "tda8295",
363 [ 0xa0 >> 1 ] = "eeprom", 363 [0xa0 >> 1] = "eeprom",
364 [ 0xc0 >> 1 ] = "tuner/mt2131/tda8275", 364 [0xc0 >> 1] = "tuner/mt2131/tda8275",
365 [0xc2 >> 1] = "tuner/mt2131/tda8275/xc5000/xc3028", 365 [0xc2 >> 1] = "tuner/mt2131/tda8275/xc5000/xc3028",
366 [0xc8 >> 1] = "tuner/xc3028L", 366 [0xc8 >> 1] = "tuner/xc3028L",
367}; 367};
368 368
369static void do_i2c_scan(char *name, struct i2c_client *c) 369static void do_i2c_scan(char *name, struct i2c_client *c)
@@ -376,7 +376,7 @@ static void do_i2c_scan(char *name, struct i2c_client *c)
376 rc = i2c_master_recv(c, &buf, 0); 376 rc = i2c_master_recv(c, &buf, 0);
377 if (rc < 0) 377 if (rc < 0)
378 continue; 378 continue;
379 printk("%s: i2c scan: found device @ 0x%x [%s]\n", 379 printk(KERN_INFO "%s: i2c scan: found device @ 0x%x [%s]\n",
380 name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); 380 name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???");
381 } 381 }
382} 382}
@@ -408,11 +408,12 @@ int cx23885_i2c_register(struct cx23885_i2c *bus)
408 bus->i2c_client.adapter = &bus->i2c_adap; 408 bus->i2c_client.adapter = &bus->i2c_adap;
409 409
410 if (0 == bus->i2c_rc) { 410 if (0 == bus->i2c_rc) {
411 printk("%s: i2c bus %d registered\n", dev->name, bus->nr); 411 dprintk(1, "%s: i2c bus %d registered\n", dev->name, bus->nr);
412 if (i2c_scan) 412 if (i2c_scan)
413 do_i2c_scan(dev->name, &bus->i2c_client); 413 do_i2c_scan(dev->name, &bus->i2c_client);
414 } else 414 } else
415 printk("%s: i2c bus %d register FAILED\n", dev->name, bus->nr); 415 printk(KERN_WARNING "%s: i2c bus %d register FAILED\n",
416 dev->name, bus->nr);
416 417
417 return bus->i2c_rc; 418 return bus->i2c_rc;
418} 419}
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c
index f75ed1c9b71a..ab3110d6046c 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -285,11 +285,10 @@ static void cx23885_video_wakeup(struct cx23885_dev *dev,
285 list_del(&buf->vb.queue); 285 list_del(&buf->vb.queue);
286 wake_up(&buf->vb.done); 286 wake_up(&buf->vb.done);
287 } 287 }
288 if (list_empty(&q->active)) { 288 if (list_empty(&q->active))
289 del_timer(&q->timeout); 289 del_timer(&q->timeout);
290 } else { 290 else
291 mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); 291 mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT);
292 }
293 if (bc != 1) 292 if (bc != 1)
294 printk(KERN_ERR "%s: %d buffers handled (should be 1)\n", 293 printk(KERN_ERR "%s: %d buffers handled (should be 1)\n",
295 __func__, bc); 294 __func__, bc);
@@ -379,12 +378,12 @@ static int res_get(struct cx23885_dev *dev, struct cx23885_fh *fh,
379 378
380static int res_check(struct cx23885_fh *fh, unsigned int bit) 379static int res_check(struct cx23885_fh *fh, unsigned int bit)
381{ 380{
382 return (fh->resources & bit); 381 return fh->resources & bit;
383} 382}
384 383
385static int res_locked(struct cx23885_dev *dev, unsigned int bit) 384static int res_locked(struct cx23885_dev *dev, unsigned int bit)
386{ 385{
387 return (dev->resources & bit); 386 return dev->resources & bit;
388} 387}
389 388
390static void res_free(struct cx23885_dev *dev, struct cx23885_fh *fh, 389static void res_free(struct cx23885_dev *dev, struct cx23885_fh *fh,
@@ -887,14 +886,16 @@ static int video_mmap(struct file *file, struct vm_area_struct *vma)
887/* ------------------------------------------------------------------ */ 886/* ------------------------------------------------------------------ */
888/* VIDEO CTRL IOCTLS */ 887/* VIDEO CTRL IOCTLS */
889 888
890static int cx23885_get_control(struct cx23885_dev *dev, struct v4l2_control *ctl) 889static int cx23885_get_control(struct cx23885_dev *dev,
890 struct v4l2_control *ctl)
891{ 891{
892 dprintk(1, "%s() calling cx25840(VIDIOC_G_CTRL)\n", __func__); 892 dprintk(1, "%s() calling cx25840(VIDIOC_G_CTRL)\n", __func__);
893 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_G_CTRL, ctl); 893 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_G_CTRL, ctl);
894 return 0; 894 return 0;
895} 895}
896 896
897static int cx23885_set_control(struct cx23885_dev *dev, struct v4l2_control *ctl) 897static int cx23885_set_control(struct cx23885_dev *dev,
898 struct v4l2_control *ctl)
898{ 899{
899 dprintk(1, "%s() calling cx25840(VIDIOC_S_CTRL)" 900 dprintk(1, "%s() calling cx25840(VIDIOC_S_CTRL)"
900 " (disabled - no action)\n", __func__); 901 " (disabled - no action)\n", __func__);
@@ -1073,29 +1074,29 @@ static int vidioc_reqbufs(struct file *file, void *priv,
1073 struct v4l2_requestbuffers *p) 1074 struct v4l2_requestbuffers *p)
1074{ 1075{
1075 struct cx23885_fh *fh = priv; 1076 struct cx23885_fh *fh = priv;
1076 return (videobuf_reqbufs(get_queue(fh), p)); 1077 return videobuf_reqbufs(get_queue(fh), p);
1077} 1078}
1078 1079
1079static int vidioc_querybuf(struct file *file, void *priv, 1080static int vidioc_querybuf(struct file *file, void *priv,
1080 struct v4l2_buffer *p) 1081 struct v4l2_buffer *p)
1081{ 1082{
1082 struct cx23885_fh *fh = priv; 1083 struct cx23885_fh *fh = priv;
1083 return (videobuf_querybuf(get_queue(fh), p)); 1084 return videobuf_querybuf(get_queue(fh), p);
1084} 1085}
1085 1086
1086static int vidioc_qbuf(struct file *file, void *priv, 1087static int vidioc_qbuf(struct file *file, void *priv,
1087 struct v4l2_buffer *p) 1088 struct v4l2_buffer *p)
1088{ 1089{
1089 struct cx23885_fh *fh = priv; 1090 struct cx23885_fh *fh = priv;
1090 return (videobuf_qbuf(get_queue(fh), p)); 1091 return videobuf_qbuf(get_queue(fh), p);
1091} 1092}
1092 1093
1093static int vidioc_dqbuf(struct file *file, void *priv, 1094static int vidioc_dqbuf(struct file *file, void *priv,
1094 struct v4l2_buffer *p) 1095 struct v4l2_buffer *p)
1095{ 1096{
1096 struct cx23885_fh *fh = priv; 1097 struct cx23885_fh *fh = priv;
1097 return (videobuf_dqbuf(get_queue(fh), p, 1098 return videobuf_dqbuf(get_queue(fh), p,
1098 file->f_flags & O_NONBLOCK)); 1099 file->f_flags & O_NONBLOCK);
1099} 1100}
1100 1101
1101static int vidioc_streamon(struct file *file, void *priv, 1102static int vidioc_streamon(struct file *file, void *priv,
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h
index 73d5d5756aef..1d53f54cd943 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -37,7 +37,7 @@
37#include <linux/version.h> 37#include <linux/version.h>
38#include <linux/mutex.h> 38#include <linux/mutex.h>
39 39
40#define CX23885_VERSION_CODE KERNEL_VERSION(0,0,1) 40#define CX23885_VERSION_CODE KERNEL_VERSION(0, 0, 1)
41 41
42#define UNSET (-1U) 42#define UNSET (-1U)
43 43
@@ -370,14 +370,14 @@ struct sram_channel {
370/* ----------------------------------------------------------- */ 370/* ----------------------------------------------------------- */
371 371
372#define cx_read(reg) readl(dev->lmmio + ((reg)>>2)) 372#define cx_read(reg) readl(dev->lmmio + ((reg)>>2))
373#define cx_write(reg,value) writel((value), dev->lmmio + ((reg)>>2)) 373#define cx_write(reg, value) writel((value), dev->lmmio + ((reg)>>2))
374 374
375#define cx_andor(reg,mask,value) \ 375#define cx_andor(reg, mask, value) \
376 writel((readl(dev->lmmio+((reg)>>2)) & ~(mask)) |\ 376 writel((readl(dev->lmmio+((reg)>>2)) & ~(mask)) |\
377 ((value) & (mask)), dev->lmmio+((reg)>>2)) 377 ((value) & (mask)), dev->lmmio+((reg)>>2))
378 378
379#define cx_set(reg,bit) cx_andor((reg),(bit),(bit)) 379#define cx_set(reg, bit) cx_andor((reg), (bit), (bit))
380#define cx_clear(reg,bit) cx_andor((reg),(bit),0) 380#define cx_clear(reg, bit) cx_andor((reg), (bit), 0)
381 381
382/* ----------------------------------------------------------- */ 382/* ----------------------------------------------------------- */
383/* cx23885-core.c */ 383/* cx23885-core.c */
@@ -414,7 +414,8 @@ extern const unsigned int cx23885_bcount;
414extern struct cx23885_subid cx23885_subids[]; 414extern struct cx23885_subid cx23885_subids[];
415extern const unsigned int cx23885_idcount; 415extern const unsigned int cx23885_idcount;
416 416
417extern int cx23885_tuner_callback(void *priv, int component, int command, int arg); 417extern int cx23885_tuner_callback(void *priv, int component,
418 int command, int arg);
418extern void cx23885_card_list(struct cx23885_dev *dev); 419extern void cx23885_card_list(struct cx23885_dev *dev);
419extern int cx23885_ir_init(struct cx23885_dev *dev); 420extern int cx23885_ir_init(struct cx23885_dev *dev);
420extern void cx23885_gpio_setup(struct cx23885_dev *dev); 421extern void cx23885_gpio_setup(struct cx23885_dev *dev);
@@ -482,11 +483,3 @@ static inline unsigned int norm_swidth(v4l2_std_id norm)
482{ 483{
483 return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922; 484 return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922;
484} 485}
485
486
487/*
488 * Local variables:
489 * c-basic-offset: 8
490 * End:
491 * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off
492 */