aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7164
diff options
context:
space:
mode:
authorSteven Toth <stoth@kernellabs.com>2010-07-31 14:29:34 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-21 05:54:58 -0400
commitb31f1222990c02bccb73805648493b5e132a52f9 (patch)
treecc9ca91a3a3ea3592b458accffae5291734526f1 /drivers/media/video/saa7164
parentf6eeece8ec2a323f004265527282f443e083d25a (diff)
[media] saa7164: mundane buffer debugging changes to track issues
Code is removed in future patches in this set. Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7164')
-rw-r--r--drivers/media/video/saa7164/saa7164-buffer.c1
-rw-r--r--drivers/media/video/saa7164/saa7164-core.c33
-rw-r--r--drivers/media/video/saa7164/saa7164-encoder.c8
-rw-r--r--drivers/media/video/saa7164/saa7164.h3
4 files changed, 29 insertions, 16 deletions
diff --git a/drivers/media/video/saa7164/saa7164-buffer.c b/drivers/media/video/saa7164/saa7164-buffer.c
index 5f45ea7f3d7c..c7bd81e248f6 100644
--- a/drivers/media/video/saa7164/saa7164-buffer.c
+++ b/drivers/media/video/saa7164/saa7164-buffer.c
@@ -241,6 +241,7 @@ int saa7164_buffer_cfg_port(struct saa7164_port *port)
241 241
242 dprintk(DBGLVL_BUF, "%s(port=%d)\n", __func__, port->nr); 242 dprintk(DBGLVL_BUF, "%s(port=%d)\n", __func__, port->nr);
243 243
244 port->counter = 0;
244 saa7164_writel(port->bufcounter, 0); 245 saa7164_writel(port->bufcounter, 0);
245 saa7164_writel(port->pitch, params->pitch); 246 saa7164_writel(port->pitch, params->pitch);
246 saa7164_writel(port->bufsize, params->pitch * params->numberoflines); 247 saa7164_writel(port->bufsize, params->pitch * params->numberoflines);
diff --git a/drivers/media/video/saa7164/saa7164-core.c b/drivers/media/video/saa7164/saa7164-core.c
index ad619b325e96..09f7a64f538b 100644
--- a/drivers/media/video/saa7164/saa7164-core.c
+++ b/drivers/media/video/saa7164/saa7164-core.c
@@ -316,9 +316,9 @@ static void saa7164_work_enchandler(struct work_struct *w)
316 if (buf->idx == rp) { 316 if (buf->idx == rp) {
317 317
318 crc = crc32(0, buf->cpu, buf->actual_size); 318 crc = crc32(0, buf->cpu, buf->actual_size);
319 if (crc != port->shadow_crc[rp]) 319// if (crc != port->shadow_crc[rp])
320 printk(KERN_ERR "%s crc didn't match shadow was 0x%x now 0x%x\n", 320// printk(KERN_ERR "%s crc didn't match shadow was 0x%x now 0x%x\n",
321 __func__, port->shadow_crc[rp], crc); 321// __func__, port->shadow_crc[rp], crc);
322 322
323 /* Found the buffer, deal with it */ 323 /* Found the buffer, deal with it */
324 dprintk(DBGLVL_IRQ, "%s() wp: %d processing: %d crc32: 0x%x\n", 324 dprintk(DBGLVL_IRQ, "%s() wp: %d processing: %d crc32: 0x%x\n",
@@ -350,12 +350,6 @@ static void saa7164_work_enchandler(struct work_struct *w)
350 else 350 else
351 ok = 0; 351 ok = 0;
352 352
353 if (ok == 0)
354 printk(KERN_ERR
355 "rp: %d dmacrc: 0x%08x shadcrc: 0x%08x ubufcrc: 0x%08x %s\n",
356 rp, buf->crc, port->shadow_crc[rp], ubuf->crc,
357 ok ? "crcgood" : "crcbad");
358
359 /* Requeue the buffer on the free list */ 353 /* Requeue the buffer on the free list */
360 ubuf->pos = 0; 354 ubuf->pos = 0;
361 355
@@ -430,6 +424,7 @@ static irqreturn_t saa7164_irq_encoder(struct saa7164_port *port)
430 struct list_head *c, *n; 424 struct list_head *c, *n;
431 int wp, rp, i = 0; 425 int wp, rp, i = 0;
432 u8 *p; 426 u8 *p;
427 u32 *up, j;
433 428
434 /* Find the current write point from the hardware */ 429 /* Find the current write point from the hardware */
435 wp = saa7164_readl(port->bufcounter); 430 wp = saa7164_readl(port->bufcounter);
@@ -438,6 +433,8 @@ static irqreturn_t saa7164_irq_encoder(struct saa7164_port *port)
438 return 0; 433 return 0;
439 } 434 }
440 435
436 printk(KERN_ERR "port %p wp = %d\n", port, wp);
437
441 /* Find the previous buffer to the current write point */ 438 /* Find the previous buffer to the current write point */
442 if (wp == 0) 439 if (wp == 0)
443 rp = 7; 440 rp = 7;
@@ -449,6 +446,11 @@ static irqreturn_t saa7164_irq_encoder(struct saa7164_port *port)
449 return 0; 446 return 0;
450 } 447 }
451 448
449 if (rp == port->last_irq_rp) {
450 printk(KERN_ERR "%s() Duplicate rp = %d port %p\n",
451 __func__, rp, port);
452 }
453
452 if (rp != ((port->last_irq_rp + 1) % 8)) { 454 if (rp != ((port->last_irq_rp + 1) % 8)) {
453 printk(KERN_ERR "%s() Multiple bufs on interrupt, port %p\n", 455 printk(KERN_ERR "%s() Multiple bufs on interrupt, port %p\n",
454 __func__, port); 456 __func__, port);
@@ -503,16 +505,17 @@ static irqreturn_t saa7164_irq_encoder(struct saa7164_port *port)
503 } 505 }
504 506
505 if (buf->idx == rp) { 507 if (buf->idx == rp) {
506 508 up = (u32 *)port->shadow_buf[rp];
507 memcpy_fromio(port->shadow_buf[rp], buf->cpu, buf->actual_size); 509 for (j = 0 ; j < (buf->actual_size / sizeof(u32)); j++) {
508 510 *(up + j) = (rp << 28) | port->counter++;
511 }
509 port->shadow_crc[rp] = crc32(0, port->shadow_buf[rp], buf->actual_size); 512 port->shadow_crc[rp] = crc32(0, port->shadow_buf[rp], buf->actual_size);
510 513
511 buf->crc = crc32(0, buf->cpu, buf->actual_size); 514 buf->crc = crc32(0, buf->cpu, buf->actual_size);
512 515
513 if (port->shadow_crc[rp] != buf->crc) 516// if (port->shadow_crc[rp] != buf->crc)
514 printk(KERN_ERR "%s() crc check failed 0x%x vs 0x%x\n", 517// printk(KERN_ERR "%s() crc check failed 0x%x vs 0x%x\n",
515 __func__, port->shadow_crc[rp], buf->crc); 518// __func__, port->shadow_crc[rp], buf->crc);
516 break; 519 break;
517 } 520 }
518 521
diff --git a/drivers/media/video/saa7164/saa7164-encoder.c b/drivers/media/video/saa7164/saa7164-encoder.c
index 08b62e41c466..b904c61f8f81 100644
--- a/drivers/media/video/saa7164/saa7164-encoder.c
+++ b/drivers/media/video/saa7164/saa7164-encoder.c
@@ -1008,6 +1008,7 @@ struct saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port)
1008 struct saa7164_user_buffer *buf = 0; 1008 struct saa7164_user_buffer *buf = 0;
1009 struct saa7164_dev *dev = port->dev; 1009 struct saa7164_dev *dev = port->dev;
1010 u32 crc; 1010 u32 crc;
1011 u32 *d;
1011 1012
1012 mutex_lock(&port->dmaqueue_lock); 1013 mutex_lock(&port->dmaqueue_lock);
1013 if (!list_empty(&port->list_buf_used.list)) { 1014 if (!list_empty(&port->list_buf_used.list)) {
@@ -1020,6 +1021,13 @@ struct saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port)
1020 buf, buf->crc, crc); 1021 buf, buf->crc, crc);
1021 } 1022 }
1022 1023
1024 d = (u32 *)buf->data;
1025
1026 if ((*d & 0xffffff) > (port->read_counter + 0x2000))
1027 printk(KERN_ERR "%s() *d 0x%x port %p\n", __func__, *d, port);
1028
1029 port->read_counter = *d;
1030
1023 } 1031 }
1024 mutex_unlock(&port->dmaqueue_lock); 1032 mutex_unlock(&port->dmaqueue_lock);
1025 1033
diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h
index 80571e0e3d4b..58141dfed246 100644
--- a/drivers/media/video/saa7164/saa7164.h
+++ b/drivers/media/video/saa7164/saa7164.h
@@ -395,7 +395,8 @@ struct saa7164_port {
395 u8 *shadow_buf[8]; 395 u8 *shadow_buf[8];
396 u32 shadow_crc[8]; 396 u32 shadow_crc[8];
397 397
398 u32 dvd_pack_offset; 398 u32 counter;
399 u32 read_counter;
399}; 400};
400 401
401struct saa7164_dev { 402struct saa7164_dev {