diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-03-02 11:02:11 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-03-08 09:03:51 -0500 |
commit | eb2ba855470797b20dced364f5897cc949e7ade6 (patch) | |
tree | 84d5543750c89c3167ac0712c7e999d2a28e9892 /drivers/media/video | |
parent | 072e660257ee26e4f4defd836b1e1fa23d68de32 (diff) |
[media] ivtv: simplify how the decoder controls are set up
The code was unnecessarily complex, introducing a hdl_out handler that was
not needed. Instead just add the controls to the cxhdl.hdl handler directly.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-controls.c | 4 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.c | 20 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.h | 1 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 5 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-streams.c | 5 |
5 files changed, 12 insertions, 23 deletions
diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c index e2901184db09..c60424601cb9 100644 --- a/drivers/media/video/ivtv/ivtv-controls.c +++ b/drivers/media/video/ivtv/ivtv-controls.c | |||
@@ -129,7 +129,7 @@ int ivtv_g_pts_frame(struct ivtv *itv, s64 *pts, s64 *frame) | |||
129 | 129 | ||
130 | static int ivtv_g_volatile_ctrl(struct v4l2_ctrl *ctrl) | 130 | static int ivtv_g_volatile_ctrl(struct v4l2_ctrl *ctrl) |
131 | { | 131 | { |
132 | struct ivtv *itv = container_of(ctrl->handler, struct ivtv, hdl_out); | 132 | struct ivtv *itv = container_of(ctrl->handler, struct ivtv, cxhdl.hdl); |
133 | 133 | ||
134 | switch (ctrl->id) { | 134 | switch (ctrl->id) { |
135 | /* V4L2_CID_MPEG_VIDEO_DEC_PTS and V4L2_CID_MPEG_VIDEO_DEC_FRAME | 135 | /* V4L2_CID_MPEG_VIDEO_DEC_PTS and V4L2_CID_MPEG_VIDEO_DEC_FRAME |
@@ -143,7 +143,7 @@ static int ivtv_g_volatile_ctrl(struct v4l2_ctrl *ctrl) | |||
143 | 143 | ||
144 | static int ivtv_s_ctrl(struct v4l2_ctrl *ctrl) | 144 | static int ivtv_s_ctrl(struct v4l2_ctrl *ctrl) |
145 | { | 145 | { |
146 | struct ivtv *itv = container_of(ctrl->handler, struct ivtv, hdl_out); | 146 | struct ivtv *itv = container_of(ctrl->handler, struct ivtv, cxhdl.hdl); |
147 | 147 | ||
148 | switch (ctrl->id) { | 148 | switch (ctrl->id) { |
149 | /* V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK and MULTILINGUAL_PLAYBACK | 149 | /* V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK and MULTILINGUAL_PLAYBACK |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index 107e9e6d6a52..cfc4276d907e 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -1198,28 +1198,28 @@ static int __devinit ivtv_probe(struct pci_dev *pdev, | |||
1198 | itv->tuner_std = itv->std; | 1198 | itv->tuner_std = itv->std; |
1199 | 1199 | ||
1200 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { | 1200 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { |
1201 | v4l2_ctrl_handler_init(&itv->hdl_out, 50); | 1201 | struct v4l2_ctrl_handler *hdl = itv->v4l2_dev.ctrl_handler; |
1202 | itv->ctrl_pts = v4l2_ctrl_new_std(&itv->hdl_out, &ivtv_hdl_out_ops, | 1202 | |
1203 | itv->ctrl_pts = v4l2_ctrl_new_std(hdl, &ivtv_hdl_out_ops, | ||
1203 | V4L2_CID_MPEG_VIDEO_DEC_PTS, 0, 0, 1, 0); | 1204 | V4L2_CID_MPEG_VIDEO_DEC_PTS, 0, 0, 1, 0); |
1204 | itv->ctrl_frame = v4l2_ctrl_new_std(&itv->hdl_out, &ivtv_hdl_out_ops, | 1205 | itv->ctrl_frame = v4l2_ctrl_new_std(hdl, &ivtv_hdl_out_ops, |
1205 | V4L2_CID_MPEG_VIDEO_DEC_FRAME, 0, 0x7fffffff, 1, 0); | 1206 | V4L2_CID_MPEG_VIDEO_DEC_FRAME, 0, 0x7fffffff, 1, 0); |
1206 | /* Note: V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO is not supported, | 1207 | /* Note: V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO is not supported, |
1207 | mask that menu item. */ | 1208 | mask that menu item. */ |
1208 | itv->ctrl_audio_playback = | 1209 | itv->ctrl_audio_playback = |
1209 | v4l2_ctrl_new_std_menu(&itv->hdl_out, &ivtv_hdl_out_ops, | 1210 | v4l2_ctrl_new_std_menu(hdl, &ivtv_hdl_out_ops, |
1210 | V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK, | 1211 | V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK, |
1211 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO, | 1212 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO, |
1212 | 1 << V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO, | 1213 | 1 << V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO, |
1213 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO); | 1214 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO); |
1214 | itv->ctrl_audio_multilingual_playback = | 1215 | itv->ctrl_audio_multilingual_playback = |
1215 | v4l2_ctrl_new_std_menu(&itv->hdl_out, &ivtv_hdl_out_ops, | 1216 | v4l2_ctrl_new_std_menu(hdl, &ivtv_hdl_out_ops, |
1216 | V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK, | 1217 | V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK, |
1217 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO, | 1218 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO, |
1218 | 1 << V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO, | 1219 | 1 << V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO, |
1219 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT); | 1220 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT); |
1220 | v4l2_ctrl_add_handler(&itv->hdl_out, &itv->cxhdl.hdl); | 1221 | if (hdl->error) { |
1221 | if (itv->hdl_out.error) { | 1222 | retval = hdl->error; |
1222 | retval = itv->hdl_out.error; | ||
1223 | goto free_i2c; | 1223 | goto free_i2c; |
1224 | } | 1224 | } |
1225 | v4l2_ctrl_cluster(2, &itv->ctrl_pts); | 1225 | v4l2_ctrl_cluster(2, &itv->ctrl_pts); |
@@ -1260,8 +1260,6 @@ free_streams: | |||
1260 | free_irq: | 1260 | free_irq: |
1261 | free_irq(itv->pdev->irq, (void *)itv); | 1261 | free_irq(itv->pdev->irq, (void *)itv); |
1262 | free_i2c: | 1262 | free_i2c: |
1263 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) | ||
1264 | v4l2_ctrl_handler_free(&itv->hdl_out); | ||
1265 | v4l2_ctrl_handler_free(&itv->cxhdl.hdl); | 1263 | v4l2_ctrl_handler_free(&itv->cxhdl.hdl); |
1266 | exit_ivtv_i2c(itv); | 1264 | exit_ivtv_i2c(itv); |
1267 | free_io: | 1265 | free_io: |
@@ -1418,8 +1416,6 @@ static void ivtv_remove(struct pci_dev *pdev) | |||
1418 | ivtv_streams_cleanup(itv, 1); | 1416 | ivtv_streams_cleanup(itv, 1); |
1419 | ivtv_udma_free(itv); | 1417 | ivtv_udma_free(itv); |
1420 | 1418 | ||
1421 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) | ||
1422 | v4l2_ctrl_handler_free(&itv->hdl_out); | ||
1423 | v4l2_ctrl_handler_free(&itv->cxhdl.hdl); | 1419 | v4l2_ctrl_handler_free(&itv->cxhdl.hdl); |
1424 | 1420 | ||
1425 | exit_ivtv_i2c(itv); | 1421 | exit_ivtv_i2c(itv); |
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index f83857aedbd1..f767df943954 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h | |||
@@ -641,7 +641,6 @@ struct ivtv { | |||
641 | struct v4l2_ctrl *ctrl_audio_playback; | 641 | struct v4l2_ctrl *ctrl_audio_playback; |
642 | struct v4l2_ctrl *ctrl_audio_multilingual_playback; | 642 | struct v4l2_ctrl *ctrl_audio_multilingual_playback; |
643 | }; | 643 | }; |
644 | struct v4l2_ctrl_handler hdl_out; | ||
645 | struct v4l2_ctrl_handler hdl_gpio; | 644 | struct v4l2_ctrl_handler hdl_gpio; |
646 | struct v4l2_subdev sd_gpio; /* GPIO sub-device */ | 645 | struct v4l2_subdev sd_gpio; /* GPIO sub-device */ |
647 | u16 instance; | 646 | u16 instance; |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 385e003fcfbb..5452beef8e11 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -1548,10 +1548,7 @@ static int ivtv_log_status(struct file *file, void *fh) | |||
1548 | } | 1548 | } |
1549 | IVTV_INFO("Tuner: %s\n", | 1549 | IVTV_INFO("Tuner: %s\n", |
1550 | test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? "Radio" : "TV"); | 1550 | test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? "Radio" : "TV"); |
1551 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) | 1551 | v4l2_ctrl_handler_log_status(&itv->cxhdl.hdl, itv->v4l2_dev.name); |
1552 | v4l2_ctrl_handler_log_status(&itv->hdl_out, itv->v4l2_dev.name); | ||
1553 | else | ||
1554 | v4l2_ctrl_handler_log_status(&itv->cxhdl.hdl, itv->v4l2_dev.name); | ||
1555 | IVTV_INFO("Status flags: 0x%08lx\n", itv->i_flags); | 1552 | IVTV_INFO("Status flags: 0x%08lx\n", itv->i_flags); |
1556 | for (i = 0; i < IVTV_MAX_STREAMS; i++) { | 1553 | for (i = 0; i < IVTV_MAX_STREAMS; i++) { |
1557 | struct ivtv_stream *s = &itv->streams[i]; | 1554 | struct ivtv_stream *s = &itv->streams[i]; |
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 9cc037c12609..7ea5ca7f012b 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
@@ -223,11 +223,8 @@ static int ivtv_prep_dev(struct ivtv *itv, int type) | |||
223 | 223 | ||
224 | s->vdev->num = num; | 224 | s->vdev->num = num; |
225 | s->vdev->v4l2_dev = &itv->v4l2_dev; | 225 | s->vdev->v4l2_dev = &itv->v4l2_dev; |
226 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) | ||
227 | s->vdev->ctrl_handler = &itv->hdl_out; | ||
228 | else | ||
229 | s->vdev->ctrl_handler = itv->v4l2_dev.ctrl_handler; | ||
230 | s->vdev->fops = ivtv_stream_info[type].fops; | 226 | s->vdev->fops = ivtv_stream_info[type].fops; |
227 | s->vdev->ctrl_handler = itv->v4l2_dev.ctrl_handler; | ||
231 | s->vdev->release = video_device_release; | 228 | s->vdev->release = video_device_release; |
232 | s->vdev->tvnorms = V4L2_STD_ALL; | 229 | s->vdev->tvnorms = V4L2_STD_ALL; |
233 | s->vdev->lock = &itv->serialize_lock; | 230 | s->vdev->lock = &itv->serialize_lock; |