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 /drivers/media/common | |
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>
Diffstat (limited to 'drivers/media/common')
-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 |
6 files changed, 257 insertions, 228 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 | ||