aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-mailbox.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-11-21 23:23:22 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:38:11 -0500
commit2bb49f1b9f6a4f50222bc8a6b1e9df87a432c52c (patch)
tree0fa23a00811ba598d0a2f6ead3b14492b31fe6fb /drivers/media/video/cx18/cx18-mailbox.c
parentbca11a5721917d6d5874571813673a2669ffec4b (diff)
V4L/DVB (9727): cx18: Adjust outgoing mailbox timeouts and remove statistics logging
cx18: Adjust outgoing mailbox timeouts and remove statistics logging. This saves some wasted storage in struct cx18 for each card. Cutting the outgoing mailbox timeouts in half from the previous value appears to be safe with MythTV. Got rid of interrupted case code path after a wait uninterruptable returns. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-mailbox.c')
-rw-r--r--drivers/media/video/cx18/cx18-mailbox.c33
1 files changed, 8 insertions, 25 deletions
diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c
index abd39aaa345c..79647c6d6c55 100644
--- a/drivers/media/video/cx18/cx18-mailbox.c
+++ b/drivers/media/video/cx18/cx18-mailbox.c
@@ -462,13 +462,6 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu)
462 * Functions called from a non-interrupt, non work_queue context 462 * Functions called from a non-interrupt, non work_queue context
463 */ 463 */
464 464
465static void cx18_api_log_ack_delay(struct cx18 *cx, int msecs)
466{
467 if (msecs > CX18_MAX_MB_ACK_DELAY)
468 msecs = CX18_MAX_MB_ACK_DELAY;
469 atomic_inc(&cx->mbox_stats.mb_ack_delay[msecs]);
470}
471
472static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[]) 465static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
473{ 466{
474 const struct cx18_api_info *info = find_api_info(cmd); 467 const struct cx18_api_info *info = find_api_info(cmd);
@@ -523,7 +516,7 @@ static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
523 */ 516 */
524 state = cx18_readl(cx, xpu_state); 517 state = cx18_readl(cx, xpu_state);
525 req = cx18_readl(cx, &mb->request); 518 req = cx18_readl(cx, &mb->request);
526 timeout = msecs_to_jiffies(20); /* 1 field at 50 Hz vertical refresh */ 519 timeout = msecs_to_jiffies(10);
527 ret = wait_event_timeout(*waitq, 520 ret = wait_event_timeout(*waitq,
528 (ack = cx18_readl(cx, &mb->ack)) == req, 521 (ack = cx18_readl(cx, &mb->ack)) == req,
529 timeout); 522 timeout);
@@ -533,8 +526,8 @@ static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
533 CX18_ERR("mbox was found stuck busy when setting up for %s; " 526 CX18_ERR("mbox was found stuck busy when setting up for %s; "
534 "clearing busy and trying to proceed\n", info->name); 527 "clearing busy and trying to proceed\n", info->name);
535 } else if (ret != timeout) 528 } else if (ret != timeout)
536 CX18_DEBUG_API("waited %u usecs for busy mbox to be acked\n", 529 CX18_DEBUG_API("waited %u msecs for busy mbox to be acked\n",
537 jiffies_to_usecs(timeout-ret)); 530 jiffies_to_msecs(timeout-ret));
538 531
539 /* Build the outgoing mailbox */ 532 /* Build the outgoing mailbox */
540 req = ((req & 0xfffffffe) == 0xfffffffe) ? 1 : req + 1; 533 req = ((req & 0xfffffffe) == 0xfffffffe) ? 1 : req + 1;
@@ -548,10 +541,8 @@ static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
548 541
549 /* 542 /*
550 * Notify the XPU and wait for it to send an Ack back 543 * Notify the XPU and wait for it to send an Ack back
551 * 21 ms = ~ 0.5 frames at a frame rate of 24 fps
552 * 42 ms = ~ 1 frame at a frame rate of 24 fps
553 */ 544 */
554 timeout = msecs_to_jiffies((info->flags & API_FAST) ? 21 : 42); 545 timeout = msecs_to_jiffies((info->flags & API_FAST) ? 10 : 20);
555 546
556 CX18_DEBUG_HI_IRQ("sending interrupt SW1: %x to send %s\n", 547 CX18_DEBUG_HI_IRQ("sending interrupt SW1: %x to send %s\n",
557 irq, info->name); 548 irq, info->name);
@@ -561,27 +552,19 @@ static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
561 *waitq, 552 *waitq,
562 cx18_readl(cx, &mb->ack) == cx18_readl(cx, &mb->request), 553 cx18_readl(cx, &mb->ack) == cx18_readl(cx, &mb->request),
563 timeout); 554 timeout);
555
564 if (ret == 0) { 556 if (ret == 0) {
565 /* Timed out */ 557 /* Timed out */
566 mutex_unlock(mb_lock); 558 mutex_unlock(mb_lock);
567 i = jiffies_to_msecs(timeout);
568 cx18_api_log_ack_delay(cx, i);
569 CX18_WARN("sending %s timed out waiting %d msecs for RPU " 559 CX18_WARN("sending %s timed out waiting %d msecs for RPU "
570 "acknowledgement\n", info->name, i); 560 "acknowledgement\n",
561 info->name, jiffies_to_msecs(timeout));
571 return -EINVAL; 562 return -EINVAL;
572 } else if (ret < 0) {
573 /* Interrupted */
574 mutex_unlock(mb_lock);
575 CX18_WARN("sending %s was interrupted waiting for RPU"
576 "acknowledgement\n", info->name);
577 return -EINTR;
578 } 563 }
579 564
580 i = jiffies_to_msecs(timeout-ret);
581 cx18_api_log_ack_delay(cx, i);
582 if (ret != timeout) 565 if (ret != timeout)
583 CX18_DEBUG_HI_API("waited %u msecs for %s to be acked\n", 566 CX18_DEBUG_HI_API("waited %u msecs for %s to be acked\n",
584 i, info->name); 567 jiffies_to_msecs(timeout-ret), info->name);
585 568
586 /* Collect data returned by the XPU */ 569 /* Collect data returned by the XPU */
587 for (i = 0; i < MAX_MB_ARGUMENTS; i++) 570 for (i = 0; i < MAX_MB_ARGUMENTS; i++)