diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-03-14 09:16:46 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:58:47 -0400 |
commit | 5393db43f46e3228e4f84dd47050aeadaee23c0b (patch) | |
tree | 3d4a0e078d32184f846560e8cfc8596d76da69c8 /drivers/media | |
parent | 63d8adccecd404badcdbbf892765995fd028b3d0 (diff) |
V4L/DVB: cx25840: support new vbi ops to set/get VBI format
Also removed the bogus zeroing of fmt.sliced when setting up raw VBI.
Switching between raw and sliced VBI changed in 2.6.28 and this memset
should have been removed at that time. It was never noticed because
the bridge driver will fill in the fmt.vbi values anyway.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 9 | ||||
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.h | 5 | ||||
-rw-r--r-- | drivers/media/video/cx25840/cx25840-vbi.c | 40 |
3 files changed, 26 insertions, 28 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index a0f6f82993b..a20df8c184e 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -1018,7 +1018,7 @@ static int cx25840_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | |||
1018 | { | 1018 | { |
1019 | switch (fmt->type) { | 1019 | switch (fmt->type) { |
1020 | case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: | 1020 | case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: |
1021 | return cx25840_vbi_g_fmt(sd, fmt); | 1021 | return cx25840_g_sliced_fmt(sd, &fmt->fmt.sliced); |
1022 | default: | 1022 | default: |
1023 | return -EINVAL; | 1023 | return -EINVAL; |
1024 | } | 1024 | } |
@@ -1080,10 +1080,10 @@ static int cx25840_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | |||
1080 | break; | 1080 | break; |
1081 | 1081 | ||
1082 | case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: | 1082 | case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: |
1083 | return cx25840_vbi_s_fmt(sd, fmt); | 1083 | return cx25840_s_sliced_fmt(sd, &fmt->fmt.sliced); |
1084 | 1084 | ||
1085 | case V4L2_BUF_TYPE_VBI_CAPTURE: | 1085 | case V4L2_BUF_TYPE_VBI_CAPTURE: |
1086 | return cx25840_vbi_s_fmt(sd, fmt); | 1086 | return cx25840_s_raw_fmt(sd, &fmt->fmt.vbi); |
1087 | 1087 | ||
1088 | default: | 1088 | default: |
1089 | return -EINVAL; | 1089 | return -EINVAL; |
@@ -1640,6 +1640,9 @@ static const struct v4l2_subdev_video_ops cx25840_video_ops = { | |||
1640 | 1640 | ||
1641 | static const struct v4l2_subdev_vbi_ops cx25840_vbi_ops = { | 1641 | static const struct v4l2_subdev_vbi_ops cx25840_vbi_ops = { |
1642 | .decode_vbi_line = cx25840_decode_vbi_line, | 1642 | .decode_vbi_line = cx25840_decode_vbi_line, |
1643 | .s_raw_fmt = cx25840_s_raw_fmt, | ||
1644 | .s_sliced_fmt = cx25840_s_sliced_fmt, | ||
1645 | .g_sliced_fmt = cx25840_g_sliced_fmt, | ||
1643 | }; | 1646 | }; |
1644 | 1647 | ||
1645 | static const struct v4l2_subdev_ops cx25840_ops = { | 1648 | static const struct v4l2_subdev_ops cx25840_ops = { |
diff --git a/drivers/media/video/cx25840/cx25840-core.h b/drivers/media/video/cx25840/cx25840-core.h index 55345444417..04393b97156 100644 --- a/drivers/media/video/cx25840/cx25840-core.h +++ b/drivers/media/video/cx25840/cx25840-core.h | |||
@@ -99,8 +99,9 @@ int cx25840_audio_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl); | |||
99 | 99 | ||
100 | /* ----------------------------------------------------------------------- */ | 100 | /* ----------------------------------------------------------------------- */ |
101 | /* cx25850-vbi.c */ | 101 | /* cx25850-vbi.c */ |
102 | int cx25840_vbi_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt); | 102 | int cx25840_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt); |
103 | int cx25840_vbi_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt); | 103 | int cx25840_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt); |
104 | int cx25840_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt); | ||
104 | int cx25840_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi); | 105 | int cx25840_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi); |
105 | 106 | ||
106 | #endif | 107 | #endif |
diff --git a/drivers/media/video/cx25840/cx25840-vbi.c b/drivers/media/video/cx25840/cx25840-vbi.c index 35f6592f6c4..64a4004f8a9 100644 --- a/drivers/media/video/cx25840/cx25840-vbi.c +++ b/drivers/media/video/cx25840/cx25840-vbi.c | |||
@@ -82,11 +82,10 @@ static int decode_vps(u8 * dst, u8 * p) | |||
82 | return err & 0xf0; | 82 | return err & 0xf0; |
83 | } | 83 | } |
84 | 84 | ||
85 | int cx25840_vbi_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | 85 | int cx25840_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi) |
86 | { | 86 | { |
87 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 87 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
88 | struct cx25840_state *state = to_state(sd); | 88 | struct cx25840_state *state = to_state(sd); |
89 | struct v4l2_sliced_vbi_format *svbi; | ||
90 | static const u16 lcr2vbi[] = { | 89 | static const u16 lcr2vbi[] = { |
91 | 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ | 90 | 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ |
92 | 0, V4L2_SLICED_WSS_625, 0, /* 4 */ | 91 | 0, V4L2_SLICED_WSS_625, 0, /* 4 */ |
@@ -97,9 +96,6 @@ int cx25840_vbi_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | |||
97 | int is_pal = !(state->std & V4L2_STD_525_60); | 96 | int is_pal = !(state->std & V4L2_STD_525_60); |
98 | int i; | 97 | int i; |
99 | 98 | ||
100 | if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) | ||
101 | return -EINVAL; | ||
102 | svbi = &fmt->fmt.sliced; | ||
103 | memset(svbi, 0, sizeof(*svbi)); | 99 | memset(svbi, 0, sizeof(*svbi)); |
104 | /* we're done if raw VBI is active */ | 100 | /* we're done if raw VBI is active */ |
105 | if ((cx25840_read(client, 0x404) & 0x10) == 0) | 101 | if ((cx25840_read(client, 0x404) & 0x10) == 0) |
@@ -127,32 +123,30 @@ int cx25840_vbi_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | |||
127 | return 0; | 123 | return 0; |
128 | } | 124 | } |
129 | 125 | ||
130 | int cx25840_vbi_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | 126 | int cx25840_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt) |
131 | { | 127 | { |
132 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 128 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
133 | struct cx25840_state *state = to_state(sd); | 129 | struct cx25840_state *state = to_state(sd); |
134 | struct v4l2_sliced_vbi_format *svbi; | ||
135 | int is_pal = !(state->std & V4L2_STD_525_60); | 130 | int is_pal = !(state->std & V4L2_STD_525_60); |
136 | int vbi_offset = is_pal ? 1 : 0; | 131 | int vbi_offset = is_pal ? 1 : 0; |
137 | int i, x; | ||
138 | u8 lcr[24]; | ||
139 | 132 | ||
140 | if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE && | 133 | /* Setup standard */ |
141 | fmt->type != V4L2_BUF_TYPE_VBI_CAPTURE) | 134 | cx25840_std_setup(client); |
142 | return -EINVAL; | ||
143 | svbi = &fmt->fmt.sliced; | ||
144 | if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | ||
145 | /* raw VBI */ | ||
146 | memset(svbi, 0, sizeof(*svbi)); | ||
147 | 135 | ||
148 | /* Setup standard */ | 136 | /* VBI Offset */ |
149 | cx25840_std_setup(client); | 137 | cx25840_write(client, 0x47f, vbi_offset); |
138 | cx25840_write(client, 0x404, 0x2e); | ||
139 | return 0; | ||
140 | } | ||
150 | 141 | ||
151 | /* VBI Offset */ | 142 | int cx25840_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi) |
152 | cx25840_write(client, 0x47f, vbi_offset); | 143 | { |
153 | cx25840_write(client, 0x404, 0x2e); | 144 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
154 | return 0; | 145 | struct cx25840_state *state = to_state(sd); |
155 | } | 146 | int is_pal = !(state->std & V4L2_STD_525_60); |
147 | int vbi_offset = is_pal ? 1 : 0; | ||
148 | int i, x; | ||
149 | u8 lcr[24]; | ||
156 | 150 | ||
157 | for (x = 0; x <= 23; x++) | 151 | for (x = 0; x <= 23; x++) |
158 | lcr[x] = 0x00; | 152 | lcr[x] = 0x00; |