提交 1aa32c2f 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

V4L/DVB (6055): ivtv: improve debug messages

- add FILE debug flag for open/close/read/write/poll.
- show cmd for encoder/decoder command ioctl.
Signed-off-by: NHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 313e91e8
...@@ -186,8 +186,18 @@ MODULE_PARM_DESC(pal, "Set PAL standard: B, G, H, D, K, I, M, N, Nc, 60"); ...@@ -186,8 +186,18 @@ MODULE_PARM_DESC(pal, "Set PAL standard: B, G, H, D, K, I, M, N, Nc, 60");
MODULE_PARM_DESC(secam, "Set SECAM standard: B, G, H, D, K, L, LC"); MODULE_PARM_DESC(secam, "Set SECAM standard: B, G, H, D, K, L, LC");
MODULE_PARM_DESC(ntsc, "Set NTSC standard: M, J, K"); MODULE_PARM_DESC(ntsc, "Set NTSC standard: M, J, K");
MODULE_PARM_DESC(debug, MODULE_PARM_DESC(debug,
"Debug level (bitmask). Default: errors only\n" "Debug level (bitmask). Default: 0\n"
"\t\t\t(debug = 1023 gives full debugging)"); "\t\t\t 1/0x0001: warning\n"
"\t\t\t 2/0x0002: info\n"
"\t\t\t 4/0x0004: mailbox\n"
"\t\t\t 8/0x0008: ioctl\n"
"\t\t\t 16/0x0010: file\n"
"\t\t\t 32/0x0020: dma\n"
"\t\t\t 64/0x0040: irq\n"
"\t\t\t 128/0x0080: decoder\n"
"\t\t\t 256/0x0100: yuv\n"
"\t\t\t 512/0x0200: i2c\n"
"\t\t\t1024/0x0400: high volume\n");
MODULE_PARM_DESC(ivtv_pci_latency, MODULE_PARM_DESC(ivtv_pci_latency,
"Change the PCI latency to 64 if lower: 0 = No, 1 = Yes,\n" "Change the PCI latency to 64 if lower: 0 = No, 1 = Yes,\n"
"\t\t\tDefault: Yes"); "\t\t\tDefault: Yes");
...@@ -1354,9 +1364,9 @@ static int module_start(void) ...@@ -1354,9 +1364,9 @@ static int module_start(void)
return -1; return -1;
} }
if (ivtv_debug < 0 || ivtv_debug > 1023) { if (ivtv_debug < 0 || ivtv_debug > 2047) {
ivtv_debug = 0; ivtv_debug = 0;
printk(KERN_INFO "ivtv: Debug value must be >= 0 and <= 1023\n"); printk(KERN_INFO "ivtv: Debug value must be >= 0 and <= 2047\n");
} }
if (pci_register_driver(&ivtv_pci_driver)) { if (pci_register_driver(&ivtv_pci_driver)) {
......
...@@ -258,15 +258,16 @@ extern const u32 yuv_offset[4]; ...@@ -258,15 +258,16 @@ extern const u32 yuv_offset[4];
#define IVTV_DBGFLG_WARN (1 << 0) #define IVTV_DBGFLG_WARN (1 << 0)
#define IVTV_DBGFLG_INFO (1 << 1) #define IVTV_DBGFLG_INFO (1 << 1)
#define IVTV_DBGFLG_API (1 << 2) #define IVTV_DBGFLG_MB (1 << 2)
#define IVTV_DBGFLG_DMA (1 << 3) #define IVTV_DBGFLG_IOCTL (1 << 3)
#define IVTV_DBGFLG_IOCTL (1 << 4) #define IVTV_DBGFLG_FILE (1 << 4)
#define IVTV_DBGFLG_I2C (1 << 5) #define IVTV_DBGFLG_DMA (1 << 5)
#define IVTV_DBGFLG_IRQ (1 << 6) #define IVTV_DBGFLG_IRQ (1 << 6)
#define IVTV_DBGFLG_DEC (1 << 7) #define IVTV_DBGFLG_DEC (1 << 7)
#define IVTV_DBGFLG_YUV (1 << 8) #define IVTV_DBGFLG_YUV (1 << 8)
#define IVTV_DBGFLG_I2C (1 << 9)
/* Flag to turn on high volume debugging */ /* Flag to turn on high volume debugging */
#define IVTV_DBGFLG_HIGHVOL (1 << 9) #define IVTV_DBGFLG_HIGHVOL (1 << 10)
/* NOTE: extra space before comma in 'itv->num , ## args' is required for /* NOTE: extra space before comma in 'itv->num , ## args' is required for
gcc-2.95, otherwise it won't compile. */ gcc-2.95, otherwise it won't compile. */
...@@ -275,11 +276,12 @@ extern const u32 yuv_offset[4]; ...@@ -275,11 +276,12 @@ extern const u32 yuv_offset[4];
if ((x) & ivtv_debug) \ if ((x) & ivtv_debug) \
printk(KERN_INFO "ivtv%d " type ": " fmt, itv->num , ## args); \ printk(KERN_INFO "ivtv%d " type ": " fmt, itv->num , ## args); \
} while (0) } while (0)
#define IVTV_DEBUG_WARN(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_WARN, "warning", fmt , ## args) #define IVTV_DEBUG_WARN(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_WARN, "warn", fmt , ## args)
#define IVTV_DEBUG_INFO(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_INFO, "info",fmt , ## args) #define IVTV_DEBUG_INFO(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_INFO, "info", fmt , ## args)
#define IVTV_DEBUG_API(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_API, "api", fmt , ## args) #define IVTV_DEBUG_MB(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_MB, "mb", fmt , ## args)
#define IVTV_DEBUG_DMA(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_DMA, "dma", fmt , ## args) #define IVTV_DEBUG_DMA(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_DMA, "dma", fmt , ## args)
#define IVTV_DEBUG_IOCTL(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_IOCTL, "ioctl", fmt , ## args) #define IVTV_DEBUG_IOCTL(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_IOCTL, "ioctl", fmt , ## args)
#define IVTV_DEBUG_FILE(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_FILE, "file", fmt , ## args)
#define IVTV_DEBUG_I2C(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_I2C, "i2c", fmt , ## args) #define IVTV_DEBUG_I2C(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_I2C, "i2c", fmt , ## args)
#define IVTV_DEBUG_IRQ(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_IRQ, "irq", fmt , ## args) #define IVTV_DEBUG_IRQ(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_IRQ, "irq", fmt , ## args)
#define IVTV_DEBUG_DEC(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_DEC, "dec", fmt , ## args) #define IVTV_DEBUG_DEC(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_DEC, "dec", fmt , ## args)
...@@ -290,11 +292,12 @@ extern const u32 yuv_offset[4]; ...@@ -290,11 +292,12 @@ extern const u32 yuv_offset[4];
if (((x) & ivtv_debug) && (ivtv_debug & IVTV_DBGFLG_HIGHVOL)) \ if (((x) & ivtv_debug) && (ivtv_debug & IVTV_DBGFLG_HIGHVOL)) \
printk(KERN_INFO "ivtv%d " type ": " fmt, itv->num , ## args); \ printk(KERN_INFO "ivtv%d " type ": " fmt, itv->num , ## args); \
} while (0) } while (0)
#define IVTV_DEBUG_HI_WARN(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_WARN, "warning", fmt , ## args) #define IVTV_DEBUG_HI_WARN(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_WARN, "warn", fmt , ## args)
#define IVTV_DEBUG_HI_INFO(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_INFO, "info",fmt , ## args) #define IVTV_DEBUG_HI_INFO(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_INFO, "info", fmt , ## args)
#define IVTV_DEBUG_HI_API(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_API, "api", fmt , ## args) #define IVTV_DEBUG_HI_MB(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_MB, "mb", fmt , ## args)
#define IVTV_DEBUG_HI_DMA(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_DMA, "dma", fmt , ## args) #define IVTV_DEBUG_HI_DMA(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_DMA, "dma", fmt , ## args)
#define IVTV_DEBUG_HI_IOCTL(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_IOCTL, "ioctl", fmt , ## args) #define IVTV_DEBUG_HI_IOCTL(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_IOCTL, "ioctl", fmt , ## args)
#define IVTV_DEBUG_HI_FILE(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_FILE, "file", fmt , ## args)
#define IVTV_DEBUG_HI_I2C(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_I2C, "i2c", fmt , ## args) #define IVTV_DEBUG_HI_I2C(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_I2C, "i2c", fmt , ## args)
#define IVTV_DEBUG_HI_IRQ(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_IRQ, "irq", fmt , ## args) #define IVTV_DEBUG_HI_IRQ(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_IRQ, "irq", fmt , ## args)
#define IVTV_DEBUG_HI_DEC(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_DEC, "dec", fmt , ## args) #define IVTV_DEBUG_HI_DEC(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_DEC, "dec", fmt , ## args)
......
...@@ -409,7 +409,7 @@ static ssize_t ivtv_read_pos(struct ivtv_stream *s, char __user *ubuf, size_t co ...@@ -409,7 +409,7 @@ static ssize_t ivtv_read_pos(struct ivtv_stream *s, char __user *ubuf, size_t co
ssize_t rc = count ? ivtv_read(s, ubuf, count, non_block) : 0; ssize_t rc = count ? ivtv_read(s, ubuf, count, non_block) : 0;
struct ivtv *itv = s->itv; struct ivtv *itv = s->itv;
IVTV_DEBUG_HI_INFO("read %zd from %s, got %zd\n", count, s->name, rc); IVTV_DEBUG_HI_FILE("read %zd from %s, got %zd\n", count, s->name, rc);
if (rc > 0) if (rc > 0)
pos += rc; pos += rc;
return rc; return rc;
...@@ -500,7 +500,7 @@ ssize_t ivtv_v4l2_read(struct file * filp, char __user *buf, size_t count, loff_ ...@@ -500,7 +500,7 @@ ssize_t ivtv_v4l2_read(struct file * filp, char __user *buf, size_t count, loff_
struct ivtv_stream *s = &itv->streams[id->type]; struct ivtv_stream *s = &itv->streams[id->type];
int rc; int rc;
IVTV_DEBUG_HI_IOCTL("read %zd bytes from %s\n", count, s->name); IVTV_DEBUG_HI_FILE("read %zd bytes from %s\n", count, s->name);
rc = ivtv_start_capture(id); rc = ivtv_start_capture(id);
if (rc) if (rc)
...@@ -538,7 +538,7 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t c ...@@ -538,7 +538,7 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t c
int rc; int rc;
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
IVTV_DEBUG_HI_IOCTL("write %zd bytes to %s\n", count, s->name); IVTV_DEBUG_HI_FILE("write %zd bytes to %s\n", count, s->name);
if (s->type != IVTV_DEC_STREAM_TYPE_MPG && if (s->type != IVTV_DEC_STREAM_TYPE_MPG &&
s->type != IVTV_DEC_STREAM_TYPE_YUV && s->type != IVTV_DEC_STREAM_TYPE_YUV &&
...@@ -646,7 +646,7 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t c ...@@ -646,7 +646,7 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t c
to transfer the rest. */ to transfer the rest. */
if (count && !(filp->f_flags & O_NONBLOCK)) if (count && !(filp->f_flags & O_NONBLOCK))
goto retry; goto retry;
IVTV_DEBUG_HI_INFO("Wrote %d bytes to %s (%d)\n", bytes_written, s->name, s->q_full.bytesused); IVTV_DEBUG_HI_FILE("Wrote %d bytes to %s (%d)\n", bytes_written, s->name, s->q_full.bytesused);
return bytes_written; return bytes_written;
} }
...@@ -658,6 +658,7 @@ unsigned int ivtv_v4l2_dec_poll(struct file *filp, poll_table *wait) ...@@ -658,6 +658,7 @@ unsigned int ivtv_v4l2_dec_poll(struct file *filp, poll_table *wait)
int res = 0; int res = 0;
/* add stream's waitq to the poll list */ /* add stream's waitq to the poll list */
IVTV_DEBUG_HI_FILE("Decoder poll\n");
poll_wait(filp, &s->waitq, wait); poll_wait(filp, &s->waitq, wait);
set_bit(IVTV_F_I_EV_VSYNC_ENABLED, &itv->i_flags); set_bit(IVTV_F_I_EV_VSYNC_ENABLED, &itv->i_flags);
...@@ -687,9 +688,11 @@ unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table * wait) ...@@ -687,9 +688,11 @@ unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table * wait)
s->name, rc); s->name, rc);
return POLLERR; return POLLERR;
} }
IVTV_DEBUG_FILE("Encoder poll started capture\n");
} }
/* add stream's waitq to the poll list */ /* add stream's waitq to the poll list */
IVTV_DEBUG_HI_FILE("Encoder poll\n");
poll_wait(filp, &s->waitq, wait); poll_wait(filp, &s->waitq, wait);
if (eof || s->q_full.length) if (eof || s->q_full.length)
...@@ -702,7 +705,7 @@ void ivtv_stop_capture(struct ivtv_open_id *id, int gop_end) ...@@ -702,7 +705,7 @@ void ivtv_stop_capture(struct ivtv_open_id *id, int gop_end)
struct ivtv *itv = id->itv; struct ivtv *itv = id->itv;
struct ivtv_stream *s = &itv->streams[id->type]; struct ivtv_stream *s = &itv->streams[id->type];
IVTV_DEBUG_IOCTL("close() of %s\n", s->name); IVTV_DEBUG_FILE("close() of %s\n", s->name);
/* 'Unclaim' this stream */ /* 'Unclaim' this stream */
...@@ -740,7 +743,7 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts) ...@@ -740,7 +743,7 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts)
struct ivtv *itv = id->itv; struct ivtv *itv = id->itv;
struct ivtv_stream *s = &itv->streams[id->type]; struct ivtv_stream *s = &itv->streams[id->type];
IVTV_DEBUG_IOCTL("close() of %s\n", s->name); IVTV_DEBUG_FILE("close() of %s\n", s->name);
/* Stop decoding */ /* Stop decoding */
if (test_bit(IVTV_F_S_STREAMING, &s->s_flags)) { if (test_bit(IVTV_F_S_STREAMING, &s->s_flags)) {
...@@ -772,7 +775,7 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp) ...@@ -772,7 +775,7 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp)
struct ivtv *itv = id->itv; struct ivtv *itv = id->itv;
struct ivtv_stream *s = &itv->streams[id->type]; struct ivtv_stream *s = &itv->streams[id->type];
IVTV_DEBUG_IOCTL("close() of %s\n", s->name); IVTV_DEBUG_FILE("close %s\n", s->name);
v4l2_prio_close(&itv->prio, &id->prio); v4l2_prio_close(&itv->prio, &id->prio);
...@@ -855,6 +858,7 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp) ...@@ -855,6 +858,7 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp)
IVTV_ERR("Failed to initialize on minor %d\n", minor); IVTV_ERR("Failed to initialize on minor %d\n", minor);
return -ENXIO; return -ENXIO;
} }
IVTV_DEBUG_FILE("open %s\n", s->name);
if (y == IVTV_DEC_STREAM_TYPE_MPG && if (y == IVTV_DEC_STREAM_TYPE_MPG &&
test_bit(IVTV_F_S_CLAIMED, &itv->streams[IVTV_DEC_STREAM_TYPE_YUV].s_flags)) test_bit(IVTV_F_S_CLAIMED, &itv->streams[IVTV_DEC_STREAM_TYPE_YUV].s_flags))
......
...@@ -1138,12 +1138,14 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void ...@@ -1138,12 +1138,14 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
memset(&enc->raw, 0, sizeof(enc->raw)); memset(&enc->raw, 0, sizeof(enc->raw));
switch (enc->cmd) { switch (enc->cmd) {
case V4L2_ENC_CMD_START: case V4L2_ENC_CMD_START:
IVTV_DEBUG_IOCTL("V4L2_ENC_CMD_START\n");
enc->flags = 0; enc->flags = 0;
if (try) if (try)
return 0; return 0;
return ivtv_start_capture(id); return ivtv_start_capture(id);
case V4L2_ENC_CMD_STOP: case V4L2_ENC_CMD_STOP:
IVTV_DEBUG_IOCTL("V4L2_ENC_CMD_STOP\n");
enc->flags &= V4L2_ENC_CMD_STOP_AT_GOP_END; enc->flags &= V4L2_ENC_CMD_STOP_AT_GOP_END;
if (try) if (try)
return 0; return 0;
...@@ -1151,6 +1153,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void ...@@ -1151,6 +1153,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
return 0; return 0;
case V4L2_ENC_CMD_PAUSE: case V4L2_ENC_CMD_PAUSE:
IVTV_DEBUG_IOCTL("V4L2_ENC_CMD_PAUSE\n");
enc->flags = 0; enc->flags = 0;
if (try) if (try)
return 0; return 0;
...@@ -1163,6 +1166,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void ...@@ -1163,6 +1166,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
break; break;
case V4L2_ENC_CMD_RESUME: case V4L2_ENC_CMD_RESUME:
IVTV_DEBUG_IOCTL("V4L2_ENC_CMD_RESUME\n");
enc->flags = 0; enc->flags = 0;
if (try) if (try)
return 0; return 0;
...@@ -1174,6 +1178,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void ...@@ -1174,6 +1178,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
ivtv_unmute(itv); ivtv_unmute(itv);
break; break;
default: default:
IVTV_DEBUG_IOCTL("Unknown cmd %d\n", enc->cmd);
return -EINVAL; return -EINVAL;
} }
break; break;
...@@ -1408,9 +1413,9 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) ...@@ -1408,9 +1413,9 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg)
int try = (cmd == VIDEO_TRY_COMMAND); int try = (cmd == VIDEO_TRY_COMMAND);
if (try) if (try)
IVTV_DEBUG_IOCTL("VIDEO_TRY_COMMAND\n"); IVTV_DEBUG_IOCTL("VIDEO_TRY_COMMAND %d\n", vc->cmd);
else else
IVTV_DEBUG_IOCTL("VIDEO_COMMAND\n"); IVTV_DEBUG_IOCTL("VIDEO_COMMAND %d\n", vc->cmd);
return ivtv_video_command(itv, id, vc, try); return ivtv_video_command(itv, id, vc, try);
} }
......
...@@ -225,15 +225,15 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[]) ...@@ -225,15 +225,15 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
} }
if (args < 0 || args > CX2341X_MBOX_MAX_DATA || if (args < 0 || args > CX2341X_MBOX_MAX_DATA ||
cmd < 0 || cmd > 255 || api_info[cmd].name == NULL) { cmd < 0 || cmd > 255 || api_info[cmd].name == NULL) {
IVTV_ERR("Invalid API call: cmd = 0x%02x, args = %d\n", cmd, args); IVTV_ERR("Invalid MB call: cmd = 0x%02x, args = %d\n", cmd, args);
return -EINVAL; return -EINVAL;
} }
if (api_info[cmd].flags & API_HIGH_VOL) { if (api_info[cmd].flags & API_HIGH_VOL) {
IVTV_DEBUG_HI_API("API Call: %s\n", api_info[cmd].name); IVTV_DEBUG_HI_MB("MB Call: %s\n", api_info[cmd].name);
} }
else { else {
IVTV_DEBUG_API("API Call: %s\n", api_info[cmd].name); IVTV_DEBUG_MB("MB Call: %s\n", api_info[cmd].name);
} }
/* clear possibly uninitialized part of data array */ /* clear possibly uninitialized part of data array */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册