diff options
author | Joe Perches <joe@perches.com> | 2011-08-21 18:56:44 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-09-03 19:54:14 -0400 |
commit | 44d0b80e5ff741d502a6ccc8685a18bda1ac9da4 (patch) | |
tree | b19473bcfeae86f0ab4ccc66e5bf18fea71fc896 | |
parent | 0b8bd83cf393832f1d00096b866d888b75b374c3 (diff) |
[media] saa7146: Use current logging styles
Standardize the mechanisms to emit logging messages.
A few other modules used an #include from saa7146,
convert those at the same time.
Add pr_fmt.
Convert printks to pr_<level>
Convert printks without KERN_<level> to appropriate pr_<level>.
Convert logging macros requiring multiple parentheses to normal style.
Removed embedded prefixes when pr_fmt was added.
Whitespace cleanups when around other conversions.
Use printf extension %pM to print mac address.
Coalesce format strings.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Michael Hunold <michael@mihu.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/common/saa7146_core.c | 74 | ||||
-rw-r--r-- | drivers/media/common/saa7146_fops.c | 118 | ||||
-rw-r--r-- | drivers/media/common/saa7146_hlp.c | 14 | ||||
-rw-r--r-- | drivers/media/common/saa7146_i2c.c | 60 | ||||
-rw-r--r-- | drivers/media/common/saa7146_vbi.c | 48 | ||||
-rw-r--r-- | drivers/media/common/saa7146_video.c | 171 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/av7110_v4l.c | 32 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-av.c | 42 | ||||
-rw-r--r-- | drivers/media/video/hexium_gemini.c | 42 | ||||
-rw-r--r-- | drivers/media/video/hexium_orion.c | 38 | ||||
-rw-r--r-- | drivers/media/video/mxb.c | 80 | ||||
-rw-r--r-- | include/media/saa7146.h | 36 |
12 files changed, 403 insertions, 352 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index 9af2140b57a4..f5d53a202344 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c | |||
@@ -18,6 +18,8 @@ | |||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
22 | |||
21 | #include <media/saa7146.h> | 23 | #include <media/saa7146.h> |
22 | 24 | ||
23 | LIST_HEAD(saa7146_devices); | 25 | LIST_HEAD(saa7146_devices); |
@@ -35,10 +37,9 @@ static void dump_registers(struct saa7146_dev* dev) | |||
35 | { | 37 | { |
36 | int i = 0; | 38 | int i = 0; |
37 | 39 | ||
38 | INFO((" @ %li jiffies:\n",jiffies)); | 40 | pr_info(" @ %li jiffies:\n", jiffies); |
39 | for(i = 0; i <= 0x148; i+=4) { | 41 | for (i = 0; i <= 0x148; i += 4) |
40 | printk("0x%03x: 0x%08x\n",i,saa7146_read(dev,i)); | 42 | pr_info("0x%03x: 0x%08x\n", i, saa7146_read(dev, i)); |
41 | } | ||
42 | } | 43 | } |
43 | #endif | 44 | #endif |
44 | 45 | ||
@@ -72,9 +73,8 @@ static inline int saa7146_wait_for_debi_done_sleep(struct saa7146_dev *dev, | |||
72 | if (saa7146_read(dev, MC2) & 2) | 73 | if (saa7146_read(dev, MC2) & 2) |
73 | break; | 74 | break; |
74 | if (err) { | 75 | if (err) { |
75 | printk(KERN_ERR "%s: %s timed out while waiting for " | 76 | pr_err("%s: %s timed out while waiting for registers getting programmed\n", |
76 | "registers getting programmed\n", | 77 | dev->name, __func__); |
77 | dev->name, __func__); | ||
78 | return -ETIMEDOUT; | 78 | return -ETIMEDOUT; |
79 | } | 79 | } |
80 | msleep(1); | 80 | msleep(1); |
@@ -88,8 +88,8 @@ static inline int saa7146_wait_for_debi_done_sleep(struct saa7146_dev *dev, | |||
88 | break; | 88 | break; |
89 | saa7146_read(dev, MC2); | 89 | saa7146_read(dev, MC2); |
90 | if (err) { | 90 | if (err) { |
91 | DEB_S(("%s: %s timed out while waiting for transfer " | 91 | DEB_S("%s: %s timed out while waiting for transfer completion\n", |
92 | "completion\n", dev->name, __func__)); | 92 | dev->name, __func__); |
93 | return -ETIMEDOUT; | 93 | return -ETIMEDOUT; |
94 | } | 94 | } |
95 | msleep(1); | 95 | msleep(1); |
@@ -109,9 +109,8 @@ static inline int saa7146_wait_for_debi_done_busyloop(struct saa7146_dev *dev, | |||
109 | if (saa7146_read(dev, MC2) & 2) | 109 | if (saa7146_read(dev, MC2) & 2) |
110 | break; | 110 | break; |
111 | if (!loops--) { | 111 | if (!loops--) { |
112 | printk(KERN_ERR "%s: %s timed out while waiting for " | 112 | pr_err("%s: %s timed out while waiting for registers getting programmed\n", |
113 | "registers getting programmed\n", | 113 | dev->name, __func__); |
114 | dev->name, __func__); | ||
115 | return -ETIMEDOUT; | 114 | return -ETIMEDOUT; |
116 | } | 115 | } |
117 | udelay(1); | 116 | udelay(1); |
@@ -124,8 +123,8 @@ static inline int saa7146_wait_for_debi_done_busyloop(struct saa7146_dev *dev, | |||
124 | break; | 123 | break; |
125 | saa7146_read(dev, MC2); | 124 | saa7146_read(dev, MC2); |
126 | if (!loops--) { | 125 | if (!loops--) { |
127 | DEB_S(("%s: %s timed out while waiting for transfer " | 126 | DEB_S("%s: %s timed out while waiting for transfer completion\n", |
128 | "completion\n", dev->name, __func__)); | 127 | dev->name, __func__); |
129 | return -ETIMEDOUT; | 128 | return -ETIMEDOUT; |
130 | } | 129 | } |
131 | udelay(5); | 130 | udelay(5); |
@@ -264,7 +263,9 @@ int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt | |||
264 | ptr = pt->cpu; | 263 | ptr = pt->cpu; |
265 | for (i = 0; i < sglen; i++, list++) { | 264 | for (i = 0; i < sglen; i++, list++) { |
266 | /* | 265 | /* |
267 | printk("i:%d, adr:0x%08x, len:%d, offset:%d\n", i,sg_dma_address(list), sg_dma_len(list), list->offset); | 266 | pr_debug("i:%d, adr:0x%08x, len:%d, offset:%d\n", |
267 | i, sg_dma_address(list), sg_dma_len(list), | ||
268 | list->offset); | ||
268 | */ | 269 | */ |
269 | for (p = 0; p * 4096 < list->length; p++, ptr++) { | 270 | for (p = 0; p * 4096 < list->length; p++, ptr++) { |
270 | *ptr = cpu_to_le32(sg_dma_address(list) + p * 4096); | 271 | *ptr = cpu_to_le32(sg_dma_address(list) + p * 4096); |
@@ -281,9 +282,9 @@ int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt | |||
281 | 282 | ||
282 | /* | 283 | /* |
283 | ptr = pt->cpu; | 284 | ptr = pt->cpu; |
284 | printk("offset: %d\n",pt->offset); | 285 | pr_debug("offset: %d\n", pt->offset); |
285 | for(i=0;i<5;i++) { | 286 | for(i=0;i<5;i++) { |
286 | printk("ptr1 %d: 0x%08x\n",i,ptr[i]); | 287 | pr_debug("ptr1 %d: 0x%08x\n", i, ptr[i]); |
287 | } | 288 | } |
288 | */ | 289 | */ |
289 | return 0; | 290 | return 0; |
@@ -314,7 +315,7 @@ static irqreturn_t interrupt_hw(int irq, void *dev_id) | |||
314 | } | 315 | } |
315 | } | 316 | } |
316 | if (0 != (isr & (MASK_27))) { | 317 | if (0 != (isr & (MASK_27))) { |
317 | DEB_INT(("irq: RPS0 (0x%08x).\n",isr)); | 318 | DEB_INT("irq: RPS0 (0x%08x)\n", isr); |
318 | if (dev->vv_data && dev->vv_callback) | 319 | if (dev->vv_data && dev->vv_callback) |
319 | dev->vv_callback(dev,isr); | 320 | dev->vv_callback(dev,isr); |
320 | isr &= ~MASK_27; | 321 | isr &= ~MASK_27; |
@@ -333,14 +334,15 @@ static irqreturn_t interrupt_hw(int irq, void *dev_id) | |||
333 | } else { | 334 | } else { |
334 | u32 psr = saa7146_read(dev, PSR); | 335 | u32 psr = saa7146_read(dev, PSR); |
335 | u32 ssr = saa7146_read(dev, SSR); | 336 | u32 ssr = saa7146_read(dev, SSR); |
336 | printk(KERN_WARNING "%s: unexpected i2c irq: isr %08x psr %08x ssr %08x\n", | 337 | pr_warn("%s: unexpected i2c irq: isr %08x psr %08x ssr %08x\n", |
337 | dev->name, isr, psr, ssr); | 338 | dev->name, isr, psr, ssr); |
338 | } | 339 | } |
339 | isr &= ~(MASK_16|MASK_17); | 340 | isr &= ~(MASK_16|MASK_17); |
340 | } | 341 | } |
341 | if( 0 != isr ) { | 342 | if( 0 != isr ) { |
342 | ERR(("warning: interrupt enabled, but not handled properly.(0x%08x)\n",isr)); | 343 | ERR("warning: interrupt enabled, but not handled properly.(0x%08x)\n", |
343 | ERR(("disabling interrupt source(s)!\n")); | 344 | isr); |
345 | ERR("disabling interrupt source(s)!\n"); | ||
344 | SAA7146_IER_DISABLE(dev,isr); | 346 | SAA7146_IER_DISABLE(dev,isr); |
345 | } | 347 | } |
346 | saa7146_write(dev, ISR, ack_isr); | 348 | saa7146_write(dev, ISR, ack_isr); |
@@ -360,15 +362,15 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent | |||
360 | /* clear out mem for sure */ | 362 | /* clear out mem for sure */ |
361 | dev = kzalloc(sizeof(struct saa7146_dev), GFP_KERNEL); | 363 | dev = kzalloc(sizeof(struct saa7146_dev), GFP_KERNEL); |
362 | if (!dev) { | 364 | if (!dev) { |
363 | ERR(("out of memory.\n")); | 365 | ERR("out of memory\n"); |
364 | goto out; | 366 | goto out; |
365 | } | 367 | } |
366 | 368 | ||
367 | DEB_EE(("pci:%p\n",pci)); | 369 | DEB_EE("pci:%p\n", pci); |
368 | 370 | ||
369 | err = pci_enable_device(pci); | 371 | err = pci_enable_device(pci); |
370 | if (err < 0) { | 372 | if (err < 0) { |
371 | ERR(("pci_enable_device() failed.\n")); | 373 | ERR("pci_enable_device() failed\n"); |
372 | goto err_free; | 374 | goto err_free; |
373 | } | 375 | } |
374 | 376 | ||
@@ -389,7 +391,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent | |||
389 | dev->mem = ioremap(pci_resource_start(pci, 0), | 391 | dev->mem = ioremap(pci_resource_start(pci, 0), |
390 | pci_resource_len(pci, 0)); | 392 | pci_resource_len(pci, 0)); |
391 | if (!dev->mem) { | 393 | if (!dev->mem) { |
392 | ERR(("ioremap() failed.\n")); | 394 | ERR("ioremap() failed\n"); |
393 | err = -ENODEV; | 395 | err = -ENODEV; |
394 | goto err_release; | 396 | goto err_release; |
395 | } | 397 | } |
@@ -414,7 +416,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent | |||
414 | err = request_irq(pci->irq, interrupt_hw, IRQF_SHARED | IRQF_DISABLED, | 416 | err = request_irq(pci->irq, interrupt_hw, IRQF_SHARED | IRQF_DISABLED, |
415 | dev->name, dev); | 417 | dev->name, dev); |
416 | if (err < 0) { | 418 | if (err < 0) { |
417 | ERR(("request_irq() failed.\n")); | 419 | ERR("request_irq() failed\n"); |
418 | goto err_unmap; | 420 | goto err_unmap; |
419 | } | 421 | } |
420 | 422 | ||
@@ -444,7 +446,9 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent | |||
444 | /* create a nice device name */ | 446 | /* create a nice device name */ |
445 | sprintf(dev->name, "saa7146 (%d)", saa7146_num); | 447 | sprintf(dev->name, "saa7146 (%d)", saa7146_num); |
446 | 448 | ||
447 | INFO(("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x).\n", dev->mem, dev->revision, pci->irq, pci->subsystem_vendor, pci->subsystem_device)); | 449 | pr_info("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x)\n", |
450 | dev->mem, dev->revision, pci->irq, | ||
451 | pci->subsystem_vendor, pci->subsystem_device); | ||
448 | dev->ext = ext; | 452 | dev->ext = ext; |
449 | 453 | ||
450 | mutex_init(&dev->v4l2_lock); | 454 | mutex_init(&dev->v4l2_lock); |
@@ -464,12 +468,12 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent | |||
464 | err = -ENODEV; | 468 | err = -ENODEV; |
465 | 469 | ||
466 | if (ext->probe && ext->probe(dev)) { | 470 | if (ext->probe && ext->probe(dev)) { |
467 | DEB_D(("ext->probe() failed for %p. skipping device.\n",dev)); | 471 | DEB_D("ext->probe() failed for %p. skipping device.\n", dev); |
468 | goto err_free_i2c; | 472 | goto err_free_i2c; |
469 | } | 473 | } |
470 | 474 | ||
471 | if (ext->attach(dev, pci_ext)) { | 475 | if (ext->attach(dev, pci_ext)) { |
472 | DEB_D(("ext->attach() failed for %p. skipping device.\n",dev)); | 476 | DEB_D("ext->attach() failed for %p. skipping device.\n", dev); |
473 | goto err_free_i2c; | 477 | goto err_free_i2c; |
474 | } | 478 | } |
475 | /* V4L extensions will set the pci drvdata to the v4l2_device in the | 479 | /* V4L extensions will set the pci drvdata to the v4l2_device in the |
@@ -521,7 +525,7 @@ static void saa7146_remove_one(struct pci_dev *pdev) | |||
521 | { NULL, 0 } | 525 | { NULL, 0 } |
522 | }, *p; | 526 | }, *p; |
523 | 527 | ||
524 | DEB_EE(("dev:%p\n",dev)); | 528 | DEB_EE("dev:%p\n", dev); |
525 | 529 | ||
526 | dev->ext->detach(dev); | 530 | dev->ext->detach(dev); |
527 | /* Zero the PCI drvdata after use. */ | 531 | /* Zero the PCI drvdata after use. */ |
@@ -552,21 +556,21 @@ static void saa7146_remove_one(struct pci_dev *pdev) | |||
552 | 556 | ||
553 | int saa7146_register_extension(struct saa7146_extension* ext) | 557 | int saa7146_register_extension(struct saa7146_extension* ext) |
554 | { | 558 | { |
555 | DEB_EE(("ext:%p\n",ext)); | 559 | DEB_EE("ext:%p\n", ext); |
556 | 560 | ||
557 | ext->driver.name = ext->name; | 561 | ext->driver.name = ext->name; |
558 | ext->driver.id_table = ext->pci_tbl; | 562 | ext->driver.id_table = ext->pci_tbl; |
559 | ext->driver.probe = saa7146_init_one; | 563 | ext->driver.probe = saa7146_init_one; |
560 | ext->driver.remove = saa7146_remove_one; | 564 | ext->driver.remove = saa7146_remove_one; |
561 | 565 | ||
562 | printk("saa7146: register extension '%s'.\n",ext->name); | 566 | pr_info("register extension '%s'\n", ext->name); |
563 | return pci_register_driver(&ext->driver); | 567 | return pci_register_driver(&ext->driver); |
564 | } | 568 | } |
565 | 569 | ||
566 | int saa7146_unregister_extension(struct saa7146_extension* ext) | 570 | int saa7146_unregister_extension(struct saa7146_extension* ext) |
567 | { | 571 | { |
568 | DEB_EE(("ext:%p\n",ext)); | 572 | DEB_EE("ext:%p\n", ext); |
569 | printk("saa7146: unregister extension '%s'.\n",ext->name); | 573 | pr_info("unregister extension '%s'\n", ext->name); |
570 | pci_unregister_driver(&ext->driver); | 574 | pci_unregister_driver(&ext->driver); |
571 | return 0; | 575 | return 0; |
572 | } | 576 | } |
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 1bd3dd762c6b..a92546144eaa 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
2 | |||
1 | #include <media/saa7146_vv.h> | 3 | #include <media/saa7146_vv.h> |
2 | 4 | ||
3 | /****************************************************************************/ | 5 | /****************************************************************************/ |
@@ -9,21 +11,23 @@ int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit) | |||
9 | struct saa7146_vv *vv = dev->vv_data; | 11 | struct saa7146_vv *vv = dev->vv_data; |
10 | 12 | ||
11 | if (fh->resources & bit) { | 13 | if (fh->resources & bit) { |
12 | DEB_D(("already allocated! want: 0x%02x, cur:0x%02x\n",bit,vv->resources)); | 14 | DEB_D("already allocated! want: 0x%02x, cur:0x%02x\n", |
15 | bit, vv->resources); | ||
13 | /* have it already allocated */ | 16 | /* have it already allocated */ |
14 | return 1; | 17 | return 1; |
15 | } | 18 | } |
16 | 19 | ||
17 | /* is it free? */ | 20 | /* is it free? */ |
18 | if (vv->resources & bit) { | 21 | if (vv->resources & bit) { |
19 | DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit)); | 22 | DEB_D("locked! vv->resources:0x%02x, we want:0x%02x\n", |
23 | vv->resources, bit); | ||
20 | /* no, someone else uses it */ | 24 | /* no, someone else uses it */ |
21 | return 0; | 25 | return 0; |
22 | } | 26 | } |
23 | /* it's free, grab it */ | 27 | /* it's free, grab it */ |
24 | fh->resources |= bit; | 28 | fh->resources |= bit; |
25 | vv->resources |= bit; | 29 | vv->resources |= bit; |
26 | DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources)); | 30 | DEB_D("res: get 0x%02x, cur:0x%02x\n", bit, vv->resources); |
27 | return 1; | 31 | return 1; |
28 | } | 32 | } |
29 | 33 | ||
@@ -34,9 +38,9 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits) | |||
34 | 38 | ||
35 | BUG_ON((fh->resources & bits) != bits); | 39 | BUG_ON((fh->resources & bits) != bits); |
36 | 40 | ||
37 | fh->resources &= ~bits; | 41 | fh->resources &= ~bits; |
38 | vv->resources &= ~bits; | 42 | vv->resources &= ~bits; |
39 | DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources)); | 43 | DEB_D("res: put 0x%02x, cur:0x%02x\n", bits, vv->resources); |
40 | } | 44 | } |
41 | 45 | ||
42 | 46 | ||
@@ -47,7 +51,7 @@ void saa7146_dma_free(struct saa7146_dev *dev,struct videobuf_queue *q, | |||
47 | struct saa7146_buf *buf) | 51 | struct saa7146_buf *buf) |
48 | { | 52 | { |
49 | struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); | 53 | struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); |
50 | DEB_EE(("dev:%p, buf:%p\n",dev,buf)); | 54 | DEB_EE("dev:%p, buf:%p\n", dev, buf); |
51 | 55 | ||
52 | BUG_ON(in_interrupt()); | 56 | BUG_ON(in_interrupt()); |
53 | 57 | ||
@@ -66,18 +70,19 @@ int saa7146_buffer_queue(struct saa7146_dev *dev, | |||
66 | struct saa7146_buf *buf) | 70 | struct saa7146_buf *buf) |
67 | { | 71 | { |
68 | assert_spin_locked(&dev->slock); | 72 | assert_spin_locked(&dev->slock); |
69 | DEB_EE(("dev:%p, dmaq:%p, buf:%p\n", dev, q, buf)); | 73 | DEB_EE("dev:%p, dmaq:%p, buf:%p\n", dev, q, buf); |
70 | 74 | ||
71 | BUG_ON(!q); | 75 | BUG_ON(!q); |
72 | 76 | ||
73 | if (NULL == q->curr) { | 77 | if (NULL == q->curr) { |
74 | q->curr = buf; | 78 | q->curr = buf; |
75 | DEB_D(("immediately activating buffer %p\n", buf)); | 79 | DEB_D("immediately activating buffer %p\n", buf); |
76 | buf->activate(dev,buf,NULL); | 80 | buf->activate(dev,buf,NULL); |
77 | } else { | 81 | } else { |
78 | list_add_tail(&buf->vb.queue,&q->queue); | 82 | list_add_tail(&buf->vb.queue,&q->queue); |
79 | buf->vb.state = VIDEOBUF_QUEUED; | 83 | buf->vb.state = VIDEOBUF_QUEUED; |
80 | DEB_D(("adding buffer %p to queue. (active buffer present)\n", buf)); | 84 | DEB_D("adding buffer %p to queue. (active buffer present)\n", |
85 | buf); | ||
81 | } | 86 | } |
82 | return 0; | 87 | return 0; |
83 | } | 88 | } |
@@ -87,14 +92,14 @@ void saa7146_buffer_finish(struct saa7146_dev *dev, | |||
87 | int state) | 92 | int state) |
88 | { | 93 | { |
89 | assert_spin_locked(&dev->slock); | 94 | assert_spin_locked(&dev->slock); |
90 | DEB_EE(("dev:%p, dmaq:%p, state:%d\n", dev, q, state)); | 95 | DEB_EE("dev:%p, dmaq:%p, state:%d\n", dev, q, state); |
91 | DEB_EE(("q->curr:%p\n",q->curr)); | 96 | DEB_EE("q->curr:%p\n", q->curr); |
92 | 97 | ||
93 | BUG_ON(!q->curr); | 98 | BUG_ON(!q->curr); |
94 | 99 | ||
95 | /* finish current buffer */ | 100 | /* finish current buffer */ |
96 | if (NULL == q->curr) { | 101 | if (NULL == q->curr) { |
97 | DEB_D(("aiii. no current buffer\n")); | 102 | DEB_D("aiii. no current buffer\n"); |
98 | return; | 103 | return; |
99 | } | 104 | } |
100 | 105 | ||
@@ -112,7 +117,7 @@ void saa7146_buffer_next(struct saa7146_dev *dev, | |||
112 | 117 | ||
113 | BUG_ON(!q); | 118 | BUG_ON(!q); |
114 | 119 | ||
115 | DEB_INT(("dev:%p, dmaq:%p, vbi:%d\n", dev, q, vbi)); | 120 | DEB_INT("dev:%p, dmaq:%p, vbi:%d\n", dev, q, vbi); |
116 | 121 | ||
117 | assert_spin_locked(&dev->slock); | 122 | assert_spin_locked(&dev->slock); |
118 | if (!list_empty(&q->queue)) { | 123 | if (!list_empty(&q->queue)) { |
@@ -122,10 +127,11 @@ void saa7146_buffer_next(struct saa7146_dev *dev, | |||
122 | if (!list_empty(&q->queue)) | 127 | if (!list_empty(&q->queue)) |
123 | next = list_entry(q->queue.next,struct saa7146_buf, vb.queue); | 128 | next = list_entry(q->queue.next,struct saa7146_buf, vb.queue); |
124 | q->curr = buf; | 129 | q->curr = buf; |
125 | DEB_INT(("next buffer: buf:%p, prev:%p, next:%p\n", buf, q->queue.prev,q->queue.next)); | 130 | DEB_INT("next buffer: buf:%p, prev:%p, next:%p\n", |
131 | buf, q->queue.prev, q->queue.next); | ||
126 | buf->activate(dev,buf,next); | 132 | buf->activate(dev,buf,next); |
127 | } else { | 133 | } else { |
128 | DEB_INT(("no next buffer. stopping.\n")); | 134 | DEB_INT("no next buffer. stopping.\n"); |
129 | if( 0 != vbi ) { | 135 | if( 0 != vbi ) { |
130 | /* turn off video-dma3 */ | 136 | /* turn off video-dma3 */ |
131 | saa7146_write(dev,MC1, MASK_20); | 137 | saa7146_write(dev,MC1, MASK_20); |
@@ -162,11 +168,11 @@ void saa7146_buffer_timeout(unsigned long data) | |||
162 | struct saa7146_dev *dev = q->dev; | 168 | struct saa7146_dev *dev = q->dev; |
163 | unsigned long flags; | 169 | unsigned long flags; |
164 | 170 | ||
165 | DEB_EE(("dev:%p, dmaq:%p\n", dev, q)); | 171 | DEB_EE("dev:%p, dmaq:%p\n", dev, q); |
166 | 172 | ||
167 | spin_lock_irqsave(&dev->slock,flags); | 173 | spin_lock_irqsave(&dev->slock,flags); |
168 | if (q->curr) { | 174 | if (q->curr) { |
169 | DEB_D(("timeout on %p\n", q->curr)); | 175 | DEB_D("timeout on %p\n", q->curr); |
170 | saa7146_buffer_finish(dev,q,VIDEOBUF_ERROR); | 176 | saa7146_buffer_finish(dev,q,VIDEOBUF_ERROR); |
171 | } | 177 | } |
172 | 178 | ||
@@ -194,12 +200,12 @@ static int fops_open(struct file *file) | |||
194 | 200 | ||
195 | enum v4l2_buf_type type; | 201 | enum v4l2_buf_type type; |
196 | 202 | ||
197 | DEB_EE(("file:%p, dev:%s\n", file, video_device_node_name(vdev))); | 203 | DEB_EE("file:%p, dev:%s\n", file, video_device_node_name(vdev)); |
198 | 204 | ||
199 | if (mutex_lock_interruptible(&saa7146_devices_lock)) | 205 | if (mutex_lock_interruptible(&saa7146_devices_lock)) |
200 | return -ERESTARTSYS; | 206 | return -ERESTARTSYS; |
201 | 207 | ||
202 | DEB_D(("using: %p\n",dev)); | 208 | DEB_D("using: %p\n", dev); |
203 | 209 | ||
204 | type = vdev->vfl_type == VFL_TYPE_GRABBER | 210 | type = vdev->vfl_type == VFL_TYPE_GRABBER |
205 | ? V4L2_BUF_TYPE_VIDEO_CAPTURE | 211 | ? V4L2_BUF_TYPE_VIDEO_CAPTURE |
@@ -207,7 +213,7 @@ static int fops_open(struct file *file) | |||
207 | 213 | ||
208 | /* check if an extension is registered */ | 214 | /* check if an extension is registered */ |
209 | if( NULL == dev->ext ) { | 215 | if( NULL == dev->ext ) { |
210 | DEB_S(("no extension registered for this device.\n")); | 216 | DEB_S("no extension registered for this device\n"); |
211 | result = -ENODEV; | 217 | result = -ENODEV; |
212 | goto out; | 218 | goto out; |
213 | } | 219 | } |
@@ -215,7 +221,7 @@ static int fops_open(struct file *file) | |||
215 | /* allocate per open data */ | 221 | /* allocate per open data */ |
216 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); | 222 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); |
217 | if (NULL == fh) { | 223 | if (NULL == fh) { |
218 | DEB_S(("cannot allocate memory for per open data.\n")); | 224 | DEB_S("cannot allocate memory for per open data\n"); |
219 | result = -ENOMEM; | 225 | result = -ENOMEM; |
220 | goto out; | 226 | goto out; |
221 | } | 227 | } |
@@ -225,13 +231,13 @@ static int fops_open(struct file *file) | |||
225 | fh->type = type; | 231 | fh->type = type; |
226 | 232 | ||
227 | if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | 233 | if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { |
228 | DEB_S(("initializing vbi...\n")); | 234 | DEB_S("initializing vbi...\n"); |
229 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) | 235 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) |
230 | result = saa7146_vbi_uops.open(dev,file); | 236 | result = saa7146_vbi_uops.open(dev,file); |
231 | if (dev->ext_vv_data->vbi_fops.open) | 237 | if (dev->ext_vv_data->vbi_fops.open) |
232 | dev->ext_vv_data->vbi_fops.open(file); | 238 | dev->ext_vv_data->vbi_fops.open(file); |
233 | } else { | 239 | } else { |
234 | DEB_S(("initializing video...\n")); | 240 | DEB_S("initializing video...\n"); |
235 | result = saa7146_video_uops.open(dev,file); | 241 | result = saa7146_video_uops.open(dev,file); |
236 | } | 242 | } |
237 | 243 | ||
@@ -259,7 +265,7 @@ static int fops_release(struct file *file) | |||
259 | struct saa7146_fh *fh = file->private_data; | 265 | struct saa7146_fh *fh = file->private_data; |
260 | struct saa7146_dev *dev = fh->dev; | 266 | struct saa7146_dev *dev = fh->dev; |
261 | 267 | ||
262 | DEB_EE(("file:%p\n", file)); | 268 | DEB_EE("file:%p\n", file); |
263 | 269 | ||
264 | if (mutex_lock_interruptible(&saa7146_devices_lock)) | 270 | if (mutex_lock_interruptible(&saa7146_devices_lock)) |
265 | return -ERESTARTSYS; | 271 | return -ERESTARTSYS; |
@@ -289,12 +295,14 @@ static int fops_mmap(struct file *file, struct vm_area_struct * vma) | |||
289 | 295 | ||
290 | switch (fh->type) { | 296 | switch (fh->type) { |
291 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: { | 297 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: { |
292 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, vma:%p\n",file, vma)); | 298 | DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, vma:%p\n", |
299 | file, vma); | ||
293 | q = &fh->video_q; | 300 | q = &fh->video_q; |
294 | break; | 301 | break; |
295 | } | 302 | } |
296 | case V4L2_BUF_TYPE_VBI_CAPTURE: { | 303 | case V4L2_BUF_TYPE_VBI_CAPTURE: { |
297 | DEB_EE(("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, vma:%p\n",file, vma)); | 304 | DEB_EE("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, vma:%p\n", |
305 | file, vma); | ||
298 | q = &fh->vbi_q; | 306 | q = &fh->vbi_q; |
299 | break; | 307 | break; |
300 | } | 308 | } |
@@ -312,14 +320,14 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) | |||
312 | struct videobuf_buffer *buf = NULL; | 320 | struct videobuf_buffer *buf = NULL; |
313 | struct videobuf_queue *q; | 321 | struct videobuf_queue *q; |
314 | 322 | ||
315 | DEB_EE(("file:%p, poll:%p\n",file, wait)); | 323 | DEB_EE("file:%p, poll:%p\n", file, wait); |
316 | 324 | ||
317 | if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { | 325 | if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { |
318 | if( 0 == fh->vbi_q.streaming ) | 326 | if( 0 == fh->vbi_q.streaming ) |
319 | return videobuf_poll_stream(file, &fh->vbi_q, wait); | 327 | return videobuf_poll_stream(file, &fh->vbi_q, wait); |
320 | q = &fh->vbi_q; | 328 | q = &fh->vbi_q; |
321 | } else { | 329 | } else { |
322 | DEB_D(("using video queue.\n")); | 330 | DEB_D("using video queue\n"); |
323 | q = &fh->video_q; | 331 | q = &fh->video_q; |
324 | } | 332 | } |
325 | 333 | ||
@@ -327,17 +335,17 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) | |||
327 | buf = list_entry(q->stream.next, struct videobuf_buffer, stream); | 335 | buf = list_entry(q->stream.next, struct videobuf_buffer, stream); |
328 | 336 | ||
329 | if (!buf) { | 337 | if (!buf) { |
330 | DEB_D(("buf == NULL!\n")); | 338 | DEB_D("buf == NULL!\n"); |
331 | return POLLERR; | 339 | return POLLERR; |
332 | } | 340 | } |
333 | 341 | ||
334 | poll_wait(file, &buf->done, wait); | 342 | poll_wait(file, &buf->done, wait); |
335 | if (buf->state == VIDEOBUF_DONE || buf->state == VIDEOBUF_ERROR) { | 343 | if (buf->state == VIDEOBUF_DONE || buf->state == VIDEOBUF_ERROR) { |
336 | DEB_D(("poll succeeded!\n")); | 344 | DEB_D("poll succeeded!\n"); |
337 | return POLLIN|POLLRDNORM; | 345 | return POLLIN|POLLRDNORM; |
338 | } | 346 | } |
339 | 347 | ||
340 | DEB_D(("nothing to poll for, buf->state:%d\n",buf->state)); | 348 | DEB_D("nothing to poll for, buf->state:%d\n", buf->state); |
341 | return 0; | 349 | return 0; |
342 | } | 350 | } |
343 | 351 | ||
@@ -346,18 +354,20 @@ static ssize_t fops_read(struct file *file, char __user *data, size_t count, lof | |||
346 | struct saa7146_fh *fh = file->private_data; | 354 | struct saa7146_fh *fh = file->private_data; |
347 | 355 | ||
348 | switch (fh->type) { | 356 | switch (fh->type) { |
349 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: { | 357 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
350 | // DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, data:%p, count:%lun", file, data, (unsigned long)count)); | 358 | /* |
359 | DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, data:%p, count:%lun", | ||
360 | file, data, (unsigned long)count); | ||
361 | */ | ||
351 | return saa7146_video_uops.read(file,data,count,ppos); | 362 | return saa7146_video_uops.read(file,data,count,ppos); |
352 | } | 363 | case V4L2_BUF_TYPE_VBI_CAPTURE: |
353 | case V4L2_BUF_TYPE_VBI_CAPTURE: { | 364 | /* |
354 | // DEB_EE(("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, data:%p, count:%lu\n", file, data, (unsigned long)count)); | 365 | DEB_EE("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, data:%p, count:%lu\n", |
366 | file, data, (unsigned long)count); | ||
367 | */ | ||
355 | if (fh->dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) | 368 | if (fh->dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) |
356 | return saa7146_vbi_uops.read(file,data,count,ppos); | 369 | return saa7146_vbi_uops.read(file,data,count,ppos); |
357 | else | 370 | return -EINVAL; |
358 | return -EINVAL; | ||
359 | } | ||
360 | break; | ||
361 | default: | 371 | default: |
362 | BUG(); | 372 | BUG(); |
363 | return 0; | 373 | return 0; |
@@ -398,22 +408,22 @@ static void vv_callback(struct saa7146_dev *dev, unsigned long status) | |||
398 | { | 408 | { |
399 | u32 isr = status; | 409 | u32 isr = status; |
400 | 410 | ||
401 | DEB_INT(("dev:%p, isr:0x%08x\n",dev,(u32)status)); | 411 | DEB_INT("dev:%p, isr:0x%08x\n", dev, (u32)status); |
402 | 412 | ||
403 | if (0 != (isr & (MASK_27))) { | 413 | if (0 != (isr & (MASK_27))) { |
404 | DEB_INT(("irq: RPS0 (0x%08x).\n",isr)); | 414 | DEB_INT("irq: RPS0 (0x%08x)\n", isr); |
405 | saa7146_video_uops.irq_done(dev,isr); | 415 | saa7146_video_uops.irq_done(dev,isr); |
406 | } | 416 | } |
407 | 417 | ||
408 | if (0 != (isr & (MASK_28))) { | 418 | if (0 != (isr & (MASK_28))) { |
409 | u32 mc2 = saa7146_read(dev, MC2); | 419 | u32 mc2 = saa7146_read(dev, MC2); |
410 | if( 0 != (mc2 & MASK_15)) { | 420 | if( 0 != (mc2 & MASK_15)) { |
411 | DEB_INT(("irq: RPS1 vbi workaround (0x%08x).\n",isr)); | 421 | DEB_INT("irq: RPS1 vbi workaround (0x%08x)\n", isr); |
412 | wake_up(&dev->vv_data->vbi_wq); | 422 | wake_up(&dev->vv_data->vbi_wq); |
413 | saa7146_write(dev,MC2, MASK_31); | 423 | saa7146_write(dev,MC2, MASK_31); |
414 | return; | 424 | return; |
415 | } | 425 | } |
416 | DEB_INT(("irq: RPS1 (0x%08x).\n",isr)); | 426 | DEB_INT("irq: RPS1 (0x%08x)\n", isr); |
417 | saa7146_vbi_uops.irq_done(dev,isr); | 427 | saa7146_vbi_uops.irq_done(dev,isr); |
418 | } | 428 | } |
419 | } | 429 | } |
@@ -429,13 +439,13 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) | |||
429 | 439 | ||
430 | vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL); | 440 | vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL); |
431 | if (vv == NULL) { | 441 | if (vv == NULL) { |
432 | ERR(("out of memory. aborting.\n")); | 442 | ERR("out of memory. aborting.\n"); |
433 | return -ENOMEM; | 443 | return -ENOMEM; |
434 | } | 444 | } |
435 | ext_vv->ops = saa7146_video_ioctl_ops; | 445 | ext_vv->ops = saa7146_video_ioctl_ops; |
436 | ext_vv->core_ops = &saa7146_video_ioctl_ops; | 446 | ext_vv->core_ops = &saa7146_video_ioctl_ops; |
437 | 447 | ||
438 | DEB_EE(("dev:%p\n",dev)); | 448 | DEB_EE("dev:%p\n", dev); |
439 | 449 | ||
440 | /* set default values for video parts of the saa7146 */ | 450 | /* set default values for video parts of the saa7146 */ |
441 | saa7146_write(dev, BCS_CTRL, 0x80400040); | 451 | saa7146_write(dev, BCS_CTRL, 0x80400040); |
@@ -450,7 +460,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) | |||
450 | 460 | ||
451 | vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle); | 461 | vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle); |
452 | if( NULL == vv->d_clipping.cpu_addr ) { | 462 | if( NULL == vv->d_clipping.cpu_addr ) { |
453 | ERR(("out of memory. aborting.\n")); | 463 | ERR("out of memory. aborting.\n"); |
454 | kfree(vv); | 464 | kfree(vv); |
455 | return -1; | 465 | return -1; |
456 | } | 466 | } |
@@ -471,7 +481,7 @@ int saa7146_vv_release(struct saa7146_dev* dev) | |||
471 | { | 481 | { |
472 | struct saa7146_vv *vv = dev->vv_data; | 482 | struct saa7146_vv *vv = dev->vv_data; |
473 | 483 | ||
474 | DEB_EE(("dev:%p\n",dev)); | 484 | DEB_EE("dev:%p\n", dev); |
475 | 485 | ||
476 | v4l2_device_unregister(&dev->v4l2_dev); | 486 | v4l2_device_unregister(&dev->v4l2_dev); |
477 | pci_free_consistent(dev->pci, SAA7146_CLIPPING_MEM, vv->d_clipping.cpu_addr, vv->d_clipping.dma_handle); | 487 | pci_free_consistent(dev->pci, SAA7146_CLIPPING_MEM, vv->d_clipping.cpu_addr, vv->d_clipping.dma_handle); |
@@ -490,7 +500,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, | |||
490 | int err; | 500 | int err; |
491 | int i; | 501 | int i; |
492 | 502 | ||
493 | DEB_EE(("dev:%p, name:'%s', type:%d\n",dev,name,type)); | 503 | DEB_EE("dev:%p, name:'%s', type:%d\n", dev, name, type); |
494 | 504 | ||
495 | // released by vfd->release | 505 | // released by vfd->release |
496 | vfd = video_device_alloc(); | 506 | vfd = video_device_alloc(); |
@@ -509,13 +519,13 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, | |||
509 | 519 | ||
510 | err = video_register_device(vfd, type, -1); | 520 | err = video_register_device(vfd, type, -1); |
511 | if (err < 0) { | 521 | if (err < 0) { |
512 | ERR(("cannot register v4l2 device. skipping.\n")); | 522 | ERR("cannot register v4l2 device. skipping.\n"); |
513 | video_device_release(vfd); | 523 | video_device_release(vfd); |
514 | return err; | 524 | return err; |
515 | } | 525 | } |
516 | 526 | ||
517 | INFO(("%s: registered device %s [v4l2]\n", | 527 | pr_info("%s: registered device %s [v4l2]\n", |
518 | dev->name, video_device_node_name(vfd))); | 528 | dev->name, video_device_node_name(vfd)); |
519 | 529 | ||
520 | *vid = vfd; | 530 | *vid = vfd; |
521 | return 0; | 531 | return 0; |
@@ -524,7 +534,7 @@ EXPORT_SYMBOL_GPL(saa7146_register_device); | |||
524 | 534 | ||
525 | int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) | 535 | int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) |
526 | { | 536 | { |
527 | DEB_EE(("dev:%p\n",dev)); | 537 | DEB_EE("dev:%p\n", dev); |
528 | 538 | ||
529 | video_unregister_device(*vid); | 539 | video_unregister_device(*vid); |
530 | *vid = NULL; | 540 | *vid = NULL; |
diff --git a/drivers/media/common/saa7146_hlp.c b/drivers/media/common/saa7146_hlp.c index 1d1d8d200755..79ad73accb27 100644 --- a/drivers/media/common/saa7146_hlp.c +++ b/drivers/media/common/saa7146_hlp.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
2 | |||
1 | #include <linux/kernel.h> | 3 | #include <linux/kernel.h> |
2 | #include <media/saa7146_vv.h> | 4 | #include <media/saa7146_vv.h> |
3 | 5 | ||
@@ -711,8 +713,8 @@ static int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa71 | |||
711 | 713 | ||
712 | int depth = sfmt->depth; | 714 | int depth = sfmt->depth; |
713 | 715 | ||
714 | DEB_CAP(("[size=%dx%d,fields=%s]\n", | 716 | DEB_CAP("[size=%dx%d,fields=%s]\n", |
715 | width,height,v4l2_field_names[field])); | 717 | width, height, v4l2_field_names[field]); |
716 | 718 | ||
717 | if( bytesperline != 0) { | 719 | if( bytesperline != 0) { |
718 | vdma1.pitch = bytesperline*2; | 720 | vdma1.pitch = bytesperline*2; |
@@ -837,8 +839,8 @@ static int calculate_video_dma_grab_planar(struct saa7146_dev* dev, struct saa71 | |||
837 | BUG_ON(0 == buf->pt[1].dma); | 839 | BUG_ON(0 == buf->pt[1].dma); |
838 | BUG_ON(0 == buf->pt[2].dma); | 840 | BUG_ON(0 == buf->pt[2].dma); |
839 | 841 | ||
840 | DEB_CAP(("[size=%dx%d,fields=%s]\n", | 842 | DEB_CAP("[size=%dx%d,fields=%s]\n", |
841 | width,height,v4l2_field_names[field])); | 843 | width, height, v4l2_field_names[field]); |
842 | 844 | ||
843 | /* fixme: look at bytesperline! */ | 845 | /* fixme: look at bytesperline! */ |
844 | 846 | ||
@@ -998,12 +1000,12 @@ void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struc | |||
998 | struct saa7146_vv *vv = dev->vv_data; | 1000 | struct saa7146_vv *vv = dev->vv_data; |
999 | u32 vdma1_prot_addr; | 1001 | u32 vdma1_prot_addr; |
1000 | 1002 | ||
1001 | DEB_CAP(("buf:%p, next:%p\n",buf,next)); | 1003 | DEB_CAP("buf:%p, next:%p\n", buf, next); |
1002 | 1004 | ||
1003 | vdma1_prot_addr = saa7146_read(dev, PROT_ADDR1); | 1005 | vdma1_prot_addr = saa7146_read(dev, PROT_ADDR1); |
1004 | if( 0 == vdma1_prot_addr ) { | 1006 | if( 0 == vdma1_prot_addr ) { |
1005 | /* clear out beginning of streaming bit (rps register 0)*/ | 1007 | /* clear out beginning of streaming bit (rps register 0)*/ |
1006 | DEB_CAP(("forcing sync to new frame\n")); | 1008 | DEB_CAP("forcing sync to new frame\n"); |
1007 | saa7146_write(dev, MC2, MASK_27 ); | 1009 | saa7146_write(dev, MC2, MASK_27 ); |
1008 | } | 1010 | } |
1009 | 1011 | ||
diff --git a/drivers/media/common/saa7146_i2c.c b/drivers/media/common/saa7146_i2c.c index b2ba9dc0dd6d..22027198129d 100644 --- a/drivers/media/common/saa7146_i2c.c +++ b/drivers/media/common/saa7146_i2c.c | |||
@@ -1,8 +1,10 @@ | |||
1 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
2 | |||
1 | #include <media/saa7146_vv.h> | 3 | #include <media/saa7146_vv.h> |
2 | 4 | ||
3 | static u32 saa7146_i2c_func(struct i2c_adapter *adapter) | 5 | static u32 saa7146_i2c_func(struct i2c_adapter *adapter) |
4 | { | 6 | { |
5 | //fm DEB_I2C(("'%s'.\n", adapter->name)); | 7 | /* DEB_I2C("'%s'\n", adapter->name); */ |
6 | 8 | ||
7 | return I2C_FUNC_I2C | 9 | return I2C_FUNC_I2C |
8 | | I2C_FUNC_SMBUS_QUICK | 10 | | I2C_FUNC_SMBUS_QUICK |
@@ -14,9 +16,7 @@ static u32 saa7146_i2c_func(struct i2c_adapter *adapter) | |||
14 | static inline u32 saa7146_i2c_status(struct saa7146_dev *dev) | 16 | static inline u32 saa7146_i2c_status(struct saa7146_dev *dev) |
15 | { | 17 | { |
16 | u32 iicsta = saa7146_read(dev, I2C_STATUS); | 18 | u32 iicsta = saa7146_read(dev, I2C_STATUS); |
17 | /* | 19 | /* DEB_I2C("status: 0x%08x\n", iicsta); */ |
18 | DEB_I2C(("status: 0x%08x\n",iicsta)); | ||
19 | */ | ||
20 | return iicsta; | 20 | return iicsta; |
21 | } | 21 | } |
22 | 22 | ||
@@ -39,10 +39,11 @@ static int saa7146_i2c_msg_prepare(const struct i2c_msg *m, int num, __le32 *op) | |||
39 | plus one extra byte to address the device */ | 39 | plus one extra byte to address the device */ |
40 | mem = 1 + ((mem-1) / 3); | 40 | mem = 1 + ((mem-1) / 3); |
41 | 41 | ||
42 | /* we assume that op points to a memory of at least SAA7146_I2C_MEM bytes | 42 | /* we assume that op points to a memory of at least |
43 | size. if we exceed this limit... */ | 43 | * SAA7146_I2C_MEM bytes size. if we exceed this limit... |
44 | if ( (4*mem) > SAA7146_I2C_MEM ) { | 44 | */ |
45 | //fm DEB_I2C(("cannot prepare i2c-message.\n")); | 45 | if ((4 * mem) > SAA7146_I2C_MEM) { |
46 | /* DEB_I2C("cannot prepare i2c-message\n"); */ | ||
46 | return -ENOMEM; | 47 | return -ENOMEM; |
47 | } | 48 | } |
48 | 49 | ||
@@ -123,7 +124,7 @@ static int saa7146_i2c_reset(struct saa7146_dev *dev) | |||
123 | if ( 0 != ( status & SAA7146_I2C_BUSY) ) { | 124 | if ( 0 != ( status & SAA7146_I2C_BUSY) ) { |
124 | 125 | ||
125 | /* yes, kill ongoing operation */ | 126 | /* yes, kill ongoing operation */ |
126 | DEB_I2C(("busy_state detected.\n")); | 127 | DEB_I2C("busy_state detected\n"); |
127 | 128 | ||
128 | /* set "ABORT-OPERATION"-bit (bit 7)*/ | 129 | /* set "ABORT-OPERATION"-bit (bit 7)*/ |
129 | saa7146_write(dev, I2C_STATUS, (dev->i2c_bitrate | MASK_07)); | 130 | saa7146_write(dev, I2C_STATUS, (dev->i2c_bitrate | MASK_07)); |
@@ -141,7 +142,7 @@ static int saa7146_i2c_reset(struct saa7146_dev *dev) | |||
141 | 142 | ||
142 | if ( dev->i2c_bitrate != status ) { | 143 | if ( dev->i2c_bitrate != status ) { |
143 | 144 | ||
144 | DEB_I2C(("error_state detected. status:0x%08x\n",status)); | 145 | DEB_I2C("error_state detected. status:0x%08x\n", status); |
145 | 146 | ||
146 | /* Repeat the abort operation. This seems to be necessary | 147 | /* Repeat the abort operation. This seems to be necessary |
147 | after serious protocol errors caused by e.g. the SAA7740 */ | 148 | after serious protocol errors caused by e.g. the SAA7740 */ |
@@ -164,7 +165,7 @@ static int saa7146_i2c_reset(struct saa7146_dev *dev) | |||
164 | /* if any error is still present, a fatal error has occurred ... */ | 165 | /* if any error is still present, a fatal error has occurred ... */ |
165 | status = saa7146_i2c_status(dev); | 166 | status = saa7146_i2c_status(dev); |
166 | if ( dev->i2c_bitrate != status ) { | 167 | if ( dev->i2c_bitrate != status ) { |
167 | DEB_I2C(("fatal error. status:0x%08x\n",status)); | 168 | DEB_I2C("fatal error. status:0x%08x\n", status); |
168 | return -1; | 169 | return -1; |
169 | } | 170 | } |
170 | 171 | ||
@@ -181,7 +182,8 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int shor | |||
181 | unsigned long timeout; | 182 | unsigned long timeout; |
182 | 183 | ||
183 | /* write out i2c-command */ | 184 | /* write out i2c-command */ |
184 | DEB_I2C(("before: 0x%08x (status: 0x%08x), %d\n",*dword,saa7146_read(dev, I2C_STATUS), dev->i2c_op)); | 185 | DEB_I2C("before: 0x%08x (status: 0x%08x), %d\n", |
186 | *dword, saa7146_read(dev, I2C_STATUS), dev->i2c_op); | ||
185 | 187 | ||
186 | if( 0 != (SAA7146_USE_I2C_IRQ & dev->ext->flags)) { | 188 | if( 0 != (SAA7146_USE_I2C_IRQ & dev->ext->flags)) { |
187 | 189 | ||
@@ -202,7 +204,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int shor | |||
202 | /* a signal arrived */ | 204 | /* a signal arrived */ |
203 | return -ERESTARTSYS; | 205 | return -ERESTARTSYS; |
204 | 206 | ||
205 | printk(KERN_WARNING "%s %s [irq]: timed out waiting for end of xfer\n", | 207 | pr_warn("%s %s [irq]: timed out waiting for end of xfer\n", |
206 | dev->name, __func__); | 208 | dev->name, __func__); |
207 | return -EIO; | 209 | return -EIO; |
208 | } | 210 | } |
@@ -220,7 +222,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int shor | |||
220 | break; | 222 | break; |
221 | } | 223 | } |
222 | if (time_after(jiffies,timeout)) { | 224 | if (time_after(jiffies,timeout)) { |
223 | printk(KERN_WARNING "%s %s: timed out waiting for MC2\n", | 225 | pr_warn("%s %s: timed out waiting for MC2\n", |
224 | dev->name, __func__); | 226 | dev->name, __func__); |
225 | return -EIO; | 227 | return -EIO; |
226 | } | 228 | } |
@@ -237,7 +239,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int shor | |||
237 | /* this is normal when probing the bus | 239 | /* this is normal when probing the bus |
238 | * (no answer from nonexisistant device...) | 240 | * (no answer from nonexisistant device...) |
239 | */ | 241 | */ |
240 | printk(KERN_WARNING "%s %s [poll]: timed out waiting for end of xfer\n", | 242 | pr_warn("%s %s [poll]: timed out waiting for end of xfer\n", |
241 | dev->name, __func__); | 243 | dev->name, __func__); |
242 | return -EIO; | 244 | return -EIO; |
243 | } | 245 | } |
@@ -257,24 +259,24 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int shor | |||
257 | if ( 0 == (status & SAA7146_I2C_ERR) || | 259 | if ( 0 == (status & SAA7146_I2C_ERR) || |
258 | 0 == (status & SAA7146_I2C_BUSY) ) { | 260 | 0 == (status & SAA7146_I2C_BUSY) ) { |
259 | /* it may take some time until ERR goes high - ignore */ | 261 | /* it may take some time until ERR goes high - ignore */ |
260 | DEB_I2C(("unexpected i2c status %04x\n", status)); | 262 | DEB_I2C("unexpected i2c status %04x\n", status); |
261 | } | 263 | } |
262 | if( 0 != (status & SAA7146_I2C_SPERR) ) { | 264 | if( 0 != (status & SAA7146_I2C_SPERR) ) { |
263 | DEB_I2C(("error due to invalid start/stop condition.\n")); | 265 | DEB_I2C("error due to invalid start/stop condition\n"); |
264 | } | 266 | } |
265 | if( 0 != (status & SAA7146_I2C_DTERR) ) { | 267 | if( 0 != (status & SAA7146_I2C_DTERR) ) { |
266 | DEB_I2C(("error in data transmission.\n")); | 268 | DEB_I2C("error in data transmission\n"); |
267 | } | 269 | } |
268 | if( 0 != (status & SAA7146_I2C_DRERR) ) { | 270 | if( 0 != (status & SAA7146_I2C_DRERR) ) { |
269 | DEB_I2C(("error when receiving data.\n")); | 271 | DEB_I2C("error when receiving data\n"); |
270 | } | 272 | } |
271 | if( 0 != (status & SAA7146_I2C_AL) ) { | 273 | if( 0 != (status & SAA7146_I2C_AL) ) { |
272 | DEB_I2C(("error because arbitration lost.\n")); | 274 | DEB_I2C("error because arbitration lost\n"); |
273 | } | 275 | } |
274 | 276 | ||
275 | /* we handle address-errors here */ | 277 | /* we handle address-errors here */ |
276 | if( 0 != (status & SAA7146_I2C_APERR) ) { | 278 | if( 0 != (status & SAA7146_I2C_APERR) ) { |
277 | DEB_I2C(("error in address phase.\n")); | 279 | DEB_I2C("error in address phase\n"); |
278 | return -EREMOTEIO; | 280 | return -EREMOTEIO; |
279 | } | 281 | } |
280 | 282 | ||
@@ -284,7 +286,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int shor | |||
284 | /* read back data, just in case we were reading ... */ | 286 | /* read back data, just in case we were reading ... */ |
285 | *dword = cpu_to_le32(saa7146_read(dev, I2C_TRANSFER)); | 287 | *dword = cpu_to_le32(saa7146_read(dev, I2C_TRANSFER)); |
286 | 288 | ||
287 | DEB_I2C(("after: 0x%08x\n",*dword)); | 289 | DEB_I2C("after: 0x%08x\n", *dword); |
288 | return 0; | 290 | return 0; |
289 | } | 291 | } |
290 | 292 | ||
@@ -299,7 +301,7 @@ static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *m | |||
299 | return -ERESTARTSYS; | 301 | return -ERESTARTSYS; |
300 | 302 | ||
301 | for(i=0;i<num;i++) { | 303 | for(i=0;i<num;i++) { |
302 | DEB_I2C(("msg:%d/%d\n",i+1,num)); | 304 | DEB_I2C("msg:%d/%d\n", i+1, num); |
303 | } | 305 | } |
304 | 306 | ||
305 | /* prepare the message(s), get number of u32s to transfer */ | 307 | /* prepare the message(s), get number of u32s to transfer */ |
@@ -316,7 +318,7 @@ static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *m | |||
316 | /* reset the i2c-device if necessary */ | 318 | /* reset the i2c-device if necessary */ |
317 | err = saa7146_i2c_reset(dev); | 319 | err = saa7146_i2c_reset(dev); |
318 | if ( 0 > err ) { | 320 | if ( 0 > err ) { |
319 | DEB_I2C(("could not reset i2c-device.\n")); | 321 | DEB_I2C("could not reset i2c-device\n"); |
320 | goto out; | 322 | goto out; |
321 | } | 323 | } |
322 | 324 | ||
@@ -336,7 +338,7 @@ static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *m | |||
336 | address error and trust the saa7146 address error detection. */ | 338 | address error and trust the saa7146 address error detection. */ |
337 | if (-EREMOTEIO == err && 0 != (SAA7146_USE_I2C_IRQ & dev->ext->flags)) | 339 | if (-EREMOTEIO == err && 0 != (SAA7146_USE_I2C_IRQ & dev->ext->flags)) |
338 | goto out; | 340 | goto out; |
339 | DEB_I2C(("error while sending message(s). starting again.\n")); | 341 | DEB_I2C("error while sending message(s). starting again\n"); |
340 | break; | 342 | break; |
341 | } | 343 | } |
342 | } | 344 | } |
@@ -356,13 +358,13 @@ static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *m | |||
356 | 358 | ||
357 | /* if any things had to be read, get the results */ | 359 | /* if any things had to be read, get the results */ |
358 | if ( 0 != saa7146_i2c_msg_cleanup(msgs, num, buffer)) { | 360 | if ( 0 != saa7146_i2c_msg_cleanup(msgs, num, buffer)) { |
359 | DEB_I2C(("could not cleanup i2c-message.\n")); | 361 | DEB_I2C("could not cleanup i2c-message\n"); |
360 | err = -1; | 362 | err = -1; |
361 | goto out; | 363 | goto out; |
362 | } | 364 | } |
363 | 365 | ||
364 | /* return the number of delivered messages */ | 366 | /* return the number of delivered messages */ |
365 | DEB_I2C(("transmission successful. (msg:%d).\n",err)); | 367 | DEB_I2C("transmission successful. (msg:%d)\n", err); |
366 | out: | 368 | out: |
367 | /* another bug in revision 0: the i2c-registers get uploaded randomly by other | 369 | /* another bug in revision 0: the i2c-registers get uploaded randomly by other |
368 | uploads, so we better clear them out before continuing */ | 370 | uploads, so we better clear them out before continuing */ |
@@ -370,7 +372,7 @@ out: | |||
370 | __le32 zero = 0; | 372 | __le32 zero = 0; |
371 | saa7146_i2c_reset(dev); | 373 | saa7146_i2c_reset(dev); |
372 | if( 0 != saa7146_i2c_writeout(dev, &zero, short_delay)) { | 374 | if( 0 != saa7146_i2c_writeout(dev, &zero, short_delay)) { |
373 | INFO(("revision 0 error. this should never happen.\n")); | 375 | pr_info("revision 0 error. this should never happen\n"); |
374 | } | 376 | } |
375 | } | 377 | } |
376 | 378 | ||
@@ -400,7 +402,7 @@ static struct i2c_algorithm saa7146_algo = { | |||
400 | 402 | ||
401 | int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate) | 403 | int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate) |
402 | { | 404 | { |
403 | DEB_EE(("bitrate: 0x%08x\n",bitrate)); | 405 | DEB_EE("bitrate: 0x%08x\n", bitrate); |
404 | 406 | ||
405 | /* enable i2c-port pins */ | 407 | /* enable i2c-port pins */ |
406 | saa7146_write(dev, MC1, (MASK_08 | MASK_24)); | 408 | saa7146_write(dev, MC1, (MASK_08 | MASK_24)); |
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c index afe85801d6ca..b2e718343739 100644 --- a/drivers/media/common/saa7146_vbi.c +++ b/drivers/media/common/saa7146_vbi.c | |||
@@ -14,7 +14,7 @@ static int vbi_workaround(struct saa7146_dev *dev) | |||
14 | 14 | ||
15 | DECLARE_WAITQUEUE(wait, current); | 15 | DECLARE_WAITQUEUE(wait, current); |
16 | 16 | ||
17 | DEB_VBI(("dev:%p\n",dev)); | 17 | DEB_VBI("dev:%p\n", dev); |
18 | 18 | ||
19 | /* once again, a bug in the saa7146: the brs acquisition | 19 | /* once again, a bug in the saa7146: the brs acquisition |
20 | is buggy and especially the BXO-counter does not work | 20 | is buggy and especially the BXO-counter does not work |
@@ -40,14 +40,14 @@ static int vbi_workaround(struct saa7146_dev *dev) | |||
40 | WRITE_RPS1(0xc000008c); | 40 | WRITE_RPS1(0xc000008c); |
41 | /* wait for vbi_a or vbi_b*/ | 41 | /* wait for vbi_a or vbi_b*/ |
42 | if ( 0 != (SAA7146_USE_PORT_B_FOR_VBI & dev->ext_vv_data->flags)) { | 42 | if ( 0 != (SAA7146_USE_PORT_B_FOR_VBI & dev->ext_vv_data->flags)) { |
43 | DEB_D(("...using port b\n")); | 43 | DEB_D("...using port b\n"); |
44 | WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | CMD_E_FID_B); | 44 | WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | CMD_E_FID_B); |
45 | WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | CMD_O_FID_B); | 45 | WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | CMD_O_FID_B); |
46 | /* | 46 | /* |
47 | WRITE_RPS1(CMD_PAUSE | MASK_09); | 47 | WRITE_RPS1(CMD_PAUSE | MASK_09); |
48 | */ | 48 | */ |
49 | } else { | 49 | } else { |
50 | DEB_D(("...using port a\n")); | 50 | DEB_D("...using port a\n"); |
51 | WRITE_RPS1(CMD_PAUSE | MASK_10); | 51 | WRITE_RPS1(CMD_PAUSE | MASK_10); |
52 | } | 52 | } |
53 | /* upload brs */ | 53 | /* upload brs */ |
@@ -103,7 +103,7 @@ static int vbi_workaround(struct saa7146_dev *dev) | |||
103 | 103 | ||
104 | schedule(); | 104 | schedule(); |
105 | 105 | ||
106 | DEB_VBI(("brs bug workaround %d/1.\n",i)); | 106 | DEB_VBI("brs bug workaround %d/1\n", i); |
107 | 107 | ||
108 | remove_wait_queue(&vv->vbi_wq, &wait); | 108 | remove_wait_queue(&vv->vbi_wq, &wait); |
109 | current->state = TASK_RUNNING; | 109 | current->state = TASK_RUNNING; |
@@ -116,7 +116,8 @@ static int vbi_workaround(struct saa7146_dev *dev) | |||
116 | 116 | ||
117 | if(signal_pending(current)) { | 117 | if(signal_pending(current)) { |
118 | 118 | ||
119 | DEB_VBI(("aborted (rps:0x%08x).\n",saa7146_read(dev,RPS_ADDR1))); | 119 | DEB_VBI("aborted (rps:0x%08x)\n", |
120 | saa7146_read(dev, RPS_ADDR1)); | ||
120 | 121 | ||
121 | /* stop rps1 for sure */ | 122 | /* stop rps1 for sure */ |
122 | saa7146_write(dev, MC1, MASK_29); | 123 | saa7146_write(dev, MC1, MASK_29); |
@@ -207,7 +208,7 @@ static int buffer_activate(struct saa7146_dev *dev, | |||
207 | struct saa7146_vv *vv = dev->vv_data; | 208 | struct saa7146_vv *vv = dev->vv_data; |
208 | buf->vb.state = VIDEOBUF_ACTIVE; | 209 | buf->vb.state = VIDEOBUF_ACTIVE; |
209 | 210 | ||
210 | DEB_VBI(("dev:%p, buf:%p, next:%p\n",dev,buf,next)); | 211 | DEB_VBI("dev:%p, buf:%p, next:%p\n", dev, buf, next); |
211 | saa7146_set_vbi_capture(dev,buf,next); | 212 | saa7146_set_vbi_capture(dev,buf,next); |
212 | 213 | ||
213 | mod_timer(&vv->vbi_q.timeout, jiffies+BUFFER_TIMEOUT); | 214 | mod_timer(&vv->vbi_q.timeout, jiffies+BUFFER_TIMEOUT); |
@@ -228,10 +229,10 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e | |||
228 | llength = vbi_pixel_to_capture; | 229 | llength = vbi_pixel_to_capture; |
229 | size = lines * llength; | 230 | size = lines * llength; |
230 | 231 | ||
231 | DEB_VBI(("vb:%p\n",vb)); | 232 | DEB_VBI("vb:%p\n", vb); |
232 | 233 | ||
233 | if (0 != buf->vb.baddr && buf->vb.bsize < size) { | 234 | if (0 != buf->vb.baddr && buf->vb.bsize < size) { |
234 | DEB_VBI(("size mismatch.\n")); | 235 | DEB_VBI("size mismatch\n"); |
235 | return -EINVAL; | 236 | return -EINVAL; |
236 | } | 237 | } |
237 | 238 | ||
@@ -263,7 +264,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e | |||
263 | return 0; | 264 | return 0; |
264 | 265 | ||
265 | oops: | 266 | oops: |
266 | DEB_VBI(("error out.\n")); | 267 | DEB_VBI("error out\n"); |
267 | saa7146_dma_free(dev,q,buf); | 268 | saa7146_dma_free(dev,q,buf); |
268 | 269 | ||
269 | return err; | 270 | return err; |
@@ -279,7 +280,7 @@ static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned | |||
279 | *size = lines * llength; | 280 | *size = lines * llength; |
280 | *count = 2; | 281 | *count = 2; |
281 | 282 | ||
282 | DEB_VBI(("count:%d, size:%d\n",*count,*size)); | 283 | DEB_VBI("count:%d, size:%d\n", *count, *size); |
283 | 284 | ||
284 | return 0; | 285 | return 0; |
285 | } | 286 | } |
@@ -292,7 +293,7 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
292 | struct saa7146_vv *vv = dev->vv_data; | 293 | struct saa7146_vv *vv = dev->vv_data; |
293 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; | 294 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; |
294 | 295 | ||
295 | DEB_VBI(("vb:%p\n",vb)); | 296 | DEB_VBI("vb:%p\n", vb); |
296 | saa7146_buffer_queue(dev,&vv->vbi_q,buf); | 297 | saa7146_buffer_queue(dev,&vv->vbi_q,buf); |
297 | } | 298 | } |
298 | 299 | ||
@@ -303,7 +304,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
303 | struct saa7146_dev *dev = fh->dev; | 304 | struct saa7146_dev *dev = fh->dev; |
304 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; | 305 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; |
305 | 306 | ||
306 | DEB_VBI(("vb:%p\n",vb)); | 307 | DEB_VBI("vb:%p\n", vb); |
307 | saa7146_dma_free(dev,q,buf); | 308 | saa7146_dma_free(dev,q,buf); |
308 | } | 309 | } |
309 | 310 | ||
@@ -321,7 +322,7 @@ static void vbi_stop(struct saa7146_fh *fh, struct file *file) | |||
321 | struct saa7146_dev *dev = fh->dev; | 322 | struct saa7146_dev *dev = fh->dev; |
322 | struct saa7146_vv *vv = dev->vv_data; | 323 | struct saa7146_vv *vv = dev->vv_data; |
323 | unsigned long flags; | 324 | unsigned long flags; |
324 | DEB_VBI(("dev:%p, fh:%p\n",dev, fh)); | 325 | DEB_VBI("dev:%p, fh:%p\n", dev, fh); |
325 | 326 | ||
326 | spin_lock_irqsave(&dev->slock,flags); | 327 | spin_lock_irqsave(&dev->slock,flags); |
327 | 328 | ||
@@ -354,14 +355,14 @@ static void vbi_read_timeout(unsigned long data) | |||
354 | struct saa7146_fh *fh = file->private_data; | 355 | struct saa7146_fh *fh = file->private_data; |
355 | struct saa7146_dev *dev = fh->dev; | 356 | struct saa7146_dev *dev = fh->dev; |
356 | 357 | ||
357 | DEB_VBI(("dev:%p, fh:%p\n",dev, fh)); | 358 | DEB_VBI("dev:%p, fh:%p\n", dev, fh); |
358 | 359 | ||
359 | vbi_stop(fh, file); | 360 | vbi_stop(fh, file); |
360 | } | 361 | } |
361 | 362 | ||
362 | static void vbi_init(struct saa7146_dev *dev, struct saa7146_vv *vv) | 363 | static void vbi_init(struct saa7146_dev *dev, struct saa7146_vv *vv) |
363 | { | 364 | { |
364 | DEB_VBI(("dev:%p\n",dev)); | 365 | DEB_VBI("dev:%p\n", dev); |
365 | 366 | ||
366 | INIT_LIST_HEAD(&vv->vbi_q.queue); | 367 | INIT_LIST_HEAD(&vv->vbi_q.queue); |
367 | 368 | ||
@@ -380,11 +381,11 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file) | |||
380 | u32 arbtr_ctrl = saa7146_read(dev, PCI_BT_V1); | 381 | u32 arbtr_ctrl = saa7146_read(dev, PCI_BT_V1); |
381 | int ret = 0; | 382 | int ret = 0; |
382 | 383 | ||
383 | DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); | 384 | DEB_VBI("dev:%p, fh:%p\n", dev, fh); |
384 | 385 | ||
385 | ret = saa7146_res_get(fh, RESOURCE_DMA3_BRS); | 386 | ret = saa7146_res_get(fh, RESOURCE_DMA3_BRS); |
386 | if (0 == ret) { | 387 | if (0 == ret) { |
387 | DEB_S(("cannot get vbi RESOURCE_DMA3_BRS resource\n")); | 388 | DEB_S("cannot get vbi RESOURCE_DMA3_BRS resource\n"); |
388 | return -EBUSY; | 389 | return -EBUSY; |
389 | } | 390 | } |
390 | 391 | ||
@@ -425,7 +426,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file) | |||
425 | saa7146_write(dev, BRS_CTRL, 0x00000001); | 426 | saa7146_write(dev, BRS_CTRL, 0x00000001); |
426 | 427 | ||
427 | if (0 != (ret = vbi_workaround(dev))) { | 428 | if (0 != (ret = vbi_workaround(dev))) { |
428 | DEB_VBI(("vbi workaround failed!\n")); | 429 | DEB_VBI("vbi workaround failed!\n"); |
429 | /* return ret;*/ | 430 | /* return ret;*/ |
430 | } | 431 | } |
431 | } | 432 | } |
@@ -439,7 +440,7 @@ static void vbi_close(struct saa7146_dev *dev, struct file *file) | |||
439 | { | 440 | { |
440 | struct saa7146_fh *fh = file->private_data; | 441 | struct saa7146_fh *fh = file->private_data; |
441 | struct saa7146_vv *vv = dev->vv_data; | 442 | struct saa7146_vv *vv = dev->vv_data; |
442 | DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); | 443 | DEB_VBI("dev:%p, fh:%p\n", dev, fh); |
443 | 444 | ||
444 | if( fh == vv->vbi_streaming ) { | 445 | if( fh == vv->vbi_streaming ) { |
445 | vbi_stop(fh, file); | 446 | vbi_stop(fh, file); |
@@ -453,13 +454,13 @@ static void vbi_irq_done(struct saa7146_dev *dev, unsigned long status) | |||
453 | spin_lock(&dev->slock); | 454 | spin_lock(&dev->slock); |
454 | 455 | ||
455 | if (vv->vbi_q.curr) { | 456 | if (vv->vbi_q.curr) { |
456 | DEB_VBI(("dev:%p, curr:%p\n",dev,vv->vbi_q.curr)); | 457 | DEB_VBI("dev:%p, curr:%p\n", dev, vv->vbi_q.curr); |
457 | /* this must be += 2, one count for each field */ | 458 | /* this must be += 2, one count for each field */ |
458 | vv->vbi_fieldcount+=2; | 459 | vv->vbi_fieldcount+=2; |
459 | vv->vbi_q.curr->vb.field_count = vv->vbi_fieldcount; | 460 | vv->vbi_q.curr->vb.field_count = vv->vbi_fieldcount; |
460 | saa7146_buffer_finish(dev,&vv->vbi_q,VIDEOBUF_DONE); | 461 | saa7146_buffer_finish(dev,&vv->vbi_q,VIDEOBUF_DONE); |
461 | } else { | 462 | } else { |
462 | DEB_VBI(("dev:%p\n",dev)); | 463 | DEB_VBI("dev:%p\n", dev); |
463 | } | 464 | } |
464 | saa7146_buffer_next(dev,&vv->vbi_q,1); | 465 | saa7146_buffer_next(dev,&vv->vbi_q,1); |
465 | 466 | ||
@@ -473,7 +474,7 @@ static ssize_t vbi_read(struct file *file, char __user *data, size_t count, loff | |||
473 | struct saa7146_vv *vv = dev->vv_data; | 474 | struct saa7146_vv *vv = dev->vv_data; |
474 | ssize_t ret = 0; | 475 | ssize_t ret = 0; |
475 | 476 | ||
476 | DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); | 477 | DEB_VBI("dev:%p, fh:%p\n", dev, fh); |
477 | 478 | ||
478 | if( NULL == vv->vbi_streaming ) { | 479 | if( NULL == vv->vbi_streaming ) { |
479 | // fixme: check if dma3 is available | 480 | // fixme: check if dma3 is available |
@@ -482,7 +483,8 @@ static ssize_t vbi_read(struct file *file, char __user *data, size_t count, loff | |||
482 | } | 483 | } |
483 | 484 | ||
484 | if( fh != vv->vbi_streaming ) { | 485 | if( fh != vv->vbi_streaming ) { |
485 | DEB_VBI(("open %p is already using vbi capture.",vv->vbi_streaming)); | 486 | DEB_VBI("open %p is already using vbi capture\n", |
487 | vv->vbi_streaming); | ||
486 | return -EBUSY; | 488 | return -EBUSY; |
487 | } | 489 | } |
488 | 490 | ||
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 9aafa4e969a8..fcdf4a00546d 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
2 | |||
1 | #include <media/saa7146_vv.h> | 3 | #include <media/saa7146_vv.h> |
2 | #include <media/v4l2-chip-ident.h> | 4 | #include <media/v4l2-chip-ident.h> |
3 | 5 | ||
@@ -94,7 +96,7 @@ struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fou | |||
94 | } | 96 | } |
95 | } | 97 | } |
96 | 98 | ||
97 | DEB_D(("unknown pixelformat:'%4.4s'\n",(char *)&fourcc)); | 99 | DEB_D("unknown pixelformat:'%4.4s'\n", (char *)&fourcc); |
98 | return NULL; | 100 | return NULL; |
99 | } | 101 | } |
100 | 102 | ||
@@ -107,32 +109,32 @@ int saa7146_start_preview(struct saa7146_fh *fh) | |||
107 | struct v4l2_format fmt; | 109 | struct v4l2_format fmt; |
108 | int ret = 0, err = 0; | 110 | int ret = 0, err = 0; |
109 | 111 | ||
110 | DEB_EE(("dev:%p, fh:%p\n",dev,fh)); | 112 | DEB_EE("dev:%p, fh:%p\n", dev, fh); |
111 | 113 | ||
112 | /* check if we have overlay informations */ | 114 | /* check if we have overlay informations */ |
113 | if( NULL == fh->ov.fh ) { | 115 | if( NULL == fh->ov.fh ) { |
114 | DEB_D(("no overlay data available. try S_FMT first.\n")); | 116 | DEB_D("no overlay data available. try S_FMT first.\n"); |
115 | return -EAGAIN; | 117 | return -EAGAIN; |
116 | } | 118 | } |
117 | 119 | ||
118 | /* check if streaming capture is running */ | 120 | /* check if streaming capture is running */ |
119 | if (IS_CAPTURE_ACTIVE(fh) != 0) { | 121 | if (IS_CAPTURE_ACTIVE(fh) != 0) { |
120 | DEB_D(("streaming capture is active.\n")); | 122 | DEB_D("streaming capture is active\n"); |
121 | return -EBUSY; | 123 | return -EBUSY; |
122 | } | 124 | } |
123 | 125 | ||
124 | /* check if overlay is running */ | 126 | /* check if overlay is running */ |
125 | if (IS_OVERLAY_ACTIVE(fh) != 0) { | 127 | if (IS_OVERLAY_ACTIVE(fh) != 0) { |
126 | if (vv->video_fh == fh) { | 128 | if (vv->video_fh == fh) { |
127 | DEB_D(("overlay is already active.\n")); | 129 | DEB_D("overlay is already active\n"); |
128 | return 0; | 130 | return 0; |
129 | } | 131 | } |
130 | DEB_D(("overlay is already active in another open.\n")); | 132 | DEB_D("overlay is already active in another open\n"); |
131 | return -EBUSY; | 133 | return -EBUSY; |
132 | } | 134 | } |
133 | 135 | ||
134 | if (0 == saa7146_res_get(fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP)) { | 136 | if (0 == saa7146_res_get(fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP)) { |
135 | DEB_D(("cannot get necessary overlay resources\n")); | 137 | DEB_D("cannot get necessary overlay resources\n"); |
136 | return -EBUSY; | 138 | return -EBUSY; |
137 | } | 139 | } |
138 | 140 | ||
@@ -145,13 +147,13 @@ int saa7146_start_preview(struct saa7146_fh *fh) | |||
145 | fh->ov.win = fmt.fmt.win; | 147 | fh->ov.win = fmt.fmt.win; |
146 | vv->ov_data = &fh->ov; | 148 | vv->ov_data = &fh->ov; |
147 | 149 | ||
148 | DEB_D(("%dx%d+%d+%d %s field=%s\n", | 150 | DEB_D("%dx%d+%d+%d %s field=%s\n", |
149 | fh->ov.win.w.width,fh->ov.win.w.height, | 151 | fh->ov.win.w.width, fh->ov.win.w.height, |
150 | fh->ov.win.w.left,fh->ov.win.w.top, | 152 | fh->ov.win.w.left, fh->ov.win.w.top, |
151 | vv->ov_fmt->name,v4l2_field_names[fh->ov.win.field])); | 153 | vv->ov_fmt->name, v4l2_field_names[fh->ov.win.field]); |
152 | 154 | ||
153 | if (0 != (ret = saa7146_enable_overlay(fh))) { | 155 | if (0 != (ret = saa7146_enable_overlay(fh))) { |
154 | DEB_D(("enabling overlay failed: %d\n",ret)); | 156 | DEB_D("enabling overlay failed: %d\n", ret); |
155 | saa7146_res_free(vv->video_fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP); | 157 | saa7146_res_free(vv->video_fh, RESOURCE_DMA1_HPS|RESOURCE_DMA2_CLP); |
156 | return ret; | 158 | return ret; |
157 | } | 159 | } |
@@ -168,22 +170,22 @@ int saa7146_stop_preview(struct saa7146_fh *fh) | |||
168 | struct saa7146_dev *dev = fh->dev; | 170 | struct saa7146_dev *dev = fh->dev; |
169 | struct saa7146_vv *vv = dev->vv_data; | 171 | struct saa7146_vv *vv = dev->vv_data; |
170 | 172 | ||
171 | DEB_EE(("dev:%p, fh:%p\n",dev,fh)); | 173 | DEB_EE("dev:%p, fh:%p\n", dev, fh); |
172 | 174 | ||
173 | /* check if streaming capture is running */ | 175 | /* check if streaming capture is running */ |
174 | if (IS_CAPTURE_ACTIVE(fh) != 0) { | 176 | if (IS_CAPTURE_ACTIVE(fh) != 0) { |
175 | DEB_D(("streaming capture is active.\n")); | 177 | DEB_D("streaming capture is active\n"); |
176 | return -EBUSY; | 178 | return -EBUSY; |
177 | } | 179 | } |
178 | 180 | ||
179 | /* check if overlay is running at all */ | 181 | /* check if overlay is running at all */ |
180 | if ((vv->video_status & STATUS_OVERLAY) == 0) { | 182 | if ((vv->video_status & STATUS_OVERLAY) == 0) { |
181 | DEB_D(("no active overlay.\n")); | 183 | DEB_D("no active overlay\n"); |
182 | return 0; | 184 | return 0; |
183 | } | 185 | } |
184 | 186 | ||
185 | if (vv->video_fh != fh) { | 187 | if (vv->video_fh != fh) { |
186 | DEB_D(("overlay is active, but in another open.\n")); | 188 | DEB_D("overlay is active, but in another open\n"); |
187 | return -EBUSY; | 189 | return -EBUSY; |
188 | } | 190 | } |
189 | 191 | ||
@@ -268,7 +270,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu | |||
268 | int length = dma->sglen; | 270 | int length = dma->sglen; |
269 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); | 271 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
270 | 272 | ||
271 | DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length)); | 273 | DEB_EE("dev:%p, buf:%p, sg_len:%d\n", dev, buf, length); |
272 | 274 | ||
273 | if( 0 != IS_PLANAR(sfmt->trans)) { | 275 | if( 0 != IS_PLANAR(sfmt->trans)) { |
274 | struct saa7146_pgtable *pt1 = &buf->pt[0]; | 276 | struct saa7146_pgtable *pt1 = &buf->pt[0]; |
@@ -288,7 +290,8 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu | |||
288 | m3 = ((size+(size/2)+PAGE_SIZE)/PAGE_SIZE)-1; | 290 | m3 = ((size+(size/2)+PAGE_SIZE)/PAGE_SIZE)-1; |
289 | o1 = size%PAGE_SIZE; | 291 | o1 = size%PAGE_SIZE; |
290 | o2 = (size+(size/4))%PAGE_SIZE; | 292 | o2 = (size+(size/4))%PAGE_SIZE; |
291 | DEB_CAP(("size:%d, m1:%d, m2:%d, m3:%d, o1:%d, o2:%d\n",size,m1,m2,m3,o1,o2)); | 293 | DEB_CAP("size:%d, m1:%d, m2:%d, m3:%d, o1:%d, o2:%d\n", |
294 | size, m1, m2, m3, o1, o2); | ||
292 | break; | 295 | break; |
293 | } | 296 | } |
294 | case 16: { | 297 | case 16: { |
@@ -298,7 +301,8 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu | |||
298 | m3 = ((2*size+PAGE_SIZE)/PAGE_SIZE)-1; | 301 | m3 = ((2*size+PAGE_SIZE)/PAGE_SIZE)-1; |
299 | o1 = size%PAGE_SIZE; | 302 | o1 = size%PAGE_SIZE; |
300 | o2 = (size+(size/2))%PAGE_SIZE; | 303 | o2 = (size+(size/2))%PAGE_SIZE; |
301 | DEB_CAP(("size:%d, m1:%d, m2:%d, m3:%d, o1:%d, o2:%d\n",size,m1,m2,m3,o1,o2)); | 304 | DEB_CAP("size:%d, m1:%d, m2:%d, m3:%d, o1:%d, o2:%d\n", |
305 | size, m1, m2, m3, o1, o2); | ||
302 | break; | 306 | break; |
303 | } | 307 | } |
304 | default: { | 308 | default: { |
@@ -387,23 +391,23 @@ static int video_begin(struct saa7146_fh *fh) | |||
387 | unsigned int resource; | 391 | unsigned int resource; |
388 | int ret = 0, err = 0; | 392 | int ret = 0, err = 0; |
389 | 393 | ||
390 | DEB_EE(("dev:%p, fh:%p\n",dev,fh)); | 394 | DEB_EE("dev:%p, fh:%p\n", dev, fh); |
391 | 395 | ||
392 | if ((vv->video_status & STATUS_CAPTURE) != 0) { | 396 | if ((vv->video_status & STATUS_CAPTURE) != 0) { |
393 | if (vv->video_fh == fh) { | 397 | if (vv->video_fh == fh) { |
394 | DEB_S(("already capturing.\n")); | 398 | DEB_S("already capturing\n"); |
395 | return 0; | 399 | return 0; |
396 | } | 400 | } |
397 | DEB_S(("already capturing in another open.\n")); | 401 | DEB_S("already capturing in another open\n"); |
398 | return -EBUSY; | 402 | return -EBUSY; |
399 | } | 403 | } |
400 | 404 | ||
401 | if ((vv->video_status & STATUS_OVERLAY) != 0) { | 405 | if ((vv->video_status & STATUS_OVERLAY) != 0) { |
402 | DEB_S(("warning: suspending overlay video for streaming capture.\n")); | 406 | DEB_S("warning: suspending overlay video for streaming capture\n"); |
403 | vv->ov_suspend = vv->video_fh; | 407 | vv->ov_suspend = vv->video_fh; |
404 | err = saa7146_stop_preview(vv->video_fh); /* side effect: video_status is now 0, video_fh is NULL */ | 408 | err = saa7146_stop_preview(vv->video_fh); /* side effect: video_status is now 0, video_fh is NULL */ |
405 | if (0 != err) { | 409 | if (0 != err) { |
406 | DEB_D(("suspending video failed. aborting\n")); | 410 | DEB_D("suspending video failed. aborting\n"); |
407 | return err; | 411 | return err; |
408 | } | 412 | } |
409 | } | 413 | } |
@@ -420,7 +424,7 @@ static int video_begin(struct saa7146_fh *fh) | |||
420 | 424 | ||
421 | ret = saa7146_res_get(fh, resource); | 425 | ret = saa7146_res_get(fh, resource); |
422 | if (0 == ret) { | 426 | if (0 == ret) { |
423 | DEB_S(("cannot get capture resource %d\n",resource)); | 427 | DEB_S("cannot get capture resource %d\n", resource); |
424 | if (vv->ov_suspend != NULL) { | 428 | if (vv->ov_suspend != NULL) { |
425 | saa7146_start_preview(vv->ov_suspend); | 429 | saa7146_start_preview(vv->ov_suspend); |
426 | vv->ov_suspend = NULL; | 430 | vv->ov_suspend = NULL; |
@@ -448,15 +452,15 @@ static int video_end(struct saa7146_fh *fh, struct file *file) | |||
448 | unsigned long flags; | 452 | unsigned long flags; |
449 | unsigned int resource; | 453 | unsigned int resource; |
450 | u32 dmas = 0; | 454 | u32 dmas = 0; |
451 | DEB_EE(("dev:%p, fh:%p\n",dev,fh)); | 455 | DEB_EE("dev:%p, fh:%p\n", dev, fh); |
452 | 456 | ||
453 | if ((vv->video_status & STATUS_CAPTURE) != STATUS_CAPTURE) { | 457 | if ((vv->video_status & STATUS_CAPTURE) != STATUS_CAPTURE) { |
454 | DEB_S(("not capturing.\n")); | 458 | DEB_S("not capturing\n"); |
455 | return 0; | 459 | return 0; |
456 | } | 460 | } |
457 | 461 | ||
458 | if (vv->video_fh != fh) { | 462 | if (vv->video_fh != fh) { |
459 | DEB_S(("capturing, but in another open.\n")); | 463 | DEB_S("capturing, but in another open\n"); |
460 | return -EBUSY; | 464 | return -EBUSY; |
461 | } | 465 | } |
462 | 466 | ||
@@ -530,7 +534,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f | |||
530 | struct saa7146_vv *vv = dev->vv_data; | 534 | struct saa7146_vv *vv = dev->vv_data; |
531 | struct saa7146_format *fmt; | 535 | struct saa7146_format *fmt; |
532 | 536 | ||
533 | DEB_EE(("VIDIOC_S_FBUF\n")); | 537 | DEB_EE("VIDIOC_S_FBUF\n"); |
534 | 538 | ||
535 | if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RAWIO)) | 539 | if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RAWIO)) |
536 | return -EPERM; | 540 | return -EPERM; |
@@ -542,13 +546,13 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f | |||
542 | 546 | ||
543 | /* planar formats are not allowed for overlay video, clipping and video dma would clash */ | 547 | /* planar formats are not allowed for overlay video, clipping and video dma would clash */ |
544 | if (fmt->flags & FORMAT_IS_PLANAR) | 548 | if (fmt->flags & FORMAT_IS_PLANAR) |
545 | DEB_S(("planar pixelformat '%4.4s' not allowed for overlay\n", | 549 | DEB_S("planar pixelformat '%4.4s' not allowed for overlay\n", |
546 | (char *)&fmt->pixelformat)); | 550 | (char *)&fmt->pixelformat); |
547 | 551 | ||
548 | /* check if overlay is running */ | 552 | /* check if overlay is running */ |
549 | if (IS_OVERLAY_ACTIVE(fh) != 0) { | 553 | if (IS_OVERLAY_ACTIVE(fh) != 0) { |
550 | if (vv->video_fh != fh) { | 554 | if (vv->video_fh != fh) { |
551 | DEB_D(("refusing to change framebuffer informations while overlay is active in another open.\n")); | 555 | DEB_D("refusing to change framebuffer informations while overlay is active in another open\n"); |
552 | return -EBUSY; | 556 | return -EBUSY; |
553 | } | 557 | } |
554 | } | 558 | } |
@@ -559,7 +563,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f | |||
559 | 563 | ||
560 | if (vv->ov_fb.fmt.bytesperline < vv->ov_fb.fmt.width) { | 564 | if (vv->ov_fb.fmt.bytesperline < vv->ov_fb.fmt.width) { |
561 | vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8; | 565 | vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8; |
562 | DEB_D(("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline)); | 566 | DEB_D("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline); |
563 | } | 567 | } |
564 | return 0; | 568 | return 0; |
565 | } | 569 | } |
@@ -588,7 +592,7 @@ static int vidioc_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl * | |||
588 | if (ctrl == NULL) | 592 | if (ctrl == NULL) |
589 | return -EINVAL; | 593 | return -EINVAL; |
590 | 594 | ||
591 | DEB_EE(("VIDIOC_QUERYCTRL: id:%d\n", c->id)); | 595 | DEB_EE("VIDIOC_QUERYCTRL: id:%d\n", c->id); |
592 | *c = *ctrl; | 596 | *c = *ctrl; |
593 | return 0; | 597 | return 0; |
594 | } | 598 | } |
@@ -607,25 +611,25 @@ static int vidioc_g_ctrl(struct file *file, void *fh, struct v4l2_control *c) | |||
607 | case V4L2_CID_BRIGHTNESS: | 611 | case V4L2_CID_BRIGHTNESS: |
608 | value = saa7146_read(dev, BCS_CTRL); | 612 | value = saa7146_read(dev, BCS_CTRL); |
609 | c->value = 0xff & (value >> 24); | 613 | c->value = 0xff & (value >> 24); |
610 | DEB_D(("V4L2_CID_BRIGHTNESS: %d\n", c->value)); | 614 | DEB_D("V4L2_CID_BRIGHTNESS: %d\n", c->value); |
611 | break; | 615 | break; |
612 | case V4L2_CID_CONTRAST: | 616 | case V4L2_CID_CONTRAST: |
613 | value = saa7146_read(dev, BCS_CTRL); | 617 | value = saa7146_read(dev, BCS_CTRL); |
614 | c->value = 0x7f & (value >> 16); | 618 | c->value = 0x7f & (value >> 16); |
615 | DEB_D(("V4L2_CID_CONTRAST: %d\n", c->value)); | 619 | DEB_D("V4L2_CID_CONTRAST: %d\n", c->value); |
616 | break; | 620 | break; |
617 | case V4L2_CID_SATURATION: | 621 | case V4L2_CID_SATURATION: |
618 | value = saa7146_read(dev, BCS_CTRL); | 622 | value = saa7146_read(dev, BCS_CTRL); |
619 | c->value = 0x7f & (value >> 0); | 623 | c->value = 0x7f & (value >> 0); |
620 | DEB_D(("V4L2_CID_SATURATION: %d\n", c->value)); | 624 | DEB_D("V4L2_CID_SATURATION: %d\n", c->value); |
621 | break; | 625 | break; |
622 | case V4L2_CID_VFLIP: | 626 | case V4L2_CID_VFLIP: |
623 | c->value = vv->vflip; | 627 | c->value = vv->vflip; |
624 | DEB_D(("V4L2_CID_VFLIP: %d\n", c->value)); | 628 | DEB_D("V4L2_CID_VFLIP: %d\n", c->value); |
625 | break; | 629 | break; |
626 | case V4L2_CID_HFLIP: | 630 | case V4L2_CID_HFLIP: |
627 | c->value = vv->hflip; | 631 | c->value = vv->hflip; |
628 | DEB_D(("V4L2_CID_HFLIP: %d\n", c->value)); | 632 | DEB_D("V4L2_CID_HFLIP: %d\n", c->value); |
629 | break; | 633 | break; |
630 | default: | 634 | default: |
631 | return -EINVAL; | 635 | return -EINVAL; |
@@ -641,7 +645,7 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c) | |||
641 | 645 | ||
642 | ctrl = ctrl_by_id(c->id); | 646 | ctrl = ctrl_by_id(c->id); |
643 | if (NULL == ctrl) { | 647 | if (NULL == ctrl) { |
644 | DEB_D(("unknown control %d\n", c->id)); | 648 | DEB_D("unknown control %d\n", c->id); |
645 | return -EINVAL; | 649 | return -EINVAL; |
646 | } | 650 | } |
647 | 651 | ||
@@ -686,14 +690,14 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c) | |||
686 | case V4L2_CID_HFLIP: | 690 | case V4L2_CID_HFLIP: |
687 | /* fixme: we can support changing VFLIP and HFLIP here... */ | 691 | /* fixme: we can support changing VFLIP and HFLIP here... */ |
688 | if (IS_CAPTURE_ACTIVE(fh) != 0) { | 692 | if (IS_CAPTURE_ACTIVE(fh) != 0) { |
689 | DEB_D(("V4L2_CID_HFLIP while active capture.\n")); | 693 | DEB_D("V4L2_CID_HFLIP while active capture\n"); |
690 | return -EBUSY; | 694 | return -EBUSY; |
691 | } | 695 | } |
692 | vv->hflip = c->value; | 696 | vv->hflip = c->value; |
693 | break; | 697 | break; |
694 | case V4L2_CID_VFLIP: | 698 | case V4L2_CID_VFLIP: |
695 | if (IS_CAPTURE_ACTIVE(fh) != 0) { | 699 | if (IS_CAPTURE_ACTIVE(fh) != 0) { |
696 | DEB_D(("V4L2_CID_VFLIP while active capture.\n")); | 700 | DEB_D("V4L2_CID_VFLIP while active capture\n"); |
697 | return -EBUSY; | 701 | return -EBUSY; |
698 | } | 702 | } |
699 | vv->vflip = c->value; | 703 | vv->vflip = c->value; |
@@ -748,7 +752,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma | |||
748 | int maxw, maxh; | 752 | int maxw, maxh; |
749 | int calc_bpl; | 753 | int calc_bpl; |
750 | 754 | ||
751 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); | 755 | DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh); |
752 | 756 | ||
753 | fmt = saa7146_format_by_fourcc(dev, f->fmt.pix.pixelformat); | 757 | fmt = saa7146_format_by_fourcc(dev, f->fmt.pix.pixelformat); |
754 | if (NULL == fmt) | 758 | if (NULL == fmt) |
@@ -777,7 +781,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma | |||
777 | vv->last_field = V4L2_FIELD_INTERLACED; | 781 | vv->last_field = V4L2_FIELD_INTERLACED; |
778 | break; | 782 | break; |
779 | default: | 783 | default: |
780 | DEB_D(("no known field mode '%d'.\n", field)); | 784 | DEB_D("no known field mode '%d'\n", field); |
781 | return -EINVAL; | 785 | return -EINVAL; |
782 | } | 786 | } |
783 | 787 | ||
@@ -796,8 +800,9 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma | |||
796 | f->fmt.pix.bytesperline = calc_bpl; | 800 | f->fmt.pix.bytesperline = calc_bpl; |
797 | 801 | ||
798 | f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * f->fmt.pix.height; | 802 | f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * f->fmt.pix.height; |
799 | DEB_D(("w:%d, h:%d, bytesperline:%d, sizeimage:%d\n", f->fmt.pix.width, | 803 | DEB_D("w:%d, h:%d, bytesperline:%d, sizeimage:%d\n", |
800 | f->fmt.pix.height, f->fmt.pix.bytesperline, f->fmt.pix.sizeimage)); | 804 | f->fmt.pix.width, f->fmt.pix.height, |
805 | f->fmt.pix.bytesperline, f->fmt.pix.sizeimage); | ||
801 | 806 | ||
802 | return 0; | 807 | return 0; |
803 | } | 808 | } |
@@ -811,22 +816,23 @@ static int vidioc_try_fmt_vid_overlay(struct file *file, void *fh, struct v4l2_f | |||
811 | enum v4l2_field field; | 816 | enum v4l2_field field; |
812 | int maxw, maxh; | 817 | int maxw, maxh; |
813 | 818 | ||
814 | DEB_EE(("dev:%p\n", dev)); | 819 | DEB_EE("dev:%p\n", dev); |
815 | 820 | ||
816 | if (NULL == vv->ov_fb.base) { | 821 | if (NULL == vv->ov_fb.base) { |
817 | DEB_D(("no fb base set.\n")); | 822 | DEB_D("no fb base set\n"); |
818 | return -EINVAL; | 823 | return -EINVAL; |
819 | } | 824 | } |
820 | if (NULL == vv->ov_fmt) { | 825 | if (NULL == vv->ov_fmt) { |
821 | DEB_D(("no fb fmt set.\n")); | 826 | DEB_D("no fb fmt set\n"); |
822 | return -EINVAL; | 827 | return -EINVAL; |
823 | } | 828 | } |
824 | if (win->w.width < 48 || win->w.height < 32) { | 829 | if (win->w.width < 48 || win->w.height < 32) { |
825 | DEB_D(("min width/height. (%d,%d)\n", win->w.width, win->w.height)); | 830 | DEB_D("min width/height. (%d,%d)\n", |
831 | win->w.width, win->w.height); | ||
826 | return -EINVAL; | 832 | return -EINVAL; |
827 | } | 833 | } |
828 | if (win->clipcount > 16) { | 834 | if (win->clipcount > 16) { |
829 | DEB_D(("clipcount too big.\n")); | 835 | DEB_D("clipcount too big\n"); |
830 | return -EINVAL; | 836 | return -EINVAL; |
831 | } | 837 | } |
832 | 838 | ||
@@ -848,7 +854,7 @@ static int vidioc_try_fmt_vid_overlay(struct file *file, void *fh, struct v4l2_f | |||
848 | case V4L2_FIELD_INTERLACED: | 854 | case V4L2_FIELD_INTERLACED: |
849 | break; | 855 | break; |
850 | default: | 856 | default: |
851 | DEB_D(("no known field mode '%d'.\n", field)); | 857 | DEB_D("no known field mode '%d'\n", field); |
852 | return -EINVAL; | 858 | return -EINVAL; |
853 | } | 859 | } |
854 | 860 | ||
@@ -868,16 +874,17 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_forma | |||
868 | struct saa7146_vv *vv = dev->vv_data; | 874 | struct saa7146_vv *vv = dev->vv_data; |
869 | int err; | 875 | int err; |
870 | 876 | ||
871 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); | 877 | DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh); |
872 | if (IS_CAPTURE_ACTIVE(fh) != 0) { | 878 | if (IS_CAPTURE_ACTIVE(fh) != 0) { |
873 | DEB_EE(("streaming capture is active\n")); | 879 | DEB_EE("streaming capture is active\n"); |
874 | return -EBUSY; | 880 | return -EBUSY; |
875 | } | 881 | } |
876 | err = vidioc_try_fmt_vid_cap(file, fh, f); | 882 | err = vidioc_try_fmt_vid_cap(file, fh, f); |
877 | if (0 != err) | 883 | if (0 != err) |
878 | return err; | 884 | return err; |
879 | fh->video_fmt = f->fmt.pix; | 885 | fh->video_fmt = f->fmt.pix; |
880 | DEB_EE(("set to pixelformat '%4.4s'\n", (char *)&fh->video_fmt.pixelformat)); | 886 | DEB_EE("set to pixelformat '%4.4s'\n", |
887 | (char *)&fh->video_fmt.pixelformat); | ||
881 | return 0; | 888 | return 0; |
882 | } | 889 | } |
883 | 890 | ||
@@ -888,7 +895,7 @@ static int vidioc_s_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_f | |||
888 | struct saa7146_vv *vv = dev->vv_data; | 895 | struct saa7146_vv *vv = dev->vv_data; |
889 | int err; | 896 | int err; |
890 | 897 | ||
891 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_OVERLAY: dev:%p, fh:%p\n", dev, fh)); | 898 | DEB_EE("V4L2_BUF_TYPE_VIDEO_OVERLAY: dev:%p, fh:%p\n", dev, fh); |
892 | err = vidioc_try_fmt_vid_overlay(file, fh, f); | 899 | err = vidioc_try_fmt_vid_overlay(file, fh, f); |
893 | if (0 != err) | 900 | if (0 != err) |
894 | return err; | 901 | return err; |
@@ -931,7 +938,7 @@ static int vidioc_g_std(struct file *file, void *fh, v4l2_std_id *norm) | |||
931 | if (e->index < 0 ) | 938 | if (e->index < 0 ) |
932 | return -EINVAL; | 939 | return -EINVAL; |
933 | if( e->index < dev->ext_vv_data->num_stds ) { | 940 | if( e->index < dev->ext_vv_data->num_stds ) { |
934 | DEB_EE(("VIDIOC_ENUMSTD: index:%d\n",e->index)); | 941 | DEB_EE("VIDIOC_ENUMSTD: index:%d\n", e->index); |
935 | v4l2_video_std_construct(e, dev->ext_vv_data->stds[e->index].id, dev->ext_vv_data->stds[e->index].name); | 942 | v4l2_video_std_construct(e, dev->ext_vv_data->stds[e->index].id, dev->ext_vv_data->stds[e->index].name); |
936 | return 0; | 943 | return 0; |
937 | } | 944 | } |
@@ -946,10 +953,10 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id) | |||
946 | int found = 0; | 953 | int found = 0; |
947 | int err, i; | 954 | int err, i; |
948 | 955 | ||
949 | DEB_EE(("VIDIOC_S_STD\n")); | 956 | DEB_EE("VIDIOC_S_STD\n"); |
950 | 957 | ||
951 | if ((vv->video_status & STATUS_CAPTURE) == STATUS_CAPTURE) { | 958 | if ((vv->video_status & STATUS_CAPTURE) == STATUS_CAPTURE) { |
952 | DEB_D(("cannot change video standard while streaming capture is active\n")); | 959 | DEB_D("cannot change video standard while streaming capture is active\n"); |
953 | return -EBUSY; | 960 | return -EBUSY; |
954 | } | 961 | } |
955 | 962 | ||
@@ -957,7 +964,7 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id) | |||
957 | vv->ov_suspend = vv->video_fh; | 964 | vv->ov_suspend = vv->video_fh; |
958 | err = saa7146_stop_preview(vv->video_fh); /* side effect: video_status is now 0, video_fh is NULL */ | 965 | err = saa7146_stop_preview(vv->video_fh); /* side effect: video_status is now 0, video_fh is NULL */ |
959 | if (0 != err) { | 966 | if (0 != err) { |
960 | DEB_D(("suspending video failed. aborting\n")); | 967 | DEB_D("suspending video failed. aborting\n"); |
961 | return err; | 968 | return err; |
962 | } | 969 | } |
963 | } | 970 | } |
@@ -978,11 +985,11 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id) | |||
978 | } | 985 | } |
979 | 986 | ||
980 | if (!found) { | 987 | if (!found) { |
981 | DEB_EE(("VIDIOC_S_STD: standard not found.\n")); | 988 | DEB_EE("VIDIOC_S_STD: standard not found\n"); |
982 | return -EINVAL; | 989 | return -EINVAL; |
983 | } | 990 | } |
984 | 991 | ||
985 | DEB_EE(("VIDIOC_S_STD: set to standard to '%s'\n", vv->standard->name)); | 992 | DEB_EE("VIDIOC_S_STD: set to standard to '%s'\n", vv->standard->name); |
986 | return 0; | 993 | return 0; |
987 | } | 994 | } |
988 | 995 | ||
@@ -990,7 +997,7 @@ static int vidioc_overlay(struct file *file, void *fh, unsigned int on) | |||
990 | { | 997 | { |
991 | int err; | 998 | int err; |
992 | 999 | ||
993 | DEB_D(("VIDIOC_OVERLAY on:%d\n", on)); | 1000 | DEB_D("VIDIOC_OVERLAY on:%d\n", on); |
994 | if (on) | 1001 | if (on) |
995 | err = saa7146_start_preview(fh); | 1002 | err = saa7146_start_preview(fh); |
996 | else | 1003 | else |
@@ -1047,7 +1054,7 @@ static int vidioc_streamon(struct file *file, void *__fh, enum v4l2_buf_type typ | |||
1047 | struct saa7146_fh *fh = __fh; | 1054 | struct saa7146_fh *fh = __fh; |
1048 | int err; | 1055 | int err; |
1049 | 1056 | ||
1050 | DEB_D(("VIDIOC_STREAMON, type:%d\n", type)); | 1057 | DEB_D("VIDIOC_STREAMON, type:%d\n", type); |
1051 | 1058 | ||
1052 | err = video_begin(fh); | 1059 | err = video_begin(fh); |
1053 | if (err) | 1060 | if (err) |
@@ -1066,18 +1073,18 @@ static int vidioc_streamoff(struct file *file, void *__fh, enum v4l2_buf_type ty | |||
1066 | struct saa7146_vv *vv = dev->vv_data; | 1073 | struct saa7146_vv *vv = dev->vv_data; |
1067 | int err; | 1074 | int err; |
1068 | 1075 | ||
1069 | DEB_D(("VIDIOC_STREAMOFF, type:%d\n", type)); | 1076 | DEB_D("VIDIOC_STREAMOFF, type:%d\n", type); |
1070 | 1077 | ||
1071 | /* ugly: we need to copy some checks from video_end(), | 1078 | /* ugly: we need to copy some checks from video_end(), |
1072 | because videobuf_streamoff() relies on the capture running. | 1079 | because videobuf_streamoff() relies on the capture running. |
1073 | check and fix this */ | 1080 | check and fix this */ |
1074 | if ((vv->video_status & STATUS_CAPTURE) != STATUS_CAPTURE) { | 1081 | if ((vv->video_status & STATUS_CAPTURE) != STATUS_CAPTURE) { |
1075 | DEB_S(("not capturing.\n")); | 1082 | DEB_S("not capturing\n"); |
1076 | return 0; | 1083 | return 0; |
1077 | } | 1084 | } |
1078 | 1085 | ||
1079 | if (vv->video_fh != fh) { | 1086 | if (vv->video_fh != fh) { |
1080 | DEB_S(("capturing, but in another open.\n")); | 1087 | DEB_S("capturing, but in another open\n"); |
1081 | return -EBUSY; | 1088 | return -EBUSY; |
1082 | } | 1089 | } |
1083 | 1090 | ||
@@ -1087,7 +1094,7 @@ static int vidioc_streamoff(struct file *file, void *__fh, enum v4l2_buf_type ty | |||
1087 | else if (type == V4L2_BUF_TYPE_VBI_CAPTURE) | 1094 | else if (type == V4L2_BUF_TYPE_VBI_CAPTURE) |
1088 | err = videobuf_streamoff(&fh->vbi_q); | 1095 | err = videobuf_streamoff(&fh->vbi_q); |
1089 | if (0 != err) { | 1096 | if (0 != err) { |
1090 | DEB_D(("warning: videobuf_streamoff() failed.\n")); | 1097 | DEB_D("warning: videobuf_streamoff() failed\n"); |
1091 | video_end(fh, file); | 1098 | video_end(fh, file); |
1092 | } else { | 1099 | } else { |
1093 | err = video_end(fh, file); | 1100 | err = video_end(fh, file); |
@@ -1174,25 +1181,27 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1174 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; | 1181 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; |
1175 | int size,err = 0; | 1182 | int size,err = 0; |
1176 | 1183 | ||
1177 | DEB_CAP(("vbuf:%p\n",vb)); | 1184 | DEB_CAP("vbuf:%p\n", vb); |
1178 | 1185 | ||
1179 | /* sanity checks */ | 1186 | /* sanity checks */ |
1180 | if (fh->video_fmt.width < 48 || | 1187 | if (fh->video_fmt.width < 48 || |
1181 | fh->video_fmt.height < 32 || | 1188 | fh->video_fmt.height < 32 || |
1182 | fh->video_fmt.width > vv->standard->h_max_out || | 1189 | fh->video_fmt.width > vv->standard->h_max_out || |
1183 | fh->video_fmt.height > vv->standard->v_max_out) { | 1190 | fh->video_fmt.height > vv->standard->v_max_out) { |
1184 | DEB_D(("w (%d) / h (%d) out of bounds.\n",fh->video_fmt.width,fh->video_fmt.height)); | 1191 | DEB_D("w (%d) / h (%d) out of bounds\n", |
1192 | fh->video_fmt.width, fh->video_fmt.height); | ||
1185 | return -EINVAL; | 1193 | return -EINVAL; |
1186 | } | 1194 | } |
1187 | 1195 | ||
1188 | size = fh->video_fmt.sizeimage; | 1196 | size = fh->video_fmt.sizeimage; |
1189 | if (0 != buf->vb.baddr && buf->vb.bsize < size) { | 1197 | if (0 != buf->vb.baddr && buf->vb.bsize < size) { |
1190 | DEB_D(("size mismatch.\n")); | 1198 | DEB_D("size mismatch\n"); |
1191 | return -EINVAL; | 1199 | return -EINVAL; |
1192 | } | 1200 | } |
1193 | 1201 | ||
1194 | DEB_CAP(("buffer_prepare [size=%dx%d,bytes=%d,fields=%s]\n", | 1202 | DEB_CAP("buffer_prepare [size=%dx%d,bytes=%d,fields=%s]\n", |
1195 | fh->video_fmt.width,fh->video_fmt.height,size,v4l2_field_names[fh->video_fmt.field])); | 1203 | fh->video_fmt.width, fh->video_fmt.height, |
1204 | size, v4l2_field_names[fh->video_fmt.field]); | ||
1196 | if (buf->vb.width != fh->video_fmt.width || | 1205 | if (buf->vb.width != fh->video_fmt.width || |
1197 | buf->vb.bytesperline != fh->video_fmt.bytesperline || | 1206 | buf->vb.bytesperline != fh->video_fmt.bytesperline || |
1198 | buf->vb.height != fh->video_fmt.height || | 1207 | buf->vb.height != fh->video_fmt.height || |
@@ -1238,7 +1247,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1238 | return 0; | 1247 | return 0; |
1239 | 1248 | ||
1240 | oops: | 1249 | oops: |
1241 | DEB_D(("error out.\n")); | 1250 | DEB_D("error out\n"); |
1242 | saa7146_dma_free(dev,q,buf); | 1251 | saa7146_dma_free(dev,q,buf); |
1243 | 1252 | ||
1244 | return err; | 1253 | return err; |
@@ -1259,7 +1268,7 @@ static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned | |||
1259 | *count = (max_memory*1048576) / *size; | 1268 | *count = (max_memory*1048576) / *size; |
1260 | } | 1269 | } |
1261 | 1270 | ||
1262 | DEB_CAP(("%d buffers, %d bytes each.\n",*count,*size)); | 1271 | DEB_CAP("%d buffers, %d bytes each\n", *count, *size); |
1263 | 1272 | ||
1264 | return 0; | 1273 | return 0; |
1265 | } | 1274 | } |
@@ -1272,7 +1281,7 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
1272 | struct saa7146_vv *vv = dev->vv_data; | 1281 | struct saa7146_vv *vv = dev->vv_data; |
1273 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; | 1282 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; |
1274 | 1283 | ||
1275 | DEB_CAP(("vbuf:%p\n",vb)); | 1284 | DEB_CAP("vbuf:%p\n", vb); |
1276 | saa7146_buffer_queue(fh->dev,&vv->video_q,buf); | 1285 | saa7146_buffer_queue(fh->dev,&vv->video_q,buf); |
1277 | } | 1286 | } |
1278 | 1287 | ||
@@ -1283,7 +1292,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
1283 | struct saa7146_dev *dev = fh->dev; | 1292 | struct saa7146_dev *dev = fh->dev; |
1284 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; | 1293 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; |
1285 | 1294 | ||
1286 | DEB_CAP(("vbuf:%p\n",vb)); | 1295 | DEB_CAP("vbuf:%p\n", vb); |
1287 | 1296 | ||
1288 | saa7146_dma_free(dev,q,buf); | 1297 | saa7146_dma_free(dev,q,buf); |
1289 | 1298 | ||
@@ -1368,7 +1377,7 @@ static void video_irq_done(struct saa7146_dev *dev, unsigned long st) | |||
1368 | struct saa7146_dmaqueue *q = &vv->video_q; | 1377 | struct saa7146_dmaqueue *q = &vv->video_q; |
1369 | 1378 | ||
1370 | spin_lock(&dev->slock); | 1379 | spin_lock(&dev->slock); |
1371 | DEB_CAP(("called.\n")); | 1380 | DEB_CAP("called\n"); |
1372 | 1381 | ||
1373 | /* only finish the buffer if we have one... */ | 1382 | /* only finish the buffer if we have one... */ |
1374 | if( NULL != q->curr ) { | 1383 | if( NULL != q->curr ) { |
@@ -1386,15 +1395,15 @@ static ssize_t video_read(struct file *file, char __user *data, size_t count, lo | |||
1386 | struct saa7146_vv *vv = dev->vv_data; | 1395 | struct saa7146_vv *vv = dev->vv_data; |
1387 | ssize_t ret = 0; | 1396 | ssize_t ret = 0; |
1388 | 1397 | ||
1389 | DEB_EE(("called.\n")); | 1398 | DEB_EE("called\n"); |
1390 | 1399 | ||
1391 | if ((vv->video_status & STATUS_CAPTURE) != 0) { | 1400 | if ((vv->video_status & STATUS_CAPTURE) != 0) { |
1392 | /* fixme: should we allow read() captures while streaming capture? */ | 1401 | /* fixme: should we allow read() captures while streaming capture? */ |
1393 | if (vv->video_fh == fh) { | 1402 | if (vv->video_fh == fh) { |
1394 | DEB_S(("already capturing.\n")); | 1403 | DEB_S("already capturing\n"); |
1395 | return -EBUSY; | 1404 | return -EBUSY; |
1396 | } | 1405 | } |
1397 | DEB_S(("already capturing in another open.\n")); | 1406 | DEB_S("already capturing in another open\n"); |
1398 | return -EBUSY; | 1407 | return -EBUSY; |
1399 | } | 1408 | } |
1400 | 1409 | ||
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c index cdd31cae46c4..ee8ee1d481fa 100644 --- a/drivers/media/dvb/ttpci/av7110_v4l.c +++ b/drivers/media/dvb/ttpci/av7110_v4l.c | |||
@@ -25,6 +25,8 @@ | |||
25 | * the project's page is at http://www.linuxtv.org/ | 25 | * the project's page is at http://www.linuxtv.org/ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
29 | |||
28 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
29 | #include <linux/types.h> | 31 | #include <linux/types.h> |
30 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
@@ -253,7 +255,7 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh) | |||
253 | 255 | ||
254 | switch (av7110->current_input) { | 256 | switch (av7110->current_input) { |
255 | case 1: | 257 | case 1: |
256 | dprintk(1, "switching SAA7113 to Analog Tuner Input.\n"); | 258 | dprintk(1, "switching SAA7113 to Analog Tuner Input\n"); |
257 | msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0000); // loudspeaker source | 259 | msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0000); // loudspeaker source |
258 | msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0000); // headphone source | 260 | msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0000); // headphone source |
259 | msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0000); // SCART 1 source | 261 | msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0000); // SCART 1 source |
@@ -263,7 +265,7 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh) | |||
263 | 265 | ||
264 | if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) { | 266 | if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) { |
265 | if (ves1820_writereg(dev, 0x09, 0x0f, 0x60)) | 267 | if (ves1820_writereg(dev, 0x09, 0x0f, 0x60)) |
266 | dprintk(1, "setting band in demodulator failed.\n"); | 268 | dprintk(1, "setting band in demodulator failed\n"); |
267 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { | 269 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { |
268 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9819 pin9(STD) | 270 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9819 pin9(STD) |
269 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9819 pin30(VIF) | 271 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9819 pin30(VIF) |
@@ -272,17 +274,17 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh) | |||
272 | dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); | 274 | dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); |
273 | break; | 275 | break; |
274 | case 2: | 276 | case 2: |
275 | dprintk(1, "switching SAA7113 to Video AV CVBS Input.\n"); | 277 | dprintk(1, "switching SAA7113 to Video AV CVBS Input\n"); |
276 | if (i2c_writereg(av7110, 0x48, 0x02, 0xd2) != 1) | 278 | if (i2c_writereg(av7110, 0x48, 0x02, 0xd2) != 1) |
277 | dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); | 279 | dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); |
278 | break; | 280 | break; |
279 | case 3: | 281 | case 3: |
280 | dprintk(1, "switching SAA7113 to Video AV Y/C Input.\n"); | 282 | dprintk(1, "switching SAA7113 to Video AV Y/C Input\n"); |
281 | if (i2c_writereg(av7110, 0x48, 0x02, 0xd9) != 1) | 283 | if (i2c_writereg(av7110, 0x48, 0x02, 0xd9) != 1) |
282 | dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); | 284 | dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); |
283 | break; | 285 | break; |
284 | default: | 286 | default: |
285 | dprintk(1, "switching SAA7113 to Input: AV7110: SAA7113: invalid input.\n"); | 287 | dprintk(1, "switching SAA7113 to Input: AV7110: SAA7113: invalid input\n"); |
286 | } | 288 | } |
287 | } else { | 289 | } else { |
288 | adswitch = 0; | 290 | adswitch = 0; |
@@ -299,7 +301,7 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh) | |||
299 | 301 | ||
300 | if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) { | 302 | if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) { |
301 | if (ves1820_writereg(dev, 0x09, 0x0f, 0x20)) | 303 | if (ves1820_writereg(dev, 0x09, 0x0f, 0x20)) |
302 | dprintk(1, "setting band in demodulator failed.\n"); | 304 | dprintk(1, "setting band in demodulator failed\n"); |
303 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { | 305 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { |
304 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD) | 306 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD) |
305 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF) | 307 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF) |
@@ -413,7 +415,7 @@ static int vidioc_g_frequency(struct file *file, void *fh, struct v4l2_frequency | |||
413 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; | 415 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; |
414 | struct av7110 *av7110 = (struct av7110 *)dev->ext_priv; | 416 | struct av7110 *av7110 = (struct av7110 *)dev->ext_priv; |
415 | 417 | ||
416 | dprintk(2, "VIDIOC_G_FREQ: freq:0x%08x.\n", f->frequency); | 418 | dprintk(2, "VIDIOC_G_FREQ: freq:0x%08x\n", f->frequency); |
417 | 419 | ||
418 | if (!av7110->analog_tuner_flags || av7110->current_input != 1) | 420 | if (!av7110->analog_tuner_flags || av7110->current_input != 1) |
419 | return -EINVAL; | 421 | return -EINVAL; |
@@ -429,7 +431,7 @@ static int vidioc_s_frequency(struct file *file, void *fh, struct v4l2_frequency | |||
429 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; | 431 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; |
430 | struct av7110 *av7110 = (struct av7110 *)dev->ext_priv; | 432 | struct av7110 *av7110 = (struct av7110 *)dev->ext_priv; |
431 | 433 | ||
432 | dprintk(2, "VIDIOC_S_FREQUENCY: freq:0x%08x.\n", f->frequency); | 434 | dprintk(2, "VIDIOC_S_FREQUENCY: freq:0x%08x\n", f->frequency); |
433 | 435 | ||
434 | if (!av7110->analog_tuner_flags || av7110->current_input != 1) | 436 | if (!av7110->analog_tuner_flags || av7110->current_input != 1) |
435 | return -EINVAL; | 437 | return -EINVAL; |
@@ -689,12 +691,12 @@ int av7110_init_analog_module(struct av7110 *av7110) | |||
689 | 691 | ||
690 | if (i2c_writereg(av7110, 0x80, 0x0, 0x80) == 1 && | 692 | if (i2c_writereg(av7110, 0x80, 0x0, 0x80) == 1 && |
691 | i2c_writereg(av7110, 0x80, 0x0, 0) == 1) { | 693 | i2c_writereg(av7110, 0x80, 0x0, 0) == 1) { |
692 | printk("dvb-ttpci: DVB-C analog module @ card %d detected, initializing MSP3400\n", | 694 | pr_info("DVB-C analog module @ card %d detected, initializing MSP3400\n", |
693 | av7110->dvb_adapter.num); | 695 | av7110->dvb_adapter.num); |
694 | av7110->adac_type = DVB_ADAC_MSP34x0; | 696 | av7110->adac_type = DVB_ADAC_MSP34x0; |
695 | } else if (i2c_writereg(av7110, 0x84, 0x0, 0x80) == 1 && | 697 | } else if (i2c_writereg(av7110, 0x84, 0x0, 0x80) == 1 && |
696 | i2c_writereg(av7110, 0x84, 0x0, 0) == 1) { | 698 | i2c_writereg(av7110, 0x84, 0x0, 0) == 1) { |
697 | printk("dvb-ttpci: DVB-C analog module @ card %d detected, initializing MSP3415\n", | 699 | pr_info("DVB-C analog module @ card %d detected, initializing MSP3415\n", |
698 | av7110->dvb_adapter.num); | 700 | av7110->dvb_adapter.num); |
699 | av7110->adac_type = DVB_ADAC_MSP34x5; | 701 | av7110->adac_type = DVB_ADAC_MSP34x5; |
700 | } else | 702 | } else |
@@ -715,7 +717,7 @@ int av7110_init_analog_module(struct av7110 *av7110) | |||
715 | msp_writereg(av7110, MSP_WR_DSP, 0x000d, 0x1900); // prescale SCART | 717 | msp_writereg(av7110, MSP_WR_DSP, 0x000d, 0x1900); // prescale SCART |
716 | 718 | ||
717 | if (i2c_writereg(av7110, 0x48, 0x01, 0x00)!=1) { | 719 | if (i2c_writereg(av7110, 0x48, 0x01, 0x00)!=1) { |
718 | INFO(("saa7113 not accessible.\n")); | 720 | pr_info("saa7113 not accessible\n"); |
719 | } else { | 721 | } else { |
720 | u8 *i = saa7113_init_regs; | 722 | u8 *i = saa7113_init_regs; |
721 | 723 | ||
@@ -733,7 +735,7 @@ int av7110_init_analog_module(struct av7110 *av7110) | |||
733 | /* setup for DVB by default */ | 735 | /* setup for DVB by default */ |
734 | if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) { | 736 | if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) { |
735 | if (ves1820_writereg(av7110->dev, 0x09, 0x0f, 0x20)) | 737 | if (ves1820_writereg(av7110->dev, 0x09, 0x0f, 0x20)) |
736 | dprintk(1, "setting band in demodulator failed.\n"); | 738 | dprintk(1, "setting band in demodulator failed\n"); |
737 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { | 739 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { |
738 | saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD) | 740 | saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD) |
739 | saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF) | 741 | saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF) |
@@ -797,7 +799,7 @@ int av7110_init_v4l(struct av7110 *av7110) | |||
797 | ret = saa7146_vv_init(dev, vv_data); | 799 | ret = saa7146_vv_init(dev, vv_data); |
798 | 800 | ||
799 | if (ret) { | 801 | if (ret) { |
800 | ERR(("cannot init capture device. skipping.\n")); | 802 | ERR("cannot init capture device. skipping\n"); |
801 | return -ENODEV; | 803 | return -ENODEV; |
802 | } | 804 | } |
803 | vv_data->ops.vidioc_enum_input = vidioc_enum_input; | 805 | vv_data->ops.vidioc_enum_input = vidioc_enum_input; |
@@ -814,12 +816,12 @@ int av7110_init_v4l(struct av7110 *av7110) | |||
814 | vv_data->ops.vidioc_s_fmt_sliced_vbi_out = vidioc_s_fmt_sliced_vbi_out; | 816 | vv_data->ops.vidioc_s_fmt_sliced_vbi_out = vidioc_s_fmt_sliced_vbi_out; |
815 | 817 | ||
816 | if (saa7146_register_device(&av7110->v4l_dev, dev, "av7110", VFL_TYPE_GRABBER)) { | 818 | if (saa7146_register_device(&av7110->v4l_dev, dev, "av7110", VFL_TYPE_GRABBER)) { |
817 | ERR(("cannot register capture device. skipping.\n")); | 819 | ERR("cannot register capture device. skipping\n"); |
818 | saa7146_vv_release(dev); | 820 | saa7146_vv_release(dev); |
819 | return -ENODEV; | 821 | return -ENODEV; |
820 | } | 822 | } |
821 | if (saa7146_register_device(&av7110->vbi_dev, dev, "av7110", VFL_TYPE_VBI)) | 823 | if (saa7146_register_device(&av7110->vbi_dev, dev, "av7110", VFL_TYPE_VBI)) |
822 | ERR(("cannot register vbi v4l2 device. skipping.\n")); | 824 | ERR("cannot register vbi v4l2 device. skipping\n"); |
823 | return 0; | 825 | return 0; |
824 | } | 826 | } |
825 | 827 | ||
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 5b28bc6fbeb4..91b7d53d7b0e 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -33,6 +33,8 @@ | |||
33 | * the project's page is at http://www.linuxtv.org/ | 33 | * the project's page is at http://www.linuxtv.org/ |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
37 | |||
36 | #include "budget.h" | 38 | #include "budget.h" |
37 | #include "stv0299.h" | 39 | #include "stv0299.h" |
38 | #include "stb0899_drv.h" | 40 | #include "stb0899_drv.h" |
@@ -149,7 +151,7 @@ static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int ad | |||
149 | result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 0xfff, 1, 0, 1); | 151 | result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 0xfff, 1, 0, 1); |
150 | if (result == -ETIMEDOUT) { | 152 | if (result == -ETIMEDOUT) { |
151 | ciintf_slot_shutdown(ca, slot); | 153 | ciintf_slot_shutdown(ca, slot); |
152 | printk(KERN_INFO "budget-av: cam ejected 1\n"); | 154 | pr_info("cam ejected 1\n"); |
153 | } | 155 | } |
154 | return result; | 156 | return result; |
155 | } | 157 | } |
@@ -168,7 +170,7 @@ static int ciintf_write_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int a | |||
168 | result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 0xfff, 1, value, 0, 1); | 170 | result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 0xfff, 1, value, 0, 1); |
169 | if (result == -ETIMEDOUT) { | 171 | if (result == -ETIMEDOUT) { |
170 | ciintf_slot_shutdown(ca, slot); | 172 | ciintf_slot_shutdown(ca, slot); |
171 | printk(KERN_INFO "budget-av: cam ejected 2\n"); | 173 | pr_info("cam ejected 2\n"); |
172 | } | 174 | } |
173 | return result; | 175 | return result; |
174 | } | 176 | } |
@@ -187,7 +189,7 @@ static int ciintf_read_cam_control(struct dvb_ca_en50221 *ca, int slot, u8 addre | |||
187 | result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 3, 1, 0, 0); | 189 | result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 3, 1, 0, 0); |
188 | if (result == -ETIMEDOUT) { | 190 | if (result == -ETIMEDOUT) { |
189 | ciintf_slot_shutdown(ca, slot); | 191 | ciintf_slot_shutdown(ca, slot); |
190 | printk(KERN_INFO "budget-av: cam ejected 3\n"); | 192 | pr_info("cam ejected 3\n"); |
191 | return -ETIMEDOUT; | 193 | return -ETIMEDOUT; |
192 | } | 194 | } |
193 | return result; | 195 | return result; |
@@ -207,7 +209,7 @@ static int ciintf_write_cam_control(struct dvb_ca_en50221 *ca, int slot, u8 addr | |||
207 | result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 3, 1, value, 0, 0); | 209 | result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 3, 1, value, 0, 0); |
208 | if (result == -ETIMEDOUT) { | 210 | if (result == -ETIMEDOUT) { |
209 | ciintf_slot_shutdown(ca, slot); | 211 | ciintf_slot_shutdown(ca, slot); |
210 | printk(KERN_INFO "budget-av: cam ejected 5\n"); | 212 | pr_info("cam ejected 5\n"); |
211 | } | 213 | } |
212 | return result; | 214 | return result; |
213 | } | 215 | } |
@@ -289,7 +291,7 @@ static int ciintf_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open | |||
289 | if (saa7146_read(saa, PSR) & MASK_06) { | 291 | if (saa7146_read(saa, PSR) & MASK_06) { |
290 | if (budget_av->slot_status == SLOTSTATUS_NONE) { | 292 | if (budget_av->slot_status == SLOTSTATUS_NONE) { |
291 | budget_av->slot_status = SLOTSTATUS_PRESENT; | 293 | budget_av->slot_status = SLOTSTATUS_PRESENT; |
292 | printk(KERN_INFO "budget-av: cam inserted A\n"); | 294 | pr_info("cam inserted A\n"); |
293 | } | 295 | } |
294 | } | 296 | } |
295 | saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTLO); | 297 | saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTLO); |
@@ -306,11 +308,11 @@ static int ciintf_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open | |||
306 | result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, 0, 1, 0, 1); | 308 | result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, 0, 1, 0, 1); |
307 | if ((result >= 0) && (budget_av->slot_status == SLOTSTATUS_NONE)) { | 309 | if ((result >= 0) && (budget_av->slot_status == SLOTSTATUS_NONE)) { |
308 | budget_av->slot_status = SLOTSTATUS_PRESENT; | 310 | budget_av->slot_status = SLOTSTATUS_PRESENT; |
309 | printk(KERN_INFO "budget-av: cam inserted B\n"); | 311 | pr_info("cam inserted B\n"); |
310 | } else if (result < 0) { | 312 | } else if (result < 0) { |
311 | if (budget_av->slot_status != SLOTSTATUS_NONE) { | 313 | if (budget_av->slot_status != SLOTSTATUS_NONE) { |
312 | ciintf_slot_shutdown(ca, slot); | 314 | ciintf_slot_shutdown(ca, slot); |
313 | printk(KERN_INFO "budget-av: cam ejected 5\n"); | 315 | pr_info("cam ejected 5\n"); |
314 | return 0; | 316 | return 0; |
315 | } | 317 | } |
316 | } | 318 | } |
@@ -365,11 +367,11 @@ static int ciintf_init(struct budget_av *budget_av) | |||
365 | 367 | ||
366 | if ((result = dvb_ca_en50221_init(&budget_av->budget.dvb_adapter, | 368 | if ((result = dvb_ca_en50221_init(&budget_av->budget.dvb_adapter, |
367 | &budget_av->ca, 0, 1)) != 0) { | 369 | &budget_av->ca, 0, 1)) != 0) { |
368 | printk(KERN_ERR "budget-av: ci initialisation failed.\n"); | 370 | pr_err("ci initialisation failed\n"); |
369 | goto error; | 371 | goto error; |
370 | } | 372 | } |
371 | 373 | ||
372 | printk(KERN_INFO "budget-av: ci interface initialised.\n"); | 374 | pr_info("ci interface initialised\n"); |
373 | return 0; | 375 | return 0; |
374 | 376 | ||
375 | error: | 377 | error: |
@@ -1345,8 +1347,7 @@ static void frontend_init(struct budget_av *budget_av) | |||
1345 | } | 1347 | } |
1346 | 1348 | ||
1347 | if (fe == NULL) { | 1349 | if (fe == NULL) { |
1348 | printk(KERN_ERR "budget-av: A frontend driver was not found " | 1350 | pr_err("A frontend driver was not found for device [%04x:%04x] subsystem [%04x:%04x]\n", |
1349 | "for device [%04x:%04x] subsystem [%04x:%04x]\n", | ||
1350 | saa->pci->vendor, | 1351 | saa->pci->vendor, |
1351 | saa->pci->device, | 1352 | saa->pci->device, |
1352 | saa->pci->subsystem_vendor, | 1353 | saa->pci->subsystem_vendor, |
@@ -1358,7 +1359,7 @@ static void frontend_init(struct budget_av *budget_av) | |||
1358 | 1359 | ||
1359 | if (dvb_register_frontend(&budget_av->budget.dvb_adapter, | 1360 | if (dvb_register_frontend(&budget_av->budget.dvb_adapter, |
1360 | budget_av->budget.dvb_frontend)) { | 1361 | budget_av->budget.dvb_frontend)) { |
1361 | printk(KERN_ERR "budget-av: Frontend registration failed!\n"); | 1362 | pr_err("Frontend registration failed!\n"); |
1362 | dvb_frontend_detach(budget_av->budget.dvb_frontend); | 1363 | dvb_frontend_detach(budget_av->budget.dvb_frontend); |
1363 | budget_av->budget.dvb_frontend = NULL; | 1364 | budget_av->budget.dvb_frontend = NULL; |
1364 | } | 1365 | } |
@@ -1416,7 +1417,7 @@ static struct v4l2_input knc1_inputs[KNC1_INPUTS] = { | |||
1416 | 1417 | ||
1417 | static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) | 1418 | static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) |
1418 | { | 1419 | { |
1419 | dprintk(1, "VIDIOC_ENUMINPUT %d.\n", i->index); | 1420 | dprintk(1, "VIDIOC_ENUMINPUT %d\n", i->index); |
1420 | if (i->index >= KNC1_INPUTS) | 1421 | if (i->index >= KNC1_INPUTS) |
1421 | return -EINVAL; | 1422 | return -EINVAL; |
1422 | memcpy(i, &knc1_inputs[i->index], sizeof(struct v4l2_input)); | 1423 | memcpy(i, &knc1_inputs[i->index], sizeof(struct v4l2_input)); |
@@ -1430,7 +1431,7 @@ static int vidioc_g_input(struct file *file, void *fh, unsigned int *i) | |||
1430 | 1431 | ||
1431 | *i = budget_av->cur_input; | 1432 | *i = budget_av->cur_input; |
1432 | 1433 | ||
1433 | dprintk(1, "VIDIOC_G_INPUT %d.\n", *i); | 1434 | dprintk(1, "VIDIOC_G_INPUT %d\n", *i); |
1434 | return 0; | 1435 | return 0; |
1435 | } | 1436 | } |
1436 | 1437 | ||
@@ -1439,7 +1440,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input) | |||
1439 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; | 1440 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; |
1440 | struct budget_av *budget_av = (struct budget_av *)dev->ext_priv; | 1441 | struct budget_av *budget_av = (struct budget_av *)dev->ext_priv; |
1441 | 1442 | ||
1442 | dprintk(1, "VIDIOC_S_INPUT %d.\n", input); | 1443 | dprintk(1, "VIDIOC_S_INPUT %d\n", input); |
1443 | return saa7113_setinput(budget_av, input); | 1444 | return saa7113_setinput(budget_av, input); |
1444 | } | 1445 | } |
1445 | 1446 | ||
@@ -1478,7 +1479,7 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio | |||
1478 | 1479 | ||
1479 | if (0 != saa7146_vv_init(dev, &vv_data)) { | 1480 | if (0 != saa7146_vv_init(dev, &vv_data)) { |
1480 | /* fixme: proper cleanup here */ | 1481 | /* fixme: proper cleanup here */ |
1481 | ERR(("cannot init vv subsystem.\n")); | 1482 | ERR("cannot init vv subsystem\n"); |
1482 | return err; | 1483 | return err; |
1483 | } | 1484 | } |
1484 | vv_data.ops.vidioc_enum_input = vidioc_enum_input; | 1485 | vv_data.ops.vidioc_enum_input = vidioc_enum_input; |
@@ -1487,7 +1488,7 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio | |||
1487 | 1488 | ||
1488 | if ((err = saa7146_register_device(&budget_av->vd, dev, "knc1", VFL_TYPE_GRABBER))) { | 1489 | if ((err = saa7146_register_device(&budget_av->vd, dev, "knc1", VFL_TYPE_GRABBER))) { |
1489 | /* fixme: proper cleanup here */ | 1490 | /* fixme: proper cleanup here */ |
1490 | ERR(("cannot register capture v4l2 device.\n")); | 1491 | ERR("cannot register capture v4l2 device\n"); |
1491 | saa7146_vv_release(dev); | 1492 | saa7146_vv_release(dev); |
1492 | return err; | 1493 | return err; |
1493 | } | 1494 | } |
@@ -1504,13 +1505,12 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio | |||
1504 | 1505 | ||
1505 | mac = budget_av->budget.dvb_adapter.proposed_mac; | 1506 | mac = budget_av->budget.dvb_adapter.proposed_mac; |
1506 | if (i2c_readregs(&budget_av->budget.i2c_adap, 0xa0, 0x30, mac, 6)) { | 1507 | if (i2c_readregs(&budget_av->budget.i2c_adap, 0xa0, 0x30, mac, 6)) { |
1507 | printk(KERN_ERR "KNC1-%d: Could not read MAC from KNC1 card\n", | 1508 | pr_err("KNC1-%d: Could not read MAC from KNC1 card\n", |
1508 | budget_av->budget.dvb_adapter.num); | 1509 | budget_av->budget.dvb_adapter.num); |
1509 | memset(mac, 0, 6); | 1510 | memset(mac, 0, 6); |
1510 | } else { | 1511 | } else { |
1511 | printk(KERN_INFO "KNC1-%d: MAC addr = %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", | 1512 | pr_info("KNC1-%d: MAC addr = %pM\n", |
1512 | budget_av->budget.dvb_adapter.num, | 1513 | budget_av->budget.dvb_adapter.num, mac); |
1513 | mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); | ||
1514 | } | 1514 | } |
1515 | 1515 | ||
1516 | budget_av->budget.dvb_adapter.priv = budget_av; | 1516 | budget_av->budget.dvb_adapter.priv = budget_av; |
diff --git a/drivers/media/video/hexium_gemini.c b/drivers/media/video/hexium_gemini.c index b37c12f92ccc..9cb039e593db 100644 --- a/drivers/media/video/hexium_gemini.c +++ b/drivers/media/video/hexium_gemini.c | |||
@@ -21,6 +21,8 @@ | |||
21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
25 | |||
24 | #define DEBUG_VARIABLE debug | 26 | #define DEBUG_VARIABLE debug |
25 | 27 | ||
26 | #include <media/saa7146_vv.h> | 28 | #include <media/saa7146_vv.h> |
@@ -175,13 +177,14 @@ static int hexium_init_done(struct saa7146_dev *dev) | |||
175 | union i2c_smbus_data data; | 177 | union i2c_smbus_data data; |
176 | int i = 0; | 178 | int i = 0; |
177 | 179 | ||
178 | DEB_D(("hexium_init_done called.\n")); | 180 | DEB_D("hexium_init_done called\n"); |
179 | 181 | ||
180 | /* initialize the helper ics to useful values */ | 182 | /* initialize the helper ics to useful values */ |
181 | for (i = 0; i < sizeof(hexium_ks0127b); i++) { | 183 | for (i = 0; i < sizeof(hexium_ks0127b); i++) { |
182 | data.byte = hexium_ks0127b[i]; | 184 | data.byte = hexium_ks0127b[i]; |
183 | if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x6c, 0, I2C_SMBUS_WRITE, i, I2C_SMBUS_BYTE_DATA, &data)) { | 185 | if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x6c, 0, I2C_SMBUS_WRITE, i, I2C_SMBUS_BYTE_DATA, &data)) { |
184 | printk("hexium_gemini: hexium_init_done() failed for address 0x%02x\n", i); | 186 | pr_err("hexium_init_done() failed for address 0x%02x\n", |
187 | i); | ||
185 | } | 188 | } |
186 | } | 189 | } |
187 | 190 | ||
@@ -192,7 +195,7 @@ static int hexium_set_input(struct hexium *hexium, int input) | |||
192 | { | 195 | { |
193 | union i2c_smbus_data data; | 196 | union i2c_smbus_data data; |
194 | 197 | ||
195 | DEB_D((".\n")); | 198 | DEB_D("\n"); |
196 | 199 | ||
197 | data.byte = hexium_input_select[input].byte; | 200 | data.byte = hexium_input_select[input].byte; |
198 | if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x6c, 0, I2C_SMBUS_WRITE, hexium_input_select[input].adr, I2C_SMBUS_BYTE_DATA, &data)) { | 201 | if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x6c, 0, I2C_SMBUS_WRITE, hexium_input_select[input].adr, I2C_SMBUS_BYTE_DATA, &data)) { |
@@ -207,12 +210,13 @@ static int hexium_set_standard(struct hexium *hexium, struct hexium_data *vdec) | |||
207 | union i2c_smbus_data data; | 210 | union i2c_smbus_data data; |
208 | int i = 0; | 211 | int i = 0; |
209 | 212 | ||
210 | DEB_D((".\n")); | 213 | DEB_D("\n"); |
211 | 214 | ||
212 | while (vdec[i].adr != -1) { | 215 | while (vdec[i].adr != -1) { |
213 | data.byte = vdec[i].byte; | 216 | data.byte = vdec[i].byte; |
214 | if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x6c, 0, I2C_SMBUS_WRITE, vdec[i].adr, I2C_SMBUS_BYTE_DATA, &data)) { | 217 | if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x6c, 0, I2C_SMBUS_WRITE, vdec[i].adr, I2C_SMBUS_BYTE_DATA, &data)) { |
215 | printk("hexium_init_done: hexium_set_standard() failed for address 0x%02x\n", i); | 218 | pr_err("hexium_init_done: hexium_set_standard() failed for address 0x%02x\n", |
219 | i); | ||
216 | return -1; | 220 | return -1; |
217 | } | 221 | } |
218 | i++; | 222 | i++; |
@@ -222,14 +226,14 @@ static int hexium_set_standard(struct hexium *hexium, struct hexium_data *vdec) | |||
222 | 226 | ||
223 | static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) | 227 | static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) |
224 | { | 228 | { |
225 | DEB_EE(("VIDIOC_ENUMINPUT %d.\n", i->index)); | 229 | DEB_EE("VIDIOC_ENUMINPUT %d\n", i->index); |
226 | 230 | ||
227 | if (i->index >= HEXIUM_INPUTS) | 231 | if (i->index >= HEXIUM_INPUTS) |
228 | return -EINVAL; | 232 | return -EINVAL; |
229 | 233 | ||
230 | memcpy(i, &hexium_inputs[i->index], sizeof(struct v4l2_input)); | 234 | memcpy(i, &hexium_inputs[i->index], sizeof(struct v4l2_input)); |
231 | 235 | ||
232 | DEB_D(("v4l2_ioctl: VIDIOC_ENUMINPUT %d.\n", i->index)); | 236 | DEB_D("v4l2_ioctl: VIDIOC_ENUMINPUT %d\n", i->index); |
233 | return 0; | 237 | return 0; |
234 | } | 238 | } |
235 | 239 | ||
@@ -240,7 +244,7 @@ static int vidioc_g_input(struct file *file, void *fh, unsigned int *input) | |||
240 | 244 | ||
241 | *input = hexium->cur_input; | 245 | *input = hexium->cur_input; |
242 | 246 | ||
243 | DEB_D(("VIDIOC_G_INPUT: %d\n", *input)); | 247 | DEB_D("VIDIOC_G_INPUT: %d\n", *input); |
244 | return 0; | 248 | return 0; |
245 | } | 249 | } |
246 | 250 | ||
@@ -249,7 +253,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input) | |||
249 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; | 253 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; |
250 | struct hexium *hexium = (struct hexium *) dev->ext_priv; | 254 | struct hexium *hexium = (struct hexium *) dev->ext_priv; |
251 | 255 | ||
252 | DEB_EE(("VIDIOC_S_INPUT %d.\n", input)); | 256 | DEB_EE("VIDIOC_S_INPUT %d\n", input); |
253 | 257 | ||
254 | if (input >= HEXIUM_INPUTS) | 258 | if (input >= HEXIUM_INPUTS) |
255 | return -EINVAL; | 259 | return -EINVAL; |
@@ -270,7 +274,7 @@ static int vidioc_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl * | |||
270 | for (i = HEXIUM_CONTROLS - 1; i >= 0; i--) { | 274 | for (i = HEXIUM_CONTROLS - 1; i >= 0; i--) { |
271 | if (hexium_controls[i].id == qc->id) { | 275 | if (hexium_controls[i].id == qc->id) { |
272 | *qc = hexium_controls[i]; | 276 | *qc = hexium_controls[i]; |
273 | DEB_D(("VIDIOC_QUERYCTRL %d.\n", qc->id)); | 277 | DEB_D("VIDIOC_QUERYCTRL %d\n", qc->id); |
274 | return 0; | 278 | return 0; |
275 | } | 279 | } |
276 | } | 280 | } |
@@ -293,7 +297,7 @@ static int vidioc_g_ctrl(struct file *file, void *fh, struct v4l2_control *vc) | |||
293 | 297 | ||
294 | if (vc->id == V4L2_CID_PRIVATE_BASE) { | 298 | if (vc->id == V4L2_CID_PRIVATE_BASE) { |
295 | vc->value = hexium->cur_bw; | 299 | vc->value = hexium->cur_bw; |
296 | DEB_D(("VIDIOC_G_CTRL BW:%d.\n", vc->value)); | 300 | DEB_D("VIDIOC_G_CTRL BW:%d\n", vc->value); |
297 | return 0; | 301 | return 0; |
298 | } | 302 | } |
299 | return -EINVAL; | 303 | return -EINVAL; |
@@ -316,7 +320,7 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *vc) | |||
316 | if (vc->id == V4L2_CID_PRIVATE_BASE) | 320 | if (vc->id == V4L2_CID_PRIVATE_BASE) |
317 | hexium->cur_bw = vc->value; | 321 | hexium->cur_bw = vc->value; |
318 | 322 | ||
319 | DEB_D(("VIDIOC_S_CTRL BW:%d.\n", hexium->cur_bw)); | 323 | DEB_D("VIDIOC_S_CTRL BW:%d\n", hexium->cur_bw); |
320 | 324 | ||
321 | if (0 == hexium->cur_bw && V4L2_STD_PAL == hexium->cur_std) { | 325 | if (0 == hexium->cur_bw && V4L2_STD_PAL == hexium->cur_std) { |
322 | hexium_set_standard(hexium, hexium_pal); | 326 | hexium_set_standard(hexium, hexium_pal); |
@@ -354,11 +358,11 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d | |||
354 | struct hexium *hexium; | 358 | struct hexium *hexium; |
355 | int ret; | 359 | int ret; |
356 | 360 | ||
357 | DEB_EE((".\n")); | 361 | DEB_EE("\n"); |
358 | 362 | ||
359 | hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); | 363 | hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); |
360 | if (NULL == hexium) { | 364 | if (NULL == hexium) { |
361 | printk("hexium_gemini: not enough kernel memory in hexium_attach().\n"); | 365 | pr_err("not enough kernel memory in hexium_attach()\n"); |
362 | return -ENOMEM; | 366 | return -ENOMEM; |
363 | } | 367 | } |
364 | dev->ext_priv = hexium; | 368 | dev->ext_priv = hexium; |
@@ -371,7 +375,7 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d | |||
371 | }; | 375 | }; |
372 | saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); | 376 | saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); |
373 | if (i2c_add_adapter(&hexium->i2c_adapter) < 0) { | 377 | if (i2c_add_adapter(&hexium->i2c_adapter) < 0) { |
374 | DEB_S(("cannot register i2c-device. skipping.\n")); | 378 | DEB_S("cannot register i2c-device. skipping.\n"); |
375 | kfree(hexium); | 379 | kfree(hexium); |
376 | return -EFAULT; | 380 | return -EFAULT; |
377 | } | 381 | } |
@@ -402,11 +406,11 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d | |||
402 | vv_data.ops.vidioc_s_input = vidioc_s_input; | 406 | vv_data.ops.vidioc_s_input = vidioc_s_input; |
403 | ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER); | 407 | ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER); |
404 | if (ret < 0) { | 408 | if (ret < 0) { |
405 | printk("hexium_gemini: cannot register capture v4l2 device. skipping.\n"); | 409 | pr_err("cannot register capture v4l2 device. skipping.\n"); |
406 | return ret; | 410 | return ret; |
407 | } | 411 | } |
408 | 412 | ||
409 | printk("hexium_gemini: found 'hexium gemini' frame grabber-%d.\n", hexium_num); | 413 | pr_info("found 'hexium gemini' frame grabber-%d\n", hexium_num); |
410 | hexium_num++; | 414 | hexium_num++; |
411 | 415 | ||
412 | return 0; | 416 | return 0; |
@@ -416,7 +420,7 @@ static int hexium_detach(struct saa7146_dev *dev) | |||
416 | { | 420 | { |
417 | struct hexium *hexium = (struct hexium *) dev->ext_priv; | 421 | struct hexium *hexium = (struct hexium *) dev->ext_priv; |
418 | 422 | ||
419 | DEB_EE(("dev:%p\n", dev)); | 423 | DEB_EE("dev:%p\n", dev); |
420 | 424 | ||
421 | saa7146_unregister_device(&hexium->video_dev, dev); | 425 | saa7146_unregister_device(&hexium->video_dev, dev); |
422 | saa7146_vv_release(dev); | 426 | saa7146_vv_release(dev); |
@@ -508,7 +512,7 @@ static struct saa7146_extension hexium_extension = { | |||
508 | static int __init hexium_init_module(void) | 512 | static int __init hexium_init_module(void) |
509 | { | 513 | { |
510 | if (0 != saa7146_register_extension(&hexium_extension)) { | 514 | if (0 != saa7146_register_extension(&hexium_extension)) { |
511 | DEB_S(("failed to register extension.\n")); | 515 | DEB_S("failed to register extension\n"); |
512 | return -ENODEV; | 516 | return -ENODEV; |
513 | } | 517 | } |
514 | 518 | ||
diff --git a/drivers/media/video/hexium_orion.c b/drivers/media/video/hexium_orion.c index 6ad7e1c8b922..74861a4b601a 100644 --- a/drivers/media/video/hexium_orion.c +++ b/drivers/media/video/hexium_orion.c | |||
@@ -21,6 +21,8 @@ | |||
21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
25 | |||
24 | #define DEBUG_VARIABLE debug | 26 | #define DEBUG_VARIABLE debug |
25 | 27 | ||
26 | #include <media/saa7146_vv.h> | 28 | #include <media/saa7146_vv.h> |
@@ -209,7 +211,7 @@ static int hexium_probe(struct saa7146_dev *dev) | |||
209 | union i2c_smbus_data data; | 211 | union i2c_smbus_data data; |
210 | int err = 0; | 212 | int err = 0; |
211 | 213 | ||
212 | DEB_EE((".\n")); | 214 | DEB_EE("\n"); |
213 | 215 | ||
214 | /* there are no hexium orion cards with revision 0 saa7146s */ | 216 | /* there are no hexium orion cards with revision 0 saa7146s */ |
215 | if (0 == dev->revision) { | 217 | if (0 == dev->revision) { |
@@ -218,7 +220,7 @@ static int hexium_probe(struct saa7146_dev *dev) | |||
218 | 220 | ||
219 | hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); | 221 | hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); |
220 | if (NULL == hexium) { | 222 | if (NULL == hexium) { |
221 | printk("hexium_orion: hexium_probe: not enough kernel memory.\n"); | 223 | pr_err("hexium_probe: not enough kernel memory\n"); |
222 | return -ENOMEM; | 224 | return -ENOMEM; |
223 | } | 225 | } |
224 | 226 | ||
@@ -234,7 +236,7 @@ static int hexium_probe(struct saa7146_dev *dev) | |||
234 | }; | 236 | }; |
235 | saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); | 237 | saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); |
236 | if (i2c_add_adapter(&hexium->i2c_adapter) < 0) { | 238 | if (i2c_add_adapter(&hexium->i2c_adapter) < 0) { |
237 | DEB_S(("cannot register i2c-device. skipping.\n")); | 239 | DEB_S("cannot register i2c-device. skipping.\n"); |
238 | kfree(hexium); | 240 | kfree(hexium); |
239 | return -EFAULT; | 241 | return -EFAULT; |
240 | } | 242 | } |
@@ -248,7 +250,7 @@ static int hexium_probe(struct saa7146_dev *dev) | |||
248 | 250 | ||
249 | /* detect newer Hexium Orion cards by subsystem ids */ | 251 | /* detect newer Hexium Orion cards by subsystem ids */ |
250 | if (0x17c8 == dev->pci->subsystem_vendor && 0x0101 == dev->pci->subsystem_device) { | 252 | if (0x17c8 == dev->pci->subsystem_vendor && 0x0101 == dev->pci->subsystem_device) { |
251 | printk("hexium_orion: device is a Hexium Orion w/ 1 SVHS + 3 BNC inputs.\n"); | 253 | pr_info("device is a Hexium Orion w/ 1 SVHS + 3 BNC inputs\n"); |
252 | /* we store the pointer in our private data field */ | 254 | /* we store the pointer in our private data field */ |
253 | dev->ext_priv = hexium; | 255 | dev->ext_priv = hexium; |
254 | hexium->type = HEXIUM_ORION_1SVHS_3BNC; | 256 | hexium->type = HEXIUM_ORION_1SVHS_3BNC; |
@@ -256,7 +258,7 @@ static int hexium_probe(struct saa7146_dev *dev) | |||
256 | } | 258 | } |
257 | 259 | ||
258 | if (0x17c8 == dev->pci->subsystem_vendor && 0x2101 == dev->pci->subsystem_device) { | 260 | if (0x17c8 == dev->pci->subsystem_vendor && 0x2101 == dev->pci->subsystem_device) { |
259 | printk("hexium_orion: device is a Hexium Orion w/ 4 BNC inputs.\n"); | 261 | pr_info("device is a Hexium Orion w/ 4 BNC inputs\n"); |
260 | /* we store the pointer in our private data field */ | 262 | /* we store the pointer in our private data field */ |
261 | dev->ext_priv = hexium; | 263 | dev->ext_priv = hexium; |
262 | hexium->type = HEXIUM_ORION_4BNC; | 264 | hexium->type = HEXIUM_ORION_4BNC; |
@@ -266,7 +268,7 @@ static int hexium_probe(struct saa7146_dev *dev) | |||
266 | /* check if this is an old hexium Orion card by looking at | 268 | /* check if this is an old hexium Orion card by looking at |
267 | a saa7110 at address 0x4e */ | 269 | a saa7110 at address 0x4e */ |
268 | if (0 == (err = i2c_smbus_xfer(&hexium->i2c_adapter, 0x4e, 0, I2C_SMBUS_READ, 0x00, I2C_SMBUS_BYTE_DATA, &data))) { | 270 | if (0 == (err = i2c_smbus_xfer(&hexium->i2c_adapter, 0x4e, 0, I2C_SMBUS_READ, 0x00, I2C_SMBUS_BYTE_DATA, &data))) { |
269 | printk("hexium_orion: device is a Hexium HV-PCI6/Orion (old).\n"); | 271 | pr_info("device is a Hexium HV-PCI6/Orion (old)\n"); |
270 | /* we store the pointer in our private data field */ | 272 | /* we store the pointer in our private data field */ |
271 | dev->ext_priv = hexium; | 273 | dev->ext_priv = hexium; |
272 | hexium->type = HEXIUM_HV_PCI6_ORION; | 274 | hexium->type = HEXIUM_HV_PCI6_ORION; |
@@ -288,13 +290,13 @@ static int hexium_init_done(struct saa7146_dev *dev) | |||
288 | union i2c_smbus_data data; | 290 | union i2c_smbus_data data; |
289 | int i = 0; | 291 | int i = 0; |
290 | 292 | ||
291 | DEB_D(("hexium_init_done called.\n")); | 293 | DEB_D("hexium_init_done called\n"); |
292 | 294 | ||
293 | /* initialize the helper ics to useful values */ | 295 | /* initialize the helper ics to useful values */ |
294 | for (i = 0; i < sizeof(hexium_saa7110); i++) { | 296 | for (i = 0; i < sizeof(hexium_saa7110); i++) { |
295 | data.byte = hexium_saa7110[i]; | 297 | data.byte = hexium_saa7110[i]; |
296 | if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x4e, 0, I2C_SMBUS_WRITE, i, I2C_SMBUS_BYTE_DATA, &data)) { | 298 | if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x4e, 0, I2C_SMBUS_WRITE, i, I2C_SMBUS_BYTE_DATA, &data)) { |
297 | printk("hexium_orion: failed for address 0x%02x\n", i); | 299 | pr_err("failed for address 0x%02x\n", i); |
298 | } | 300 | } |
299 | } | 301 | } |
300 | 302 | ||
@@ -306,7 +308,7 @@ static int hexium_set_input(struct hexium *hexium, int input) | |||
306 | union i2c_smbus_data data; | 308 | union i2c_smbus_data data; |
307 | int i = 0; | 309 | int i = 0; |
308 | 310 | ||
309 | DEB_D((".\n")); | 311 | DEB_D("\n"); |
310 | 312 | ||
311 | for (i = 0; i < 8; i++) { | 313 | for (i = 0; i < 8; i++) { |
312 | int adr = hexium_input_select[input].data[i].adr; | 314 | int adr = hexium_input_select[input].data[i].adr; |
@@ -314,7 +316,7 @@ static int hexium_set_input(struct hexium *hexium, int input) | |||
314 | if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x4e, 0, I2C_SMBUS_WRITE, adr, I2C_SMBUS_BYTE_DATA, &data)) { | 316 | if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x4e, 0, I2C_SMBUS_WRITE, adr, I2C_SMBUS_BYTE_DATA, &data)) { |
315 | return -1; | 317 | return -1; |
316 | } | 318 | } |
317 | printk("%d: 0x%02x => 0x%02x\n",input, adr,data.byte); | 319 | pr_debug("%d: 0x%02x => 0x%02x\n", input, adr, data.byte); |
318 | } | 320 | } |
319 | 321 | ||
320 | return 0; | 322 | return 0; |
@@ -322,14 +324,14 @@ static int hexium_set_input(struct hexium *hexium, int input) | |||
322 | 324 | ||
323 | static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) | 325 | static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) |
324 | { | 326 | { |
325 | DEB_EE(("VIDIOC_ENUMINPUT %d.\n", i->index)); | 327 | DEB_EE("VIDIOC_ENUMINPUT %d\n", i->index); |
326 | 328 | ||
327 | if (i->index >= HEXIUM_INPUTS) | 329 | if (i->index >= HEXIUM_INPUTS) |
328 | return -EINVAL; | 330 | return -EINVAL; |
329 | 331 | ||
330 | memcpy(i, &hexium_inputs[i->index], sizeof(struct v4l2_input)); | 332 | memcpy(i, &hexium_inputs[i->index], sizeof(struct v4l2_input)); |
331 | 333 | ||
332 | DEB_D(("v4l2_ioctl: VIDIOC_ENUMINPUT %d.\n", i->index)); | 334 | DEB_D("v4l2_ioctl: VIDIOC_ENUMINPUT %d\n", i->index); |
333 | return 0; | 335 | return 0; |
334 | } | 336 | } |
335 | 337 | ||
@@ -340,7 +342,7 @@ static int vidioc_g_input(struct file *file, void *fh, unsigned int *input) | |||
340 | 342 | ||
341 | *input = hexium->cur_input; | 343 | *input = hexium->cur_input; |
342 | 344 | ||
343 | DEB_D(("VIDIOC_G_INPUT: %d\n", *input)); | 345 | DEB_D("VIDIOC_G_INPUT: %d\n", *input); |
344 | return 0; | 346 | return 0; |
345 | } | 347 | } |
346 | 348 | ||
@@ -365,18 +367,18 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d | |||
365 | { | 367 | { |
366 | struct hexium *hexium = (struct hexium *) dev->ext_priv; | 368 | struct hexium *hexium = (struct hexium *) dev->ext_priv; |
367 | 369 | ||
368 | DEB_EE((".\n")); | 370 | DEB_EE("\n"); |
369 | 371 | ||
370 | saa7146_vv_init(dev, &vv_data); | 372 | saa7146_vv_init(dev, &vv_data); |
371 | vv_data.ops.vidioc_enum_input = vidioc_enum_input; | 373 | vv_data.ops.vidioc_enum_input = vidioc_enum_input; |
372 | vv_data.ops.vidioc_g_input = vidioc_g_input; | 374 | vv_data.ops.vidioc_g_input = vidioc_g_input; |
373 | vv_data.ops.vidioc_s_input = vidioc_s_input; | 375 | vv_data.ops.vidioc_s_input = vidioc_s_input; |
374 | if (0 != saa7146_register_device(&hexium->video_dev, dev, "hexium orion", VFL_TYPE_GRABBER)) { | 376 | if (0 != saa7146_register_device(&hexium->video_dev, dev, "hexium orion", VFL_TYPE_GRABBER)) { |
375 | printk("hexium_orion: cannot register capture v4l2 device. skipping.\n"); | 377 | pr_err("cannot register capture v4l2 device. skipping.\n"); |
376 | return -1; | 378 | return -1; |
377 | } | 379 | } |
378 | 380 | ||
379 | printk("hexium_orion: found 'hexium orion' frame grabber-%d.\n", hexium_num); | 381 | pr_err("found 'hexium orion' frame grabber-%d\n", hexium_num); |
380 | hexium_num++; | 382 | hexium_num++; |
381 | 383 | ||
382 | /* the rest */ | 384 | /* the rest */ |
@@ -390,7 +392,7 @@ static int hexium_detach(struct saa7146_dev *dev) | |||
390 | { | 392 | { |
391 | struct hexium *hexium = (struct hexium *) dev->ext_priv; | 393 | struct hexium *hexium = (struct hexium *) dev->ext_priv; |
392 | 394 | ||
393 | DEB_EE(("dev:%p\n", dev)); | 395 | DEB_EE("dev:%p\n", dev); |
394 | 396 | ||
395 | saa7146_unregister_device(&hexium->video_dev, dev); | 397 | saa7146_unregister_device(&hexium->video_dev, dev); |
396 | saa7146_vv_release(dev); | 398 | saa7146_vv_release(dev); |
@@ -479,7 +481,7 @@ static struct saa7146_extension extension = { | |||
479 | static int __init hexium_init_module(void) | 481 | static int __init hexium_init_module(void) |
480 | { | 482 | { |
481 | if (0 != saa7146_register_extension(&extension)) { | 483 | if (0 != saa7146_register_extension(&extension)) { |
482 | DEB_S(("failed to register extension.\n")); | 484 | DEB_S("failed to register extension\n"); |
483 | return -ENODEV; | 485 | return -ENODEV; |
484 | } | 486 | } |
485 | 487 | ||
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index 0b3850023505..f0c3968ac7eb 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
@@ -21,6 +21,8 @@ | |||
21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
25 | |||
24 | #define DEBUG_VARIABLE debug | 26 | #define DEBUG_VARIABLE debug |
25 | 27 | ||
26 | #include <media/saa7146_vv.h> | 28 | #include <media/saa7146_vv.h> |
@@ -171,7 +173,7 @@ static int mxb_probe(struct saa7146_dev *dev) | |||
171 | 173 | ||
172 | mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL); | 174 | mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL); |
173 | if (mxb == NULL) { | 175 | if (mxb == NULL) { |
174 | DEB_D(("not enough kernel memory.\n")); | 176 | DEB_D("not enough kernel memory\n"); |
175 | return -ENOMEM; | 177 | return -ENOMEM; |
176 | } | 178 | } |
177 | 179 | ||
@@ -179,7 +181,7 @@ static int mxb_probe(struct saa7146_dev *dev) | |||
179 | 181 | ||
180 | saa7146_i2c_adapter_prepare(dev, &mxb->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); | 182 | saa7146_i2c_adapter_prepare(dev, &mxb->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); |
181 | if (i2c_add_adapter(&mxb->i2c_adapter) < 0) { | 183 | if (i2c_add_adapter(&mxb->i2c_adapter) < 0) { |
182 | DEB_S(("cannot register i2c-device. skipping.\n")); | 184 | DEB_S("cannot register i2c-device. skipping.\n"); |
183 | kfree(mxb); | 185 | kfree(mxb); |
184 | return -EFAULT; | 186 | return -EFAULT; |
185 | } | 187 | } |
@@ -200,7 +202,7 @@ static int mxb_probe(struct saa7146_dev *dev) | |||
200 | /* check if all devices are present */ | 202 | /* check if all devices are present */ |
201 | if (!mxb->tea6420_1 || !mxb->tea6420_2 || !mxb->tea6415c || | 203 | if (!mxb->tea6420_1 || !mxb->tea6420_2 || !mxb->tea6415c || |
202 | !mxb->tda9840 || !mxb->saa7111a || !mxb->tuner) { | 204 | !mxb->tda9840 || !mxb->saa7111a || !mxb->tuner) { |
203 | printk("mxb: did not find all i2c devices. aborting\n"); | 205 | pr_err("did not find all i2c devices. aborting\n"); |
204 | i2c_del_adapter(&mxb->i2c_adapter); | 206 | i2c_del_adapter(&mxb->i2c_adapter); |
205 | kfree(mxb); | 207 | kfree(mxb); |
206 | return -ENODEV; | 208 | return -ENODEV; |
@@ -346,11 +348,11 @@ static int mxb_init_done(struct saa7146_dev* dev) | |||
346 | msg.buf = &mxb_saa7740_init[i].data[0]; | 348 | msg.buf = &mxb_saa7740_init[i].data[0]; |
347 | err = i2c_transfer(&mxb->i2c_adapter, &msg, 1); | 349 | err = i2c_transfer(&mxb->i2c_adapter, &msg, 1); |
348 | if (err != 1) { | 350 | if (err != 1) { |
349 | DEB_D(("failed to initialize 'sound arena module'.\n")); | 351 | DEB_D("failed to initialize 'sound arena module'\n"); |
350 | goto err; | 352 | goto err; |
351 | } | 353 | } |
352 | } | 354 | } |
353 | INFO(("'sound arena module' detected.\n")); | 355 | pr_info("'sound arena module' detected\n"); |
354 | } | 356 | } |
355 | err: | 357 | err: |
356 | /* the rest for saa7146: you should definitely set some basic values | 358 | /* the rest for saa7146: you should definitely set some basic values |
@@ -390,7 +392,7 @@ static int vidioc_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl * | |||
390 | for (i = MAXCONTROLS - 1; i >= 0; i--) { | 392 | for (i = MAXCONTROLS - 1; i >= 0; i--) { |
391 | if (mxb_controls[i].id == qc->id) { | 393 | if (mxb_controls[i].id == qc->id) { |
392 | *qc = mxb_controls[i]; | 394 | *qc = mxb_controls[i]; |
393 | DEB_D(("VIDIOC_QUERYCTRL %d.\n", qc->id)); | 395 | DEB_D("VIDIOC_QUERYCTRL %d\n", qc->id); |
394 | return 0; | 396 | return 0; |
395 | } | 397 | } |
396 | } | 398 | } |
@@ -413,11 +415,11 @@ static int vidioc_g_ctrl(struct file *file, void *fh, struct v4l2_control *vc) | |||
413 | 415 | ||
414 | if (vc->id == V4L2_CID_AUDIO_MUTE) { | 416 | if (vc->id == V4L2_CID_AUDIO_MUTE) { |
415 | vc->value = mxb->cur_mute; | 417 | vc->value = mxb->cur_mute; |
416 | DEB_D(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n", vc->value)); | 418 | DEB_D("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d\n", vc->value); |
417 | return 0; | 419 | return 0; |
418 | } | 420 | } |
419 | 421 | ||
420 | DEB_EE(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n", vc->value)); | 422 | DEB_EE("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d\n", vc->value); |
421 | return 0; | 423 | return 0; |
422 | } | 424 | } |
423 | 425 | ||
@@ -440,14 +442,14 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *vc) | |||
440 | /* switch the audio-source */ | 442 | /* switch the audio-source */ |
441 | tea6420_route_line(mxb, vc->value ? 6 : | 443 | tea6420_route_line(mxb, vc->value ? 6 : |
442 | video_audio_connect[mxb->cur_input]); | 444 | video_audio_connect[mxb->cur_input]); |
443 | DEB_EE(("VIDIOC_S_CTRL, V4L2_CID_AUDIO_MUTE: %d.\n", vc->value)); | 445 | DEB_EE("VIDIOC_S_CTRL, V4L2_CID_AUDIO_MUTE: %d\n", vc->value); |
444 | } | 446 | } |
445 | return 0; | 447 | return 0; |
446 | } | 448 | } |
447 | 449 | ||
448 | static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) | 450 | static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) |
449 | { | 451 | { |
450 | DEB_EE(("VIDIOC_ENUMINPUT %d.\n", i->index)); | 452 | DEB_EE("VIDIOC_ENUMINPUT %d\n", i->index); |
451 | if (i->index >= MXB_INPUTS) | 453 | if (i->index >= MXB_INPUTS) |
452 | return -EINVAL; | 454 | return -EINVAL; |
453 | memcpy(i, &mxb_inputs[i->index], sizeof(struct v4l2_input)); | 455 | memcpy(i, &mxb_inputs[i->index], sizeof(struct v4l2_input)); |
@@ -460,7 +462,7 @@ static int vidioc_g_input(struct file *file, void *fh, unsigned int *i) | |||
460 | struct mxb *mxb = (struct mxb *)dev->ext_priv; | 462 | struct mxb *mxb = (struct mxb *)dev->ext_priv; |
461 | *i = mxb->cur_input; | 463 | *i = mxb->cur_input; |
462 | 464 | ||
463 | DEB_EE(("VIDIOC_G_INPUT %d.\n", *i)); | 465 | DEB_EE("VIDIOC_G_INPUT %d\n", *i); |
464 | return 0; | 466 | return 0; |
465 | } | 467 | } |
466 | 468 | ||
@@ -471,7 +473,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input) | |||
471 | int err = 0; | 473 | int err = 0; |
472 | int i = 0; | 474 | int i = 0; |
473 | 475 | ||
474 | DEB_EE(("VIDIOC_S_INPUT %d.\n", input)); | 476 | DEB_EE("VIDIOC_S_INPUT %d\n", input); |
475 | 477 | ||
476 | if (input >= MXB_INPUTS) | 478 | if (input >= MXB_INPUTS) |
477 | return -EINVAL; | 479 | return -EINVAL; |
@@ -514,7 +516,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input) | |||
514 | 516 | ||
515 | /* switch video in saa7111a */ | 517 | /* switch video in saa7111a */ |
516 | if (saa7111a_call(mxb, video, s_routing, i, SAA7111_FMT_CCIR, 0)) | 518 | if (saa7111a_call(mxb, video, s_routing, i, SAA7111_FMT_CCIR, 0)) |
517 | printk(KERN_ERR "VIDIOC_S_INPUT: could not address saa7111a.\n"); | 519 | pr_err("VIDIOC_S_INPUT: could not address saa7111a\n"); |
518 | 520 | ||
519 | /* switch the audio-source only if necessary */ | 521 | /* switch the audio-source only if necessary */ |
520 | if (0 == mxb->cur_mute) | 522 | if (0 == mxb->cur_mute) |
@@ -529,11 +531,12 @@ static int vidioc_g_tuner(struct file *file, void *fh, struct v4l2_tuner *t) | |||
529 | struct mxb *mxb = (struct mxb *)dev->ext_priv; | 531 | struct mxb *mxb = (struct mxb *)dev->ext_priv; |
530 | 532 | ||
531 | if (t->index) { | 533 | if (t->index) { |
532 | DEB_D(("VIDIOC_G_TUNER: channel %d does not have a tuner attached.\n", t->index)); | 534 | DEB_D("VIDIOC_G_TUNER: channel %d does not have a tuner attached\n", |
535 | t->index); | ||
533 | return -EINVAL; | 536 | return -EINVAL; |
534 | } | 537 | } |
535 | 538 | ||
536 | DEB_EE(("VIDIOC_G_TUNER: %d\n", t->index)); | 539 | DEB_EE("VIDIOC_G_TUNER: %d\n", t->index); |
537 | 540 | ||
538 | memset(t, 0, sizeof(*t)); | 541 | memset(t, 0, sizeof(*t)); |
539 | strlcpy(t->name, "TV Tuner", sizeof(t->name)); | 542 | strlcpy(t->name, "TV Tuner", sizeof(t->name)); |
@@ -550,7 +553,8 @@ static int vidioc_s_tuner(struct file *file, void *fh, struct v4l2_tuner *t) | |||
550 | struct mxb *mxb = (struct mxb *)dev->ext_priv; | 553 | struct mxb *mxb = (struct mxb *)dev->ext_priv; |
551 | 554 | ||
552 | if (t->index) { | 555 | if (t->index) { |
553 | DEB_D(("VIDIOC_S_TUNER: channel %d does not have a tuner attached.\n", t->index)); | 556 | DEB_D("VIDIOC_S_TUNER: channel %d does not have a tuner attached\n", |
557 | t->index); | ||
554 | return -EINVAL; | 558 | return -EINVAL; |
555 | } | 559 | } |
556 | 560 | ||
@@ -564,14 +568,14 @@ static int vidioc_g_frequency(struct file *file, void *fh, struct v4l2_frequency | |||
564 | struct mxb *mxb = (struct mxb *)dev->ext_priv; | 568 | struct mxb *mxb = (struct mxb *)dev->ext_priv; |
565 | 569 | ||
566 | if (mxb->cur_input) { | 570 | if (mxb->cur_input) { |
567 | DEB_D(("VIDIOC_G_FREQ: channel %d does not have a tuner!\n", | 571 | DEB_D("VIDIOC_G_FREQ: channel %d does not have a tuner!\n", |
568 | mxb->cur_input)); | 572 | mxb->cur_input); |
569 | return -EINVAL; | 573 | return -EINVAL; |
570 | } | 574 | } |
571 | 575 | ||
572 | *f = mxb->cur_freq; | 576 | *f = mxb->cur_freq; |
573 | 577 | ||
574 | DEB_EE(("VIDIOC_G_FREQ: freq:0x%08x.\n", mxb->cur_freq.frequency)); | 578 | DEB_EE("VIDIOC_G_FREQ: freq:0x%08x\n", mxb->cur_freq.frequency); |
575 | return 0; | 579 | return 0; |
576 | } | 580 | } |
577 | 581 | ||
@@ -588,12 +592,13 @@ static int vidioc_s_frequency(struct file *file, void *fh, struct v4l2_frequency | |||
588 | return -EINVAL; | 592 | return -EINVAL; |
589 | 593 | ||
590 | if (mxb->cur_input) { | 594 | if (mxb->cur_input) { |
591 | DEB_D(("VIDIOC_S_FREQ: channel %d does not have a tuner!\n", mxb->cur_input)); | 595 | DEB_D("VIDIOC_S_FREQ: channel %d does not have a tuner!\n", |
596 | mxb->cur_input); | ||
592 | return -EINVAL; | 597 | return -EINVAL; |
593 | } | 598 | } |
594 | 599 | ||
595 | mxb->cur_freq = *f; | 600 | mxb->cur_freq = *f; |
596 | DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n", mxb->cur_freq.frequency)); | 601 | DEB_EE("VIDIOC_S_FREQUENCY: freq:0x%08x\n", mxb->cur_freq.frequency); |
597 | 602 | ||
598 | /* tune in desired frequency */ | 603 | /* tune in desired frequency */ |
599 | tuner_call(mxb, tuner, s_frequency, &mxb->cur_freq); | 604 | tuner_call(mxb, tuner, s_frequency, &mxb->cur_freq); |
@@ -612,18 +617,18 @@ static int vidioc_g_audio(struct file *file, void *fh, struct v4l2_audio *a) | |||
612 | struct mxb *mxb = (struct mxb *)dev->ext_priv; | 617 | struct mxb *mxb = (struct mxb *)dev->ext_priv; |
613 | 618 | ||
614 | if (a->index > MXB_INPUTS) { | 619 | if (a->index > MXB_INPUTS) { |
615 | DEB_D(("VIDIOC_G_AUDIO %d out of range.\n", a->index)); | 620 | DEB_D("VIDIOC_G_AUDIO %d out of range\n", a->index); |
616 | return -EINVAL; | 621 | return -EINVAL; |
617 | } | 622 | } |
618 | 623 | ||
619 | DEB_EE(("VIDIOC_G_AUDIO %d.\n", a->index)); | 624 | DEB_EE("VIDIOC_G_AUDIO %d\n", a->index); |
620 | memcpy(a, &mxb_audios[video_audio_connect[mxb->cur_input]], sizeof(struct v4l2_audio)); | 625 | memcpy(a, &mxb_audios[video_audio_connect[mxb->cur_input]], sizeof(struct v4l2_audio)); |
621 | return 0; | 626 | return 0; |
622 | } | 627 | } |
623 | 628 | ||
624 | static int vidioc_s_audio(struct file *file, void *fh, struct v4l2_audio *a) | 629 | static int vidioc_s_audio(struct file *file, void *fh, struct v4l2_audio *a) |
625 | { | 630 | { |
626 | DEB_D(("VIDIOC_S_AUDIO %d.\n", a->index)); | 631 | DEB_D("VIDIOC_S_AUDIO %d\n", a->index); |
627 | return 0; | 632 | return 0; |
628 | } | 633 | } |
629 | 634 | ||
@@ -655,11 +660,11 @@ static long vidioc_default(struct file *file, void *fh, bool valid_prio, | |||
655 | int i = *(int *)arg; | 660 | int i = *(int *)arg; |
656 | 661 | ||
657 | if (i < 0 || i >= MXB_AUDIOS) { | 662 | if (i < 0 || i >= MXB_AUDIOS) { |
658 | DEB_D(("illegal argument to MXB_S_AUDIO_CD: i:%d.\n", i)); | 663 | DEB_D("invalid argument to MXB_S_AUDIO_CD: i:%d\n", i); |
659 | return -EINVAL; | 664 | return -EINVAL; |
660 | } | 665 | } |
661 | 666 | ||
662 | DEB_EE(("MXB_S_AUDIO_CD: i:%d.\n", i)); | 667 | DEB_EE("MXB_S_AUDIO_CD: i:%d\n", i); |
663 | 668 | ||
664 | tea6420_route_cd(mxb, i); | 669 | tea6420_route_cd(mxb, i); |
665 | return 0; | 670 | return 0; |
@@ -669,17 +674,18 @@ static long vidioc_default(struct file *file, void *fh, bool valid_prio, | |||
669 | int i = *(int *)arg; | 674 | int i = *(int *)arg; |
670 | 675 | ||
671 | if (i < 0 || i >= MXB_AUDIOS) { | 676 | if (i < 0 || i >= MXB_AUDIOS) { |
672 | DEB_D(("illegal argument to MXB_S_AUDIO_LINE: i:%d.\n", i)); | 677 | DEB_D("invalid argument to MXB_S_AUDIO_LINE: i:%d\n", |
678 | i); | ||
673 | return -EINVAL; | 679 | return -EINVAL; |
674 | } | 680 | } |
675 | 681 | ||
676 | DEB_EE(("MXB_S_AUDIO_LINE: i:%d.\n", i)); | 682 | DEB_EE("MXB_S_AUDIO_LINE: i:%d\n", i); |
677 | tea6420_route_line(mxb, i); | 683 | tea6420_route_line(mxb, i); |
678 | return 0; | 684 | return 0; |
679 | } | 685 | } |
680 | default: | 686 | default: |
681 | /* | 687 | /* |
682 | DEB2(printk("does not handle this ioctl.\n")); | 688 | DEB2(pr_err("does not handle this ioctl\n")); |
683 | */ | 689 | */ |
684 | return -ENOIOCTLCMD; | 690 | return -ENOIOCTLCMD; |
685 | } | 691 | } |
@@ -693,7 +699,7 @@ static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data | |||
693 | { | 699 | { |
694 | struct mxb *mxb; | 700 | struct mxb *mxb; |
695 | 701 | ||
696 | DEB_EE(("dev:%p\n", dev)); | 702 | DEB_EE("dev:%p\n", dev); |
697 | 703 | ||
698 | saa7146_vv_init(dev, &vv_data); | 704 | saa7146_vv_init(dev, &vv_data); |
699 | if (mxb_probe(dev)) { | 705 | if (mxb_probe(dev)) { |
@@ -720,7 +726,7 @@ static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data | |||
720 | #endif | 726 | #endif |
721 | vv_data.ops.vidioc_default = vidioc_default; | 727 | vv_data.ops.vidioc_default = vidioc_default; |
722 | if (saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) { | 728 | if (saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) { |
723 | ERR(("cannot register capture v4l2 device. skipping.\n")); | 729 | ERR("cannot register capture v4l2 device. skipping.\n"); |
724 | saa7146_vv_release(dev); | 730 | saa7146_vv_release(dev); |
725 | return -1; | 731 | return -1; |
726 | } | 732 | } |
@@ -728,11 +734,11 @@ static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data | |||
728 | /* initialization stuff (vbi) (only for revision > 0 and for extensions which want it)*/ | 734 | /* initialization stuff (vbi) (only for revision > 0 and for extensions which want it)*/ |
729 | if (MXB_BOARD_CAN_DO_VBI(dev)) { | 735 | if (MXB_BOARD_CAN_DO_VBI(dev)) { |
730 | if (saa7146_register_device(&mxb->vbi_dev, dev, "mxb", VFL_TYPE_VBI)) { | 736 | if (saa7146_register_device(&mxb->vbi_dev, dev, "mxb", VFL_TYPE_VBI)) { |
731 | ERR(("cannot register vbi v4l2 device. skipping.\n")); | 737 | ERR("cannot register vbi v4l2 device. skipping.\n"); |
732 | } | 738 | } |
733 | } | 739 | } |
734 | 740 | ||
735 | printk("mxb: found Multimedia eXtension Board #%d.\n", mxb_num); | 741 | pr_info("found Multimedia eXtension Board #%d\n", mxb_num); |
736 | 742 | ||
737 | mxb_num++; | 743 | mxb_num++; |
738 | mxb_init_done(dev); | 744 | mxb_init_done(dev); |
@@ -743,7 +749,7 @@ static int mxb_detach(struct saa7146_dev *dev) | |||
743 | { | 749 | { |
744 | struct mxb *mxb = (struct mxb *)dev->ext_priv; | 750 | struct mxb *mxb = (struct mxb *)dev->ext_priv; |
745 | 751 | ||
746 | DEB_EE(("dev:%p\n", dev)); | 752 | DEB_EE("dev:%p\n", dev); |
747 | 753 | ||
748 | saa7146_unregister_device(&mxb->video_dev,dev); | 754 | saa7146_unregister_device(&mxb->video_dev,dev); |
749 | if (MXB_BOARD_CAN_DO_VBI(dev)) | 755 | if (MXB_BOARD_CAN_DO_VBI(dev)) |
@@ -765,7 +771,7 @@ static int std_callback(struct saa7146_dev *dev, struct saa7146_standard *standa | |||
765 | if (V4L2_STD_PAL_I == standard->id) { | 771 | if (V4L2_STD_PAL_I == standard->id) { |
766 | v4l2_std_id std = V4L2_STD_PAL_I; | 772 | v4l2_std_id std = V4L2_STD_PAL_I; |
767 | 773 | ||
768 | DEB_D(("VIDIOC_S_STD: setting mxb for PAL_I.\n")); | 774 | DEB_D("VIDIOC_S_STD: setting mxb for PAL_I\n"); |
769 | /* set the 7146 gpio register -- I don't know what this does exactly */ | 775 | /* set the 7146 gpio register -- I don't know what this does exactly */ |
770 | saa7146_write(dev, GPIO_CTRL, 0x00404050); | 776 | saa7146_write(dev, GPIO_CTRL, 0x00404050); |
771 | /* unset the 7111 gpio register -- I don't know what this does exactly */ | 777 | /* unset the 7111 gpio register -- I don't know what this does exactly */ |
@@ -774,7 +780,7 @@ static int std_callback(struct saa7146_dev *dev, struct saa7146_standard *standa | |||
774 | } else { | 780 | } else { |
775 | v4l2_std_id std = V4L2_STD_PAL_BG; | 781 | v4l2_std_id std = V4L2_STD_PAL_BG; |
776 | 782 | ||
777 | DEB_D(("VIDIOC_S_STD: setting mxb for PAL/NTSC/SECAM.\n")); | 783 | DEB_D("VIDIOC_S_STD: setting mxb for PAL/NTSC/SECAM\n"); |
778 | /* set the 7146 gpio register -- I don't know what this does exactly */ | 784 | /* set the 7146 gpio register -- I don't know what this does exactly */ |
779 | saa7146_write(dev, GPIO_CTRL, 0x00404050); | 785 | saa7146_write(dev, GPIO_CTRL, 0x00404050); |
780 | /* set the 7111 gpio register -- I don't know what this does exactly */ | 786 | /* set the 7111 gpio register -- I don't know what this does exactly */ |
@@ -852,7 +858,7 @@ static struct saa7146_extension extension = { | |||
852 | static int __init mxb_init_module(void) | 858 | static int __init mxb_init_module(void) |
853 | { | 859 | { |
854 | if (saa7146_register_extension(&extension)) { | 860 | if (saa7146_register_extension(&extension)) { |
855 | DEB_S(("failed to register extension.\n")); | 861 | DEB_S("failed to register extension\n"); |
856 | return -ENODEV; | 862 | return -ENODEV; |
857 | } | 863 | } |
858 | 864 | ||
diff --git a/include/media/saa7146.h b/include/media/saa7146.h index 79827143d5ac..5017500eda1b 100644 --- a/include/media/saa7146.h +++ b/include/media/saa7146.h | |||
@@ -25,24 +25,32 @@ | |||
25 | 25 | ||
26 | extern unsigned int saa7146_debug; | 26 | extern unsigned int saa7146_debug; |
27 | 27 | ||
28 | //#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),KBUILD_MODNAME,__func__) | ||
29 | |||
30 | #ifndef DEBUG_VARIABLE | 28 | #ifndef DEBUG_VARIABLE |
31 | #define DEBUG_VARIABLE saa7146_debug | 29 | #define DEBUG_VARIABLE saa7146_debug |
32 | #endif | 30 | #endif |
33 | 31 | ||
34 | #define DEBUG_PROLOG printk("%s: %s(): ",KBUILD_MODNAME, __func__) | 32 | #define ERR(fmt, ...) pr_err("%s: " fmt, __func__, ##__VA_ARGS__) |
35 | #define INFO(x) { printk("%s: ",KBUILD_MODNAME); printk x; } | 33 | |
36 | 34 | #define _DBG(mask, fmt, ...) \ | |
37 | #define ERR(x) { DEBUG_PROLOG; printk x; } | 35 | do { \ |
38 | 36 | if (DEBUG_VARIABLE & mask) \ | |
39 | #define DEB_S(x) if (0!=(DEBUG_VARIABLE&0x01)) { DEBUG_PROLOG; printk x; } /* simple debug messages */ | 37 | pr_debug("%s(): " fmt, __func__, ##__VA_ARGS__); \ |
40 | #define DEB_D(x) if (0!=(DEBUG_VARIABLE&0x02)) { DEBUG_PROLOG; printk x; } /* more detailed debug messages */ | 38 | } while (0) |
41 | #define DEB_EE(x) if (0!=(DEBUG_VARIABLE&0x04)) { DEBUG_PROLOG; printk x; } /* print enter and exit of functions */ | 39 | |
42 | #define DEB_I2C(x) if (0!=(DEBUG_VARIABLE&0x08)) { DEBUG_PROLOG; printk x; } /* i2c debug messages */ | 40 | /* simple debug messages */ |
43 | #define DEB_VBI(x) if (0!=(DEBUG_VARIABLE&0x10)) { DEBUG_PROLOG; printk x; } /* vbi debug messages */ | 41 | #define DEB_S(fmt, ...) _DBG(0x01, fmt, ##__VA_ARGS__) |
44 | #define DEB_INT(x) if (0!=(DEBUG_VARIABLE&0x20)) { DEBUG_PROLOG; printk x; } /* interrupt debug messages */ | 42 | /* more detailed debug messages */ |
45 | #define DEB_CAP(x) if (0!=(DEBUG_VARIABLE&0x40)) { DEBUG_PROLOG; printk x; } /* capture debug messages */ | 43 | #define DEB_D(fmt, ...) _DBG(0x02, fmt, ##__VA_ARGS__) |
44 | /* print enter and exit of functions */ | ||
45 | #define DEB_EE(fmt, ...) _DBG(0x04, fmt, ##__VA_ARGS__) | ||
46 | /* i2c debug messages */ | ||
47 | #define DEB_I2C(fmt, ...) _DBG(0x08, fmt, ##__VA_ARGS__) | ||
48 | /* vbi debug messages */ | ||
49 | #define DEB_VBI(fmt, ...) _DBG(0x10, fmt, ##__VA_ARGS__) | ||
50 | /* interrupt debug messages */ | ||
51 | #define DEB_INT(fmt, ...) _DBG(0x20, fmt, ##__VA_ARGS__) | ||
52 | /* capture debug messages */ | ||
53 | #define DEB_CAP(fmt, ...) _DBG(0x40, fmt, ##__VA_ARGS__) | ||
46 | 54 | ||
47 | #define SAA7146_ISR_CLEAR(x,y) \ | 55 | #define SAA7146_ISR_CLEAR(x,y) \ |
48 | saa7146_write(x, ISR, (y)); | 56 | saa7146_write(x, ISR, (y)); |