Commit 37f89f95 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (8104): cx18/ivtv: ioctl debugging improvements

Completely rely on the video_ioctl2 debugging facilities rather than
doing it ourselves.

Fill in some missing fields in ivtv with VIDIOC_G_FBUF.
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 21575c13
...@@ -56,8 +56,6 @@ int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl) ...@@ -56,8 +56,6 @@ int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
const char *name; const char *name;
CX18_DEBUG_IOCTL("VIDIOC_QUERYCTRL(%08x)\n", qctrl->id);
qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id);
if (qctrl->id == 0) if (qctrl->id == 0)
return -EINVAL; return -EINVAL;
...@@ -94,10 +92,8 @@ int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl) ...@@ -94,10 +92,8 @@ int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
int cx18_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) int cx18_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
struct v4l2_queryctrl qctrl; struct v4l2_queryctrl qctrl;
CX18_DEBUG_IOCTL("VIDIOC_QUERYMENU\n");
qctrl.id = qmenu->id; qctrl.id = qmenu->id;
cx18_queryctrl(file, fh, &qctrl); cx18_queryctrl(file, fh, &qctrl);
return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id)); return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id));
...@@ -108,14 +104,11 @@ int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) ...@@ -108,14 +104,11 @@ int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
struct cx18_open_id *id = fh; struct cx18_open_id *id = fh;
struct cx18 *cx = id->cx; struct cx18 *cx = id->cx;
int ret; int ret;
s32 v = vctrl->value;
ret = v4l2_prio_check(&cx->prio, &id->prio); ret = v4l2_prio_check(&cx->prio, &id->prio);
if (ret) if (ret)
return ret; return ret;
CX18_DEBUG_IOCTL("VIDIOC_S_CTRL(%08x, %x)\n", vctrl->id, v);
switch (vctrl->id) { switch (vctrl->id) {
/* Standard V4L2 controls */ /* Standard V4L2 controls */
case V4L2_CID_BRIGHTNESS: case V4L2_CID_BRIGHTNESS:
...@@ -133,7 +126,7 @@ int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) ...@@ -133,7 +126,7 @@ int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
return cx18_i2c_hw(cx, cx->card->hw_audio_ctrl, VIDIOC_S_CTRL, vctrl); return cx18_i2c_hw(cx, cx->card->hw_audio_ctrl, VIDIOC_S_CTRL, vctrl);
default: default:
CX18_DEBUG_IOCTL("invalid control %x\n", vctrl->id); CX18_DEBUG_IOCTL("invalid control 0x%x\n", vctrl->id);
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -143,8 +136,6 @@ int cx18_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) ...@@ -143,8 +136,6 @@ int cx18_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_G_CTRL(%08x)\n", vctrl->id);
switch (vctrl->id) { switch (vctrl->id) {
/* Standard V4L2 controls */ /* Standard V4L2 controls */
case V4L2_CID_BRIGHTNESS: case V4L2_CID_BRIGHTNESS:
...@@ -161,7 +152,7 @@ int cx18_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) ...@@ -161,7 +152,7 @@ int cx18_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
case V4L2_CID_AUDIO_LOUDNESS: case V4L2_CID_AUDIO_LOUDNESS:
return cx18_i2c_hw(cx, cx->card->hw_audio_ctrl, VIDIOC_G_CTRL, vctrl); return cx18_i2c_hw(cx, cx->card->hw_audio_ctrl, VIDIOC_G_CTRL, vctrl);
default: default:
CX18_DEBUG_IOCTL("invalid control %x\n", vctrl->id); CX18_DEBUG_IOCTL("invalid control 0x%x\n", vctrl->id);
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -227,7 +218,6 @@ int cx18_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) ...@@ -227,7 +218,6 @@ int cx18_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
} }
return err; return err;
} }
CX18_DEBUG_IOCTL("VIDIOC_G_EXT_CTRLS\n");
if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
return cx2341x_ext_ctrls(&cx->params, 0, c, VIDIOC_G_EXT_CTRLS); return cx2341x_ext_ctrls(&cx->params, 0, c, VIDIOC_G_EXT_CTRLS);
return -EINVAL; return -EINVAL;
...@@ -260,7 +250,6 @@ int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) ...@@ -260,7 +250,6 @@ int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
} }
return err; return err;
} }
CX18_DEBUG_IOCTL("VIDIOC_S_EXT_CTRLS\n");
if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) { if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
struct cx2341x_mpeg_params p = cx->params; struct cx2341x_mpeg_params p = cx->params;
int err = cx2341x_ext_ctrls(&p, atomic_read(&cx->ana_capturing), int err = cx2341x_ext_ctrls(&p, atomic_read(&cx->ana_capturing),
...@@ -296,7 +285,6 @@ int cx18_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) ...@@ -296,7 +285,6 @@ int cx18_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_TRY_EXT_CTRLS\n");
if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
return cx2341x_ext_ctrls(&cx->params, return cx2341x_ext_ctrls(&cx->params,
atomic_read(&cx->ana_capturing), atomic_read(&cx->ana_capturing),
......
...@@ -165,8 +165,6 @@ static int cx18_g_fmt_vbi_cap(struct file *file, void *fh, ...@@ -165,8 +165,6 @@ static int cx18_g_fmt_vbi_cap(struct file *file, void *fh,
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
struct v4l2_vbi_format *vbifmt = &fmt->fmt.vbi; struct v4l2_vbi_format *vbifmt = &fmt->fmt.vbi;
CX18_DEBUG_IOCTL("VIDIOC_G_FMT: V4L2_BUF_TYPE_VBI_CAPTURE\n");
vbifmt->sampling_rate = 27000000; vbifmt->sampling_rate = 27000000;
vbifmt->offset = 248; vbifmt->offset = 248;
vbifmt->samples_per_line = cx->vbi.raw_decoder_line_size - 4; vbifmt->samples_per_line = cx->vbi.raw_decoder_line_size - 4;
...@@ -195,8 +193,6 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh, ...@@ -195,8 +193,6 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh,
int w = fmt->fmt.pix.width; int w = fmt->fmt.pix.width;
int h = fmt->fmt.pix.height; int h = fmt->fmt.pix.height;
CX18_DEBUG_IOCTL("VIDIOC_TRY_FMT: V4L2_BUF_TYPE_VIDEO_CAPTURE\n");
w = min(w, 720); w = min(w, 720);
w = max(w, 1); w = max(w, 1);
h = min(h, cx->is_50hz ? 576 : 480); h = min(h, cx->is_50hz ? 576 : 480);
...@@ -210,10 +206,6 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh, ...@@ -210,10 +206,6 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh,
static int cx18_try_fmt_vbi_cap(struct file *file, void *fh, static int cx18_try_fmt_vbi_cap(struct file *file, void *fh,
struct v4l2_format *fmt) struct v4l2_format *fmt)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_TRY_FMT: V4L2_BUF_TYPE_VBI_CAPTURE\n");
return cx18_g_fmt_vbi_cap(file, fh, fmt); return cx18_g_fmt_vbi_cap(file, fh, fmt);
} }
...@@ -236,8 +228,6 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh, ...@@ -236,8 +228,6 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
if (ret) if (ret)
return ret; return ret;
CX18_DEBUG_IOCTL("VIDIOC_S_FMT: V4L2_BUF_TYPE_VIDEO_CAPTURE\n");
ret = cx18_try_fmt_vid_cap(file, fh, fmt); ret = cx18_try_fmt_vid_cap(file, fh, fmt);
if (ret) if (ret)
return ret; return ret;
...@@ -265,8 +255,6 @@ static int cx18_s_fmt_vbi_cap(struct file *file, void *fh, ...@@ -265,8 +255,6 @@ static int cx18_s_fmt_vbi_cap(struct file *file, void *fh,
if (ret) if (ret)
return ret; return ret;
CX18_DEBUG_IOCTL("VIDIOC_S_FMT: V4L2_BUF_TYPE_VBI_CAPTURE\n");
if (id->type == CX18_ENC_STREAM_TYPE_VBI && if (id->type == CX18_ENC_STREAM_TYPE_VBI &&
cx->vbi.sliced_in->service_set && cx->vbi.sliced_in->service_set &&
atomic_read(&cx->ana_capturing) > 0) atomic_read(&cx->ana_capturing) > 0)
...@@ -288,8 +276,6 @@ static int cx18_g_chip_ident(struct file *file, void *fh, ...@@ -288,8 +276,6 @@ static int cx18_g_chip_ident(struct file *file, void *fh,
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_G_CHIP_IDENT\n");
chip->ident = V4L2_IDENT_NONE; chip->ident = V4L2_IDENT_NONE;
chip->revision = 0; chip->revision = 0;
if (chip->match_type == V4L2_CHIP_MATCH_HOST) { if (chip->match_type == V4L2_CHIP_MATCH_HOST) {
...@@ -311,8 +297,6 @@ static int cx18_g_register(struct file *file, void *fh, ...@@ -311,8 +297,6 @@ static int cx18_g_register(struct file *file, void *fh,
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_DBG_G_REGISTER\n");
if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) if (v4l2_chip_match_host(reg->match_type, reg->match_chip))
return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg); return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg);
if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER)
...@@ -327,8 +311,6 @@ static int cx18_s_register(struct file *file, void *fh, ...@@ -327,8 +311,6 @@ static int cx18_s_register(struct file *file, void *fh,
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_DBG_S_REGISTER\n");
if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) if (v4l2_chip_match_host(reg->match_type, reg->match_chip))
return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg); return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg);
if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER)
...@@ -342,8 +324,6 @@ static int cx18_g_priority(struct file *file, void *fh, enum v4l2_priority *p) ...@@ -342,8 +324,6 @@ static int cx18_g_priority(struct file *file, void *fh, enum v4l2_priority *p)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_G_PRIORITY\n");
*p = v4l2_prio_max(&cx->prio); *p = v4l2_prio_max(&cx->prio);
return 0; return 0;
} }
...@@ -353,8 +333,6 @@ static int cx18_s_priority(struct file *file, void *fh, enum v4l2_priority prio) ...@@ -353,8 +333,6 @@ static int cx18_s_priority(struct file *file, void *fh, enum v4l2_priority prio)
struct cx18_open_id *id = fh; struct cx18_open_id *id = fh;
struct cx18 *cx = id->cx; struct cx18 *cx = id->cx;
CX18_DEBUG_IOCTL("VIDIOC_S_PRIORITY\n");
return v4l2_prio_change(&cx->prio, &id->prio, prio); return v4l2_prio_change(&cx->prio, &id->prio, prio);
} }
...@@ -363,8 +341,6 @@ static int cx18_querycap(struct file *file, void *fh, ...@@ -363,8 +341,6 @@ static int cx18_querycap(struct file *file, void *fh,
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_QUERYCAP\n");
strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver));
strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); strlcpy(vcap->card, cx->card_name, sizeof(vcap->card));
strlcpy(vcap->bus_info, pci_name(cx->dev), sizeof(vcap->bus_info)); strlcpy(vcap->bus_info, pci_name(cx->dev), sizeof(vcap->bus_info));
...@@ -377,8 +353,6 @@ static int cx18_enumaudio(struct file *file, void *fh, struct v4l2_audio *vin) ...@@ -377,8 +353,6 @@ static int cx18_enumaudio(struct file *file, void *fh, struct v4l2_audio *vin)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_ENUMAUDIO\n");
return cx18_get_audio_input(cx, vin->index, vin); return cx18_get_audio_input(cx, vin->index, vin);
} }
...@@ -386,8 +360,6 @@ static int cx18_g_audio(struct file *file, void *fh, struct v4l2_audio *vin) ...@@ -386,8 +360,6 @@ static int cx18_g_audio(struct file *file, void *fh, struct v4l2_audio *vin)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_G_AUDIO\n");
vin->index = cx->audio_input; vin->index = cx->audio_input;
return cx18_get_audio_input(cx, vin->index, vin); return cx18_get_audio_input(cx, vin->index, vin);
} }
...@@ -396,8 +368,6 @@ static int cx18_s_audio(struct file *file, void *fh, struct v4l2_audio *vout) ...@@ -396,8 +368,6 @@ static int cx18_s_audio(struct file *file, void *fh, struct v4l2_audio *vout)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_S_AUDIO\n");
if (vout->index >= cx->nof_audio_inputs) if (vout->index >= cx->nof_audio_inputs)
return -EINVAL; return -EINVAL;
cx->audio_input = vout->index; cx->audio_input = vout->index;
...@@ -409,8 +379,6 @@ static int cx18_enum_input(struct file *file, void *fh, struct v4l2_input *vin) ...@@ -409,8 +379,6 @@ static int cx18_enum_input(struct file *file, void *fh, struct v4l2_input *vin)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_ENUMINPUT\n");
/* set it to defaults from our table */ /* set it to defaults from our table */
return cx18_get_input(cx, vin->index, vin); return cx18_get_input(cx, vin->index, vin);
} }
...@@ -420,8 +388,6 @@ static int cx18_cropcap(struct file *file, void *fh, ...@@ -420,8 +388,6 @@ static int cx18_cropcap(struct file *file, void *fh,
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_CROPCAP\n");
if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL; return -EINVAL;
cropcap->bounds.top = cropcap->bounds.left = 0; cropcap->bounds.top = cropcap->bounds.left = 0;
...@@ -443,8 +409,6 @@ static int cx18_s_crop(struct file *file, void *fh, struct v4l2_crop *crop) ...@@ -443,8 +409,6 @@ static int cx18_s_crop(struct file *file, void *fh, struct v4l2_crop *crop)
if (ret) if (ret)
return ret; return ret;
CX18_DEBUG_IOCTL("VIDIOC_S_CROP\n");
if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL; return -EINVAL;
return cx18_av_cmd(cx, VIDIOC_S_CROP, crop); return cx18_av_cmd(cx, VIDIOC_S_CROP, crop);
...@@ -454,8 +418,6 @@ static int cx18_g_crop(struct file *file, void *fh, struct v4l2_crop *crop) ...@@ -454,8 +418,6 @@ static int cx18_g_crop(struct file *file, void *fh, struct v4l2_crop *crop)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_G_CROP\n");
if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL; return -EINVAL;
return cx18_av_cmd(cx, VIDIOC_G_CROP, crop); return cx18_av_cmd(cx, VIDIOC_G_CROP, crop);
...@@ -473,10 +435,6 @@ static int cx18_enum_fmt_vid_cap(struct file *file, void *fh, ...@@ -473,10 +435,6 @@ static int cx18_enum_fmt_vid_cap(struct file *file, void *fh,
} }
}; };
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_ENUM_FMT: V4L2_BUF_TYPE_VIDEO_CAPTURE\n");
if (fmt->index > 1) if (fmt->index > 1)
return -EINVAL; return -EINVAL;
*fmt = formats[fmt->index]; *fmt = formats[fmt->index];
...@@ -487,8 +445,6 @@ static int cx18_g_input(struct file *file, void *fh, unsigned int *i) ...@@ -487,8 +445,6 @@ static int cx18_g_input(struct file *file, void *fh, unsigned int *i)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_G_INPUT\n");
*i = cx->active_input; *i = cx->active_input;
return 0; return 0;
} }
...@@ -503,8 +459,6 @@ int cx18_s_input(struct file *file, void *fh, unsigned int inp) ...@@ -503,8 +459,6 @@ int cx18_s_input(struct file *file, void *fh, unsigned int inp)
if (ret) if (ret)
return ret; return ret;
CX18_DEBUG_IOCTL("VIDIOC_S_INPUT\n");
if (inp < 0 || inp >= cx->nof_inputs) if (inp < 0 || inp >= cx->nof_inputs)
return -EINVAL; return -EINVAL;
...@@ -534,8 +488,6 @@ static int cx18_g_frequency(struct file *file, void *fh, ...@@ -534,8 +488,6 @@ static int cx18_g_frequency(struct file *file, void *fh,
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_G_FREQUENCY\n");
if (vf->tuner != 0) if (vf->tuner != 0)
return -EINVAL; return -EINVAL;
...@@ -553,8 +505,6 @@ int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) ...@@ -553,8 +505,6 @@ int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf)
if (ret) if (ret)
return ret; return ret;
CX18_DEBUG_IOCTL("VIDIOC_S_FREQUENCY\n");
if (vf->tuner != 0) if (vf->tuner != 0)
return -EINVAL; return -EINVAL;
...@@ -569,8 +519,6 @@ static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std) ...@@ -569,8 +519,6 @@ static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_G_STD\n");
*std = cx->std; *std = cx->std;
return 0; return 0;
} }
...@@ -585,8 +533,6 @@ int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std) ...@@ -585,8 +533,6 @@ int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std)
if (ret) if (ret)
return ret; return ret;
CX18_DEBUG_IOCTL("VIDIOC_S_STD\n");
if ((*std & V4L2_STD_ALL) == 0) if ((*std & V4L2_STD_ALL) == 0)
return -EINVAL; return -EINVAL;
...@@ -628,8 +574,6 @@ static int cx18_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) ...@@ -628,8 +574,6 @@ static int cx18_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
if (ret) if (ret)
return ret; return ret;
CX18_DEBUG_IOCTL("VIDIOC_S_TUNER\n");
if (vt->index != 0) if (vt->index != 0)
return -EINVAL; return -EINVAL;
...@@ -643,8 +587,6 @@ static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) ...@@ -643,8 +587,6 @@ static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_G_TUNER\n");
if (vt->index != 0) if (vt->index != 0)
return -EINVAL; return -EINVAL;
...@@ -679,8 +621,6 @@ static int cx18_encoder_cmd(struct file *file, void *fh, ...@@ -679,8 +621,6 @@ static int cx18_encoder_cmd(struct file *file, void *fh,
struct cx18_open_id *id = fh; struct cx18_open_id *id = fh;
struct cx18 *cx = id->cx; struct cx18 *cx = id->cx;
CX18_DEBUG_IOCTL("VIDIOC_ENCODER_CMD:\n");
switch (enc->cmd) { switch (enc->cmd) {
case V4L2_ENC_CMD_START: case V4L2_ENC_CMD_START:
CX18_DEBUG_IOCTL("V4L2_ENC_CMD_START\n"); CX18_DEBUG_IOCTL("V4L2_ENC_CMD_START\n");
...@@ -728,8 +668,6 @@ static int cx18_try_encoder_cmd(struct file *file, void *fh, ...@@ -728,8 +668,6 @@ static int cx18_try_encoder_cmd(struct file *file, void *fh,
{ {
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
CX18_DEBUG_IOCTL("VIDIOC_TRY_ENCDOER_CMD:\n");
switch (enc->cmd) { switch (enc->cmd) {
case V4L2_ENC_CMD_START: case V4L2_ENC_CMD_START:
CX18_DEBUG_IOCTL("V4L2_ENC_CMD_START\n"); CX18_DEBUG_IOCTL("V4L2_ENC_CMD_START\n");
...@@ -765,7 +703,6 @@ static int cx18_log_status(struct file *file, void *fh) ...@@ -765,7 +703,6 @@ static int cx18_log_status(struct file *file, void *fh)
struct v4l2_audio audin; struct v4l2_audio audin;
int i; int i;
CX18_DEBUG_IOCTL("VIDIOC_LOG_STATUS\n");
CX18_INFO("================= START STATUS CARD #%d =================\n", cx->num); CX18_INFO("================= START STATUS CARD #%d =================\n", cx->num);
if (cx->hw_flags & CX18_HW_TVEEPROM) { if (cx->hw_flags & CX18_HW_TVEEPROM) {
struct tveeprom tv; struct tveeprom tv;
...@@ -807,26 +744,13 @@ static int cx18_default(struct file *file, void *fh, int cmd, void *arg) ...@@ -807,26 +744,13 @@ static int cx18_default(struct file *file, void *fh, int cmd, void *arg)
switch (cmd) { switch (cmd) {
case VIDIOC_INT_S_AUDIO_ROUTING: { case VIDIOC_INT_S_AUDIO_ROUTING: {
struct v4l2_routing *route = arg; struct v4l2_routing *route = arg;
CX18_DEBUG_IOCTL("VIDIOC_INT_S_AUDIO_ROUTING (%d, %d)\n",
route->input, route->output); CX18_DEBUG_IOCTL("VIDIOC_INT_S_AUDIO_ROUTING(%d, %d)\n",
route->input, route->output);
cx18_audio_set_route(cx, route); cx18_audio_set_route(cx, route);
break; break;
} }
case VIDIOC_INT_RESET: {
u32 val = *(u32 *)arg;
CX18_DEBUG_IOCTL("VIDIOC_INT_RESET (%#10x)\n", val);
/* No op right now */
/* cx18_av_cmd(cx, cmd, arg) */
/* cx18_call_i2c_clients(cx, cmd, arg) */
break;
}
default: default:
if (cx18_debug & CX18_DBGFLG_IOCTL) {
printk(KERN_INFO "cx18%d ioctl: unsupported cmd: ",
cx->num);
v4l_printk_ioctl(cmd);
printk("\n");
}
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -835,12 +759,17 @@ static int cx18_default(struct file *file, void *fh, int cmd, void *arg) ...@@ -835,12 +759,17 @@ static int cx18_default(struct file *file, void *fh, int cmd, void *arg)
int cx18_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, int cx18_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
struct video_device *vfd = video_devdata(filp);
struct cx18_open_id *id = (struct cx18_open_id *)filp->private_data; struct cx18_open_id *id = (struct cx18_open_id *)filp->private_data;
struct cx18 *cx = id->cx; struct cx18 *cx = id->cx;
int res; int res;
mutex_lock(&cx->serialize_lock); mutex_lock(&cx->serialize_lock);
if (cx18_debug & CX18_DBGFLG_IOCTL)
vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG;
res = video_ioctl2(inode, filp, cmd, arg); res = video_ioctl2(inode, filp, cmd, arg);
vfd->debug = 0;
mutex_unlock(&cx->serialize_lock); mutex_unlock(&cx->serialize_lock);
return res; return res;
} }
......
...@@ -190,8 +190,8 @@ static int cx18_prep_dev(struct cx18 *cx, int type) ...@@ -190,8 +190,8 @@ static int cx18_prep_dev(struct cx18 *cx, int type)
s->v4l2dev->type = s->v4l2dev->type =
VID_TYPE_CAPTURE | VID_TYPE_TUNER | VID_TYPE_TELETEXT | VID_TYPE_CAPTURE | VID_TYPE_TUNER | VID_TYPE_TELETEXT |
VID_TYPE_CLIPPING | VID_TYPE_SCALES | VID_TYPE_MPEG_ENCODER; VID_TYPE_CLIPPING | VID_TYPE_SCALES | VID_TYPE_MPEG_ENCODER;
snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "cx18%d %s", snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "cx18-%d",
cx->num, s->name); cx->num);
s->v4l2dev->minor = minor; s->v4l2dev->minor = minor;
s->v4l2dev->dev = &cx->dev->dev; s->v4l2dev->dev = &cx->dev->dev;
......
...@@ -53,8 +53,6 @@ int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl) ...@@ -53,8 +53,6 @@ int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
const char *name; const char *name;
IVTV_DEBUG_IOCTL("VIDIOC_QUERYCTRL(%08x)\n", qctrl->id);
qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id);
if (qctrl->id == 0) if (qctrl->id == 0)
return -EINVAL; return -EINVAL;
...@@ -91,10 +89,8 @@ int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl) ...@@ -91,10 +89,8 @@ int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
{ {
struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
struct v4l2_queryctrl qctrl; struct v4l2_queryctrl qctrl;
IVTV_DEBUG_IOCTL("VIDIOC_QUERYMENU\n");
qctrl.id = qmenu->id; qctrl.id = qmenu->id;
ivtv_queryctrl(file, fh, &qctrl); ivtv_queryctrl(file, fh, &qctrl);
return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id)); return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id));
...@@ -103,9 +99,6 @@ int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) ...@@ -103,9 +99,6 @@ int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
{ {
struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
s32 v = vctrl->value;
IVTV_DEBUG_IOCTL("VIDIOC_S_CTRL(%08x, %x)\n", vctrl->id, v);
switch (vctrl->id) { switch (vctrl->id) {
/* Standard V4L2 controls */ /* Standard V4L2 controls */
...@@ -124,7 +117,7 @@ int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) ...@@ -124,7 +117,7 @@ int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
return ivtv_i2c_hw(itv, itv->card->hw_audio_ctrl, VIDIOC_S_CTRL, vctrl); return ivtv_i2c_hw(itv, itv->card->hw_audio_ctrl, VIDIOC_S_CTRL, vctrl);
default: default:
IVTV_DEBUG_IOCTL("invalid control %x\n", vctrl->id); IVTV_DEBUG_IOCTL("invalid control 0x%x\n", vctrl->id);
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -134,8 +127,6 @@ int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) ...@@ -134,8 +127,6 @@ int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
{ {
struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
IVTV_DEBUG_IOCTL("VIDIOC_G_CTRL(%08x)\n", vctrl->id);
switch (vctrl->id) { switch (vctrl->id) {
/* Standard V4L2 controls */ /* Standard V4L2 controls */
case V4L2_CID_BRIGHTNESS: case V4L2_CID_BRIGHTNESS:
...@@ -152,7 +143,7 @@ int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) ...@@ -152,7 +143,7 @@ int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
case V4L2_CID_AUDIO_LOUDNESS: case V4L2_CID_AUDIO_LOUDNESS:
return ivtv_i2c_hw(itv, itv->card->hw_audio_ctrl, VIDIOC_G_CTRL, vctrl); return ivtv_i2c_hw(itv, itv->card->hw_audio_ctrl, VIDIOC_G_CTRL, vctrl);
default: default:
IVTV_DEBUG_IOCTL("invalid control %x\n", vctrl->id); IVTV_DEBUG_IOCTL("invalid control 0x%x\n", vctrl->id);
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -219,7 +210,6 @@ int ivtv_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) ...@@ -219,7 +210,6 @@ int ivtv_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
} }
return err; return err;
} }
IVTV_DEBUG_IOCTL("VIDIOC_G_EXT_CTRLS\n");
if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
return cx2341x_ext_ctrls(&itv->params, 0, c, VIDIOC_G_EXT_CTRLS); return cx2341x_ext_ctrls(&itv->params, 0, c, VIDIOC_G_EXT_CTRLS);
return -EINVAL; return -EINVAL;
...@@ -246,7 +236,6 @@ int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) ...@@ -246,7 +236,6 @@ int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
} }
return err; return err;
} }
IVTV_DEBUG_IOCTL("VIDIOC_S_EXT_CTRLS\n");
if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) { if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
static u32 freqs[3] = { 44100, 48000, 32000 }; static u32 freqs[3] = { 44100, 48000, 32000 };
struct cx2341x_mpeg_params p = itv->params; struct cx2341x_mpeg_params p = itv->params;
...@@ -286,7 +275,6 @@ int ivtv_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) ...@@ -286,7 +275,6 @@ int ivtv_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
{ {
struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
IVTV_DEBUG_IOCTL("VIDIOC_TRY_EXT_CTRLS\n");
if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
return cx2341x_ext_ctrls(&itv->params, atomic_read(&itv->capturing), c, VIDIOC_TRY_EXT_CTRLS); return cx2341x_ext_ctrls(&itv->params, atomic_read(&itv->capturing), c, VIDIOC_TRY_EXT_CTRLS);
return -EINVAL; return -EINVAL;
......
...@@ -1336,6 +1336,8 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) ...@@ -1336,6 +1336,8 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
return -EINVAL; return -EINVAL;
if (!itv->osd_video_pbase)
return -EINVAL;
fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY | fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY |
V4L2_FBUF_CAP_GLOBAL_ALPHA; V4L2_FBUF_CAP_GLOBAL_ALPHA;
...@@ -1349,11 +1351,15 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) ...@@ -1349,11 +1351,15 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
fb->fmt.height = itv->osd_rect.height; fb->fmt.height = itv->osd_rect.height;
fb->fmt.field = V4L2_FIELD_INTERLACED; fb->fmt.field = V4L2_FIELD_INTERLACED;
fb->fmt.bytesperline = fb->fmt.width; fb->fmt.bytesperline = fb->fmt.width;
fb->fmt.colorspace = V4L2_COLORSPACE_SMPTE170M;
fb->fmt.field = V4L2_FIELD_INTERLACED;
fb->fmt.priv = 0;
if (fb->fmt.pixelformat != V4L2_PIX_FMT_PAL8) if (fb->fmt.pixelformat != V4L2_PIX_FMT_PAL8)
fb->fmt.bytesperline *= 2; fb->fmt.bytesperline *= 2;
if (fb->fmt.pixelformat == V4L2_PIX_FMT_RGB32 || if (fb->fmt.pixelformat == V4L2_PIX_FMT_RGB32 ||
fb->fmt.pixelformat == V4L2_PIX_FMT_YUV32) fb->fmt.pixelformat == V4L2_PIX_FMT_YUV32)
fb->fmt.bytesperline *= 2; fb->fmt.bytesperline *= 2;
fb->fmt.sizeimage = fb->fmt.bytesperline * fb->fmt.height;
fb->base = (void *)itv->osd_video_pbase; fb->base = (void *)itv->osd_video_pbase;
fb->flags = 0; fb->flags = 0;
...@@ -1396,6 +1402,8 @@ static int ivtv_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) ...@@ -1396,6 +1402,8 @@ static int ivtv_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
return -EINVAL; return -EINVAL;
if (!itv->osd_video_pbase)
return -EINVAL;
itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0; itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0;
itv->osd_local_alpha_state = itv->osd_local_alpha_state =
...@@ -1744,6 +1752,7 @@ static int ivtv_default(struct file *file, void *fh, int cmd, void *arg) ...@@ -1744,6 +1752,7 @@ static int ivtv_default(struct file *file, void *fh, int cmd, void *arg)
static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct file *filp, static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct video_device *vfd = video_devdata(filp);
struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data;
int ret; int ret;
...@@ -1812,13 +1821,11 @@ static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct f ...@@ -1812,13 +1821,11 @@ static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct f
return ret; return ret;
} }
if (ivtv_debug & IVTV_DBGFLG_IOCTL) { if (ivtv_debug & IVTV_DBGFLG_IOCTL)
printk(KERN_INFO "ivtv%d ioctl: ", itv->num); vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG;
v4l_printk_ioctl(cmd); ret = video_ioctl2(inode, filp, cmd, arg);
printk("\n"); vfd->debug = 0;
} return ret;
return video_ioctl2(inode, filp, cmd, arg);
} }
int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
......
...@@ -213,8 +213,8 @@ static int ivtv_prep_dev(struct ivtv *itv, int type) ...@@ -213,8 +213,8 @@ static int ivtv_prep_dev(struct ivtv *itv, int type)
if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
s->v4l2dev->type |= VID_TYPE_MPEG_DECODER; s->v4l2dev->type |= VID_TYPE_MPEG_DECODER;
} }
snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "ivtv%d %s", snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "ivtv%d",
itv->num, s->name); itv->num);
s->v4l2dev->minor = minor; s->v4l2dev->minor = minor;
s->v4l2dev->dev = &itv->dev->dev; s->v4l2dev->dev = &itv->dev->dev;
......
...@@ -789,6 +789,9 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv) ...@@ -789,6 +789,9 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv)
else else
var->pixclock = pixclock; var->pixclock = pixclock;
itv->osd_rect.width = var->xres;
itv->osd_rect.height = var->yres;
IVTVFB_DEBUG_INFO("Display size: %dx%d (virtual %dx%d) @ %dbpp\n", IVTVFB_DEBUG_INFO("Display size: %dx%d (virtual %dx%d) @ %dbpp\n",
var->xres, var->yres, var->xres, var->yres,
var->xres_virtual, var->yres_virtual, var->xres_virtual, var->yres_virtual,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment