aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cx18/cx18-mailbox.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c
index de5e723fdf4..89c033112e1 100644
--- a/drivers/media/video/cx18/cx18-mailbox.c
+++ b/drivers/media/video/cx18/cx18-mailbox.c
@@ -98,21 +98,30 @@ static const struct cx18_api_info *find_api_info(u32 cmd)
98 return NULL; 98 return NULL;
99} 99}
100 100
101static void dump_mb(struct cx18 *cx, struct cx18_mailbox *mb, char *name) 101/* Call with buf of n*11+1 bytes */
102static char *u32arr2hex(u32 data[], int n, char *buf)
102{ 103{
103 char argstr[MAX_MB_ARGUMENTS*11+1];
104 char *p; 104 char *p;
105 int i; 105 int i;
106 106
107 for (i = 0, p = buf; i < n; i++, p += 11) {
108 /* kernel snprintf() appends '\0' always */
109 snprintf(p, 12, " %#010x", data[i]);
110 }
111 *p = '\0';
112 return buf;
113}
114
115static void dump_mb(struct cx18 *cx, struct cx18_mailbox *mb, char *name)
116{
117 char argstr[MAX_MB_ARGUMENTS*11+1];
118
107 if (!(cx18_debug & CX18_DBGFLG_API)) 119 if (!(cx18_debug & CX18_DBGFLG_API))
108 return; 120 return;
109 121
110 for (i = 0, p = argstr; i < MAX_MB_ARGUMENTS; i++, p += 11) {
111 /* kernel snprintf() appends '\0' always */
112 snprintf(p, 12, " %#010x", mb->args[i]);
113 }
114 CX18_DEBUG_API("%s: req %#010x ack %#010x cmd %#010x err %#010x args%s" 122 CX18_DEBUG_API("%s: req %#010x ack %#010x cmd %#010x err %#010x args%s"
115 "\n", name, mb->request, mb->ack, mb->cmd, mb->error, argstr); 123 "\n", name, mb->request, mb->ack, mb->cmd, mb->error,
124 u32arr2hex(mb->args, MAX_MB_ARGUMENTS, argstr));
116} 125}
117 126
118 127
@@ -439,7 +448,8 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu)
439 "incoming %s to EPU mailbox (sequence no. %u)" 448 "incoming %s to EPU mailbox (sequence no. %u)"
440 "\n", 449 "\n",
441 rpu_str[rpu], rpu_str[rpu], order_mb->request); 450 rpu_str[rpu], rpu_str[rpu], order_mb->request);
442 dump_mb(cx, order_mb, "incoming"); 451 if (cx18_debug & CX18_DBGFLG_WARN)
452 dump_mb(cx, order_mb, "incoming");
443 order->flags = CX18_F_EWO_MB_STALE_UPON_RECEIPT; 453 order->flags = CX18_F_EWO_MB_STALE_UPON_RECEIPT;
444 } 454 }
445 455
@@ -468,16 +478,24 @@ static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
468 struct mutex *mb_lock; 478 struct mutex *mb_lock;
469 long int timeout, ret; 479 long int timeout, ret;
470 int i; 480 int i;
481 char argstr[MAX_MB_ARGUMENTS*11+1];
471 482
472 if (info == NULL) { 483 if (info == NULL) {
473 CX18_WARN("unknown cmd %x\n", cmd); 484 CX18_WARN("unknown cmd %x\n", cmd);
474 return -EINVAL; 485 return -EINVAL;
475 } 486 }
476 487
477 if (cmd == CX18_CPU_DE_SET_MDL) 488 if (cx18_debug & CX18_DBGFLG_API) { /* only call u32arr2hex if needed */
478 CX18_DEBUG_HI_API("%s\n", info->name); 489 if (cmd == CX18_CPU_DE_SET_MDL) {
479 else 490 if (cx18_debug & CX18_DBGFLG_HIGHVOL)
480 CX18_DEBUG_API("%s\n", info->name); 491 CX18_DEBUG_HI_API("%s\tcmd %#010x args%s\n",
492 info->name, cmd,
493 u32arr2hex(data, args, argstr));
494 } else
495 CX18_DEBUG_API("%s\tcmd %#010x args%s\n",
496 info->name, cmd,
497 u32arr2hex(data, args, argstr));
498 }
481 499
482 switch (info->rpu) { 500 switch (info->rpu) {
483 case APU: 501 case APU: