forked from Minki/linux
V4L/DVB: cx18: support new vbi ops to set/get VBI format
Also removed the bogus zeroing of fmt.sliced when setting up raw VBI. This should have been removed in ivtv, but it was just copied-and-pasted into cx18. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
5393db43f4
commit
1585927de6
@ -1023,9 +1023,9 @@ static int cx18_av_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
|
|||||||
|
|
||||||
static int cx18_av_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
|
static int cx18_av_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
|
||||||
{
|
{
|
||||||
struct cx18 *cx = v4l2_get_subdevdata(sd);
|
if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE)
|
||||||
|
return -EINVAL;
|
||||||
return cx18_av_vbi_g_fmt(cx, fmt);
|
return cx18_av_g_sliced_fmt(sd, &fmt->fmt.sliced);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
|
static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
|
||||||
@ -1099,10 +1099,10 @@ static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
|
case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
|
||||||
return cx18_av_vbi_s_fmt(cx, fmt);
|
return cx18_av_s_sliced_fmt(sd, &fmt->fmt.sliced);
|
||||||
|
|
||||||
case V4L2_BUF_TYPE_VBI_CAPTURE:
|
case V4L2_BUF_TYPE_VBI_CAPTURE:
|
||||||
return cx18_av_vbi_s_fmt(cx, fmt);
|
return cx18_av_s_raw_fmt(sd, &fmt->fmt.vbi);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1410,6 +1410,9 @@ static const struct v4l2_subdev_video_ops cx18_av_video_ops = {
|
|||||||
|
|
||||||
static const struct v4l2_subdev_vbi_ops cx18_av_vbi_ops = {
|
static const struct v4l2_subdev_vbi_ops cx18_av_vbi_ops = {
|
||||||
.decode_vbi_line = cx18_av_decode_vbi_line,
|
.decode_vbi_line = cx18_av_decode_vbi_line,
|
||||||
|
.g_sliced_fmt = cx18_av_g_sliced_fmt,
|
||||||
|
.s_sliced_fmt = cx18_av_s_sliced_fmt,
|
||||||
|
.s_raw_fmt = cx18_av_s_raw_fmt,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct v4l2_subdev_ops cx18_av_ops = {
|
static const struct v4l2_subdev_ops cx18_av_ops = {
|
||||||
|
@ -378,7 +378,8 @@ void cx18_av_audio_set_path(struct cx18 *cx);
|
|||||||
/* cx18_av-vbi.c */
|
/* cx18_av-vbi.c */
|
||||||
int cx18_av_decode_vbi_line(struct v4l2_subdev *sd,
|
int cx18_av_decode_vbi_line(struct v4l2_subdev *sd,
|
||||||
struct v4l2_decode_vbi_line *vbi);
|
struct v4l2_decode_vbi_line *vbi);
|
||||||
int cx18_av_vbi_g_fmt(struct cx18 *cx, struct v4l2_format *fmt);
|
int cx18_av_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt);
|
||||||
int cx18_av_vbi_s_fmt(struct cx18 *cx, struct v4l2_format *fmt);
|
int cx18_av_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
|
||||||
|
int cx18_av_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -129,10 +129,10 @@ static int decode_vps(u8 *dst, u8 *p)
|
|||||||
return err & 0xf0;
|
return err & 0xf0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cx18_av_vbi_g_fmt(struct cx18 *cx, struct v4l2_format *fmt)
|
int cx18_av_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi)
|
||||||
{
|
{
|
||||||
|
struct cx18 *cx = v4l2_get_subdevdata(sd);
|
||||||
struct cx18_av_state *state = &cx->av_state;
|
struct cx18_av_state *state = &cx->av_state;
|
||||||
struct v4l2_sliced_vbi_format *svbi;
|
|
||||||
static const u16 lcr2vbi[] = {
|
static const u16 lcr2vbi[] = {
|
||||||
0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */
|
0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */
|
||||||
0, V4L2_SLICED_WSS_625, 0, /* 4 */
|
0, V4L2_SLICED_WSS_625, 0, /* 4 */
|
||||||
@ -143,9 +143,6 @@ int cx18_av_vbi_g_fmt(struct cx18 *cx, struct v4l2_format *fmt)
|
|||||||
int is_pal = !(state->std & V4L2_STD_525_60);
|
int is_pal = !(state->std & V4L2_STD_525_60);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE)
|
|
||||||
return -EINVAL;
|
|
||||||
svbi = &fmt->fmt.sliced;
|
|
||||||
memset(svbi, 0, sizeof(*svbi));
|
memset(svbi, 0, sizeof(*svbi));
|
||||||
/* we're done if raw VBI is active */
|
/* we're done if raw VBI is active */
|
||||||
if ((cx18_av_read(cx, 0x404) & 0x10) == 0)
|
if ((cx18_av_read(cx, 0x404) & 0x10) == 0)
|
||||||
@ -173,31 +170,28 @@ int cx18_av_vbi_g_fmt(struct cx18 *cx, struct v4l2_format *fmt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cx18_av_vbi_s_fmt(struct cx18 *cx, struct v4l2_format *fmt)
|
int cx18_av_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt)
|
||||||
{
|
{
|
||||||
|
struct cx18 *cx = v4l2_get_subdevdata(sd);
|
||||||
|
struct cx18_av_state *state = &cx->av_state;
|
||||||
|
|
||||||
|
/* Setup standard */
|
||||||
|
cx18_av_std_setup(cx);
|
||||||
|
|
||||||
|
/* VBI Offset */
|
||||||
|
cx18_av_write(cx, 0x47f, state->slicer_line_delay);
|
||||||
|
cx18_av_write(cx, 0x404, 0x2e);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cx18_av_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi)
|
||||||
|
{
|
||||||
|
struct cx18 *cx = v4l2_get_subdevdata(sd);
|
||||||
struct cx18_av_state *state = &cx->av_state;
|
struct cx18_av_state *state = &cx->av_state;
|
||||||
struct v4l2_sliced_vbi_format *svbi;
|
|
||||||
int is_pal = !(state->std & V4L2_STD_525_60);
|
int is_pal = !(state->std & V4L2_STD_525_60);
|
||||||
int i, x;
|
int i, x;
|
||||||
u8 lcr[24];
|
u8 lcr[24];
|
||||||
|
|
||||||
if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE &&
|
|
||||||
fmt->type != V4L2_BUF_TYPE_VBI_CAPTURE)
|
|
||||||
return -EINVAL;
|
|
||||||
svbi = &fmt->fmt.sliced;
|
|
||||||
if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
|
|
||||||
/* raw VBI */
|
|
||||||
memset(svbi, 0, sizeof(*svbi));
|
|
||||||
|
|
||||||
/* Setup standard */
|
|
||||||
cx18_av_std_setup(cx);
|
|
||||||
|
|
||||||
/* VBI Offset */
|
|
||||||
cx18_av_write(cx, 0x47f, state->slicer_line_delay);
|
|
||||||
cx18_av_write(cx, 0x404, 0x2e);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (x = 0; x <= 23; x++)
|
for (x = 0; x <= 23; x++)
|
||||||
lcr[x] = 0x00;
|
lcr[x] = 0x00;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user