Skip to content

Commit bd58df6

Browse files
hverkuilmchehab
authored andcommitted
V4L/DVB (5844): ivtv: add high volume debugging flag
Add support for high volume debug messages, allowing them to be turned on selectively. Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 90851fe commit bd58df6

File tree

4 files changed

+42
-25
lines changed

4 files changed

+42
-25
lines changed

drivers/media/video/ivtv/ivtv-driver.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ MODULE_PARM_DESC(secam, "Set SECAM standard: B, G, H, D, K, L, LC");
181181
MODULE_PARM_DESC(ntsc, "Set NTSC standard: M, J, K");
182182
MODULE_PARM_DESC(debug,
183183
"Debug level (bitmask). Default: errors only\n"
184-
"\t\t\t(debug = 511 gives full debugging)");
184+
"\t\t\t(debug = 1023 gives full debugging)");
185185
MODULE_PARM_DESC(ivtv_pci_latency,
186186
"Change the PCI latency to 64 if lower: 0 = No, 1 = Yes,\n"
187187
"\t\t\tDefault: Yes");
@@ -1325,9 +1325,9 @@ static int module_start(void)
13251325
return -1;
13261326
}
13271327

1328-
if (ivtv_debug < 0 || ivtv_debug > 511) {
1328+
if (ivtv_debug < 0 || ivtv_debug > 1023) {
13291329
ivtv_debug = 0;
1330-
printk(KERN_INFO "ivtv: debug value must be >= 0 and <= 511!\n");
1330+
printk(KERN_INFO "ivtv: debug value must be >= 0 and <= 1023!\n");
13311331
}
13321332

13331333
if (pci_register_driver(&ivtv_pci_driver)) {

drivers/media/video/ivtv/ivtv-driver.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ extern const u32 yuv_offset[4];
268268
#define IVTV_DBGFLG_IRQ (1 << 6)
269269
#define IVTV_DBGFLG_DEC (1 << 7)
270270
#define IVTV_DBGFLG_YUV (1 << 8)
271+
/* Flag to turn on high volume debugging */
272+
#define IVTV_DBGFLG_HIGHVOL (1 << 9)
271273

272274
/* NOTE: extra space before comma in 'itv->num , ## args' is required for
273275
gcc-2.95, otherwise it won't compile. */
@@ -286,6 +288,21 @@ extern const u32 yuv_offset[4];
286288
#define IVTV_DEBUG_DEC(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_DEC, "dec", fmt , ## args)
287289
#define IVTV_DEBUG_YUV(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_YUV, "yuv", fmt , ## args)
288290

291+
#define IVTV_DEBUG_HIGH_VOL(x, type, fmt, args...) \
292+
do { \
293+
if (((x) & ivtv_debug) && (ivtv_debug & IVTV_DBGFLG_HIGHVOL)) \
294+
printk(KERN_INFO "ivtv%d " type ": " fmt, itv->num , ## args); \
295+
} while (0)
296+
#define IVTV_DEBUG_HI_WARN(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_WARN, "warning", fmt , ## args)
297+
#define IVTV_DEBUG_HI_INFO(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_INFO, "info",fmt , ## args)
298+
#define IVTV_DEBUG_HI_API(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_API, "api", fmt , ## args)
299+
#define IVTV_DEBUG_HI_DMA(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_DMA, "dma", fmt , ## args)
300+
#define IVTV_DEBUG_HI_IOCTL(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_IOCTL, "ioctl", fmt , ## args)
301+
#define IVTV_DEBUG_HI_I2C(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_I2C, "i2c", fmt , ## args)
302+
#define IVTV_DEBUG_HI_IRQ(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_IRQ, "irq", fmt , ## args)
303+
#define IVTV_DEBUG_HI_DEC(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_DEC, "dec", fmt , ## args)
304+
#define IVTV_DEBUG_HI_YUV(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_YUV, "yuv", fmt , ## args)
305+
289306
#define IVTV_FB_DEBUG(x, type, fmt, args...) \
290307
do { \
291308
if ((x) & ivtv_debug) \

drivers/media/video/ivtv/ivtv-fileops.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ static ssize_t ivtv_read_pos(struct ivtv_stream *s, char __user *ubuf, size_t co
406406
ssize_t rc = count ? ivtv_read(s, ubuf, count, non_block) : 0;
407407
struct ivtv *itv = s->itv;
408408

409-
IVTV_DEBUG_INFO("read %zd from %s, got %zd\n", count, s->name, rc);
409+
IVTV_DEBUG_HI_INFO("read %zd from %s, got %zd\n", count, s->name, rc);
410410
if (rc > 0)
411411
pos += rc;
412412
return rc;
@@ -497,7 +497,7 @@ ssize_t ivtv_v4l2_read(struct file * filp, char __user *buf, size_t count, loff_
497497
struct ivtv_stream *s = &itv->streams[id->type];
498498
int rc;
499499

500-
IVTV_DEBUG_IOCTL("read %zd bytes from %s\n", count, s->name);
500+
IVTV_DEBUG_HI_IOCTL("read %zd bytes from %s\n", count, s->name);
501501

502502
rc = ivtv_start_capture(id);
503503
if (rc)
@@ -535,7 +535,7 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t c
535535
int rc;
536536
DEFINE_WAIT(wait);
537537

538-
IVTV_DEBUG_IOCTL("write %zd bytes to %s\n", count, s->name);
538+
IVTV_DEBUG_HI_IOCTL("write %zd bytes to %s\n", count, s->name);
539539

540540
if (s->type != IVTV_DEC_STREAM_TYPE_MPG &&
541541
s->type != IVTV_DEC_STREAM_TYPE_YUV &&
@@ -643,7 +643,7 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t c
643643
to transfer the rest. */
644644
if (count && !(filp->f_flags & O_NONBLOCK))
645645
goto retry;
646-
IVTV_DEBUG_INFO("Wrote %d bytes to %s (%d)\n", bytes_written, s->name, s->q_full.bytesused);
646+
IVTV_DEBUG_HI_INFO("Wrote %d bytes to %s (%d)\n", bytes_written, s->name, s->q_full.bytesused);
647647
return bytes_written;
648648
}
649649

drivers/media/video/ivtv/ivtv-irq.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ static void ivtv_pio_work_handler(struct ivtv *itv)
4848
struct list_head *p;
4949
int i = 0;
5050

51-
IVTV_DEBUG_DMA("ivtv_pio_work_handler\n");
51+
IVTV_DEBUG_HI_DMA("ivtv_pio_work_handler\n");
5252
if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS ||
5353
s->v4l2dev == NULL || !ivtv_use_pio(s)) {
5454
itv->cur_pio_stream = -1;
5555
/* trigger PIO complete user interrupt */
5656
write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44);
5757
return;
5858
}
59-
IVTV_DEBUG_DMA("Process PIO %s\n", s->name);
59+
IVTV_DEBUG_HI_DMA("Process PIO %s\n", s->name);
6060
buf = list_entry(s->q_dma.list.next, struct ivtv_buffer, list);
6161
list_for_each(p, &s->q_dma.list) {
6262
struct ivtv_buffer *buf = list_entry(p, struct ivtv_buffer, list);
@@ -187,7 +187,7 @@ static int stream_enc_dma_append(struct ivtv_stream *s, u32 data[CX2341X_MBOX_MA
187187
bytes_needed += UVsize;
188188
}
189189

190-
IVTV_DEBUG_DMA("%s %s: 0x%08x bytes at 0x%08x\n",
190+
IVTV_DEBUG_HI_DMA("%s %s: 0x%08x bytes at 0x%08x\n",
191191
ivtv_use_pio(s) ? "PIO" : "DMA", s->name, bytes_needed, offset);
192192

193193
rc = ivtv_queue_move(s, &s->q_free, &s->q_full, &s->q_predma, bytes_needed);
@@ -242,7 +242,7 @@ static void dma_post(struct ivtv_stream *s)
242242
u32 *u32buf;
243243
int x = 0;
244244

245-
IVTV_DEBUG_DMA("%s %s completed (%x)\n", ivtv_use_pio(s) ? "PIO" : "DMA",
245+
IVTV_DEBUG_HI_DMA("%s %s completed (%x)\n", ivtv_use_pio(s) ? "PIO" : "DMA",
246246
s->name, s->dma_offset);
247247
list_for_each(p, &s->q_dma.list) {
248248
buf = list_entry(p, struct ivtv_buffer, list);
@@ -321,7 +321,7 @@ void ivtv_dma_stream_dec_prepare(struct ivtv_stream *s, u32 offset, int lock)
321321
unsigned long flags = 0;
322322
int idx = 0;
323323

324-
IVTV_DEBUG_DMA("DEC PREPARE DMA %s: %08x %08x\n", s->name, s->q_predma.bytesused, offset);
324+
IVTV_DEBUG_HI_DMA("DEC PREPARE DMA %s: %08x %08x\n", s->name, s->q_predma.bytesused, offset);
325325
buf = list_entry(s->q_predma.list.next, struct ivtv_buffer, list);
326326
list_for_each(p, &s->q_predma.list) {
327327
struct ivtv_buffer *buf = list_entry(p, struct ivtv_buffer, list);
@@ -368,7 +368,7 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s)
368368
struct ivtv_stream *s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI];
369369
int i;
370370

371-
IVTV_DEBUG_DMA("start %s for %s\n", ivtv_use_dma(s) ? "DMA" : "PIO", s->name);
371+
IVTV_DEBUG_HI_DMA("start %s for %s\n", ivtv_use_dma(s) ? "DMA" : "PIO", s->name);
372372

373373
if (s->q_predma.bytesused)
374374
ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused);
@@ -397,7 +397,7 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s)
397397
itv->vbi.dma_offset = s_vbi->dma_offset;
398398
s_vbi->SG_length = 0;
399399
set_bit(IVTV_F_S_DMA_HAS_VBI, &s->s_flags);
400-
IVTV_DEBUG_DMA("include DMA for %s\n", s->name);
400+
IVTV_DEBUG_HI_DMA("include DMA for %s\n", s->name);
401401
}
402402

403403
/* Mark last buffer size for Interrupt flag */
@@ -431,7 +431,7 @@ static void ivtv_dma_dec_start(struct ivtv_stream *s)
431431

432432
if (s->q_predma.bytesused)
433433
ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused);
434-
IVTV_DEBUG_DMA("start DMA for %s\n", s->name);
434+
IVTV_DEBUG_HI_DMA("start DMA for %s\n", s->name);
435435
/* put SG Handle into register 0x0c */
436436
write_reg(s->SG_handle, IVTV_REG_DECDMAADDR);
437437
write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x01, IVTV_REG_DMAXFER);
@@ -447,7 +447,7 @@ static void ivtv_irq_dma_read(struct ivtv *itv)
447447
struct ivtv_buffer *buf;
448448
int hw_stream_type;
449449

450-
IVTV_DEBUG_IRQ("DEC DMA READ\n");
450+
IVTV_DEBUG_HI_IRQ("DEC DMA READ\n");
451451
del_timer(&itv->dma_timer);
452452
if (read_reg(IVTV_REG_DMASTATUS) & 0x14) {
453453
IVTV_DEBUG_WARN("DEC DMA ERROR %x\n", read_reg(IVTV_REG_DMASTATUS));
@@ -462,7 +462,7 @@ static void ivtv_irq_dma_read(struct ivtv *itv)
462462
s = &itv->streams[IVTV_DEC_STREAM_TYPE_MPG];
463463
hw_stream_type = 0;
464464
}
465-
IVTV_DEBUG_DMA("DEC DATA READ %s: %d\n", s->name, s->q_dma.bytesused);
465+
IVTV_DEBUG_HI_DMA("DEC DATA READ %s: %d\n", s->name, s->q_dma.bytesused);
466466

467467
ivtv_stream_sync_for_cpu(s);
468468

@@ -495,7 +495,7 @@ static void ivtv_irq_enc_dma_complete(struct ivtv *itv)
495495

496496
del_timer(&itv->dma_timer);
497497
ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, data);
498-
IVTV_DEBUG_IRQ("ENC DMA COMPLETE %x %d\n", data[0], data[1]);
498+
IVTV_DEBUG_HI_IRQ("ENC DMA COMPLETE %x %d\n", data[0], data[1]);
499499
if (test_and_clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags))
500500
data[1] = 3;
501501
else if (data[1] > 2)
@@ -532,7 +532,7 @@ static void ivtv_irq_enc_pio_complete(struct ivtv *itv)
532532
return;
533533
}
534534
s = &itv->streams[itv->cur_pio_stream];
535-
IVTV_DEBUG_IRQ("ENC PIO COMPLETE %s\n", s->name);
535+
IVTV_DEBUG_HI_IRQ("ENC PIO COMPLETE %s\n", s->name);
536536
s->SG_length = 0;
537537
clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags);
538538
clear_bit(IVTV_F_I_PIO, &itv->i_flags);
@@ -590,7 +590,7 @@ static void ivtv_irq_enc_start_cap(struct ivtv *itv)
590590

591591
/* Get DMA destination and size arguments from card */
592592
ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA, data);
593-
IVTV_DEBUG_IRQ("ENC START CAP %d: %08x %08x\n", data[0], data[1], data[2]);
593+
IVTV_DEBUG_HI_IRQ("ENC START CAP %d: %08x %08x\n", data[0], data[1], data[2]);
594594

595595
if (data[0] > 2 || data[1] == 0 || data[2] == 0) {
596596
IVTV_DEBUG_WARN("Unknown input: %08x %08x %08x\n",
@@ -610,7 +610,7 @@ static void ivtv_irq_enc_vbi_cap(struct ivtv *itv)
610610
u32 data[CX2341X_MBOX_MAX_DATA];
611611
struct ivtv_stream *s;
612612

613-
IVTV_DEBUG_IRQ("ENC START VBI CAP\n");
613+
IVTV_DEBUG_HI_IRQ("ENC START VBI CAP\n");
614614
s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI];
615615

616616
/* If more than two VBI buffers are pending, then
@@ -644,7 +644,7 @@ static void ivtv_irq_dec_vbi_reinsert(struct ivtv *itv)
644644
u32 data[CX2341X_MBOX_MAX_DATA];
645645
struct ivtv_stream *s = &itv->streams[IVTV_DEC_STREAM_TYPE_VBI];
646646

647-
IVTV_DEBUG_IRQ("DEC VBI REINSERT\n");
647+
IVTV_DEBUG_HI_IRQ("DEC VBI REINSERT\n");
648648
if (test_bit(IVTV_F_S_CLAIMED, &s->s_flags) &&
649649
!stream_enc_dma_append(s, data)) {
650650
set_bit(IVTV_F_S_PIO_PENDING, &s->s_flags);
@@ -669,7 +669,7 @@ static void ivtv_irq_dec_data_req(struct ivtv *itv)
669669
itv->dma_data_req_offset = data[1];
670670
s = &itv->streams[IVTV_DEC_STREAM_TYPE_MPG];
671671
}
672-
IVTV_DEBUG_IRQ("DEC DATA REQ %s: %d %08x %u\n", s->name, s->q_full.bytesused,
672+
IVTV_DEBUG_HI_IRQ("DEC DATA REQ %s: %d %08x %u\n", s->name, s->q_full.bytesused,
673673
itv->dma_data_req_offset, itv->dma_data_req_size);
674674
if (itv->dma_data_req_size == 0 || s->q_full.bytesused < itv->dma_data_req_size) {
675675
set_bit(IVTV_F_S_NEEDS_DATA, &s->s_flags);
@@ -791,10 +791,10 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id)
791791
/* Exclude interrupts noted below from the output, otherwise the log is flooded with
792792
these messages */
793793
if (combo & ~0xff6d0400)
794-
IVTV_DEBUG_IRQ("======= valid IRQ bits: 0x%08x ======\n", combo);
794+
IVTV_DEBUG_HI_IRQ("======= valid IRQ bits: 0x%08x ======\n", combo);
795795

796796
if (combo & IVTV_IRQ_DEC_DMA_COMPLETE) {
797-
IVTV_DEBUG_IRQ("DEC DMA COMPLETE\n");
797+
IVTV_DEBUG_HI_IRQ("DEC DMA COMPLETE\n");
798798
}
799799

800800
if (combo & IVTV_IRQ_DMA_READ) {

0 commit comments

Comments
 (0)