diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-12-25 06:58:01 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-29 08:17:07 -0200 |
commit | ad1ecf8639e51ab8066cd4f37fd36b6b7cbdd8b3 (patch) | |
tree | 094cd457f4db08760e20fccc169029a0779bf6d0 /drivers/media/video/zoran/zoran_driver.c | |
parent | 08af245de0cf6ab5f4ed008ee2bb99273774fce0 (diff) |
[media] zoran: remove V4L1 compat code and zoran custom ioctls
All the functionality is now handled through V4L2.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/zoran/zoran_driver.c')
-rw-r--r-- | drivers/media/video/zoran/zoran_driver.c | 321 |
1 files changed, 0 insertions, 321 deletions
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index 67a52e844ae6..1b67b1914038 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c @@ -1528,323 +1528,6 @@ zoran_set_input (struct zoran *zr, * ioctl routine */ -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static long zoran_default(struct file *file, void *__fh, int cmd, void *arg) -{ - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; - struct zoran_jpg_settings settings; - - switch (cmd) { - case BUZIOC_G_PARAMS: - { - struct zoran_params *bparams = arg; - - dprintk(3, KERN_DEBUG "%s: BUZIOC_G_PARAMS\n", ZR_DEVNAME(zr)); - - memset(bparams, 0, sizeof(struct zoran_params)); - bparams->major_version = MAJOR_VERSION; - bparams->minor_version = MINOR_VERSION; - - mutex_lock(&zr->resource_lock); - - if (zr->norm & V4L2_STD_NTSC) - bparams->norm = ZORAN_VIDMODE_NTSC; - else if (zr->norm & V4L2_STD_SECAM) - bparams->norm = ZORAN_VIDMODE_SECAM; - else - bparams->norm = ZORAN_VIDMODE_PAL; - - bparams->input = zr->input; - - bparams->decimation = fh->jpg_settings.decimation; - bparams->HorDcm = fh->jpg_settings.HorDcm; - bparams->VerDcm = fh->jpg_settings.VerDcm; - bparams->TmpDcm = fh->jpg_settings.TmpDcm; - bparams->field_per_buff = fh->jpg_settings.field_per_buff; - bparams->img_x = fh->jpg_settings.img_x; - bparams->img_y = fh->jpg_settings.img_y; - bparams->img_width = fh->jpg_settings.img_width; - bparams->img_height = fh->jpg_settings.img_height; - bparams->odd_even = fh->jpg_settings.odd_even; - - bparams->quality = fh->jpg_settings.jpg_comp.quality; - bparams->APPn = fh->jpg_settings.jpg_comp.APPn; - bparams->APP_len = fh->jpg_settings.jpg_comp.APP_len; - memcpy(bparams->APP_data, - fh->jpg_settings.jpg_comp.APP_data, - sizeof(bparams->APP_data)); - bparams->COM_len = zr->jpg_settings.jpg_comp.COM_len; - memcpy(bparams->COM_data, - fh->jpg_settings.jpg_comp.COM_data, - sizeof(bparams->COM_data)); - bparams->jpeg_markers = - fh->jpg_settings.jpg_comp.jpeg_markers; - - mutex_unlock(&zr->resource_lock); - - bparams->VFIFO_FB = 0; - - return 0; - } - - case BUZIOC_S_PARAMS: - { - struct zoran_params *bparams = arg; - int res = 0; - - dprintk(3, KERN_DEBUG "%s: BUZIOC_S_PARAMS\n", ZR_DEVNAME(zr)); - - settings.decimation = bparams->decimation; - settings.HorDcm = bparams->HorDcm; - settings.VerDcm = bparams->VerDcm; - settings.TmpDcm = bparams->TmpDcm; - settings.field_per_buff = bparams->field_per_buff; - settings.img_x = bparams->img_x; - settings.img_y = bparams->img_y; - settings.img_width = bparams->img_width; - settings.img_height = bparams->img_height; - settings.odd_even = bparams->odd_even; - - settings.jpg_comp.quality = bparams->quality; - settings.jpg_comp.APPn = bparams->APPn; - settings.jpg_comp.APP_len = bparams->APP_len; - memcpy(settings.jpg_comp.APP_data, bparams->APP_data, - sizeof(bparams->APP_data)); - settings.jpg_comp.COM_len = bparams->COM_len; - memcpy(settings.jpg_comp.COM_data, bparams->COM_data, - sizeof(bparams->COM_data)); - settings.jpg_comp.jpeg_markers = bparams->jpeg_markers; - - mutex_lock(&zr->resource_lock); - - if (zr->codec_mode != BUZ_MODE_IDLE) { - dprintk(1, - KERN_ERR - "%s: BUZIOC_S_PARAMS called, but Buz in capture/playback mode\n", - ZR_DEVNAME(zr)); - res = -EINVAL; - goto sparams_unlock_and_return; - } - - /* Check the params first before overwriting our - * nternal values */ - if (zoran_check_jpg_settings(zr, &settings, 0)) { - res = -EINVAL; - goto sparams_unlock_and_return; - } - - fh->jpg_settings = settings; -sparams_unlock_and_return: - mutex_unlock(&zr->resource_lock); - - return res; - } - - case BUZIOC_REQBUFS: - { - struct zoran_requestbuffers *breq = arg; - int res = 0; - - dprintk(3, - KERN_DEBUG - "%s: BUZIOC_REQBUFS - count=%lu, size=%lu\n", - ZR_DEVNAME(zr), breq->count, breq->size); - - /* Enforce reasonable lower and upper limits */ - if (breq->count < 4) - breq->count = 4; /* Could be choosen smaller */ - if (breq->count > jpg_nbufs) - breq->count = jpg_nbufs; - breq->size = PAGE_ALIGN(breq->size); - if (breq->size < 8192) - breq->size = 8192; /* Arbitrary */ - /* breq->size is limited by 1 page for the stat_com - * tables to a Maximum of 2 MB */ - if (breq->size > jpg_bufsize) - breq->size = jpg_bufsize; - - mutex_lock(&zr->resource_lock); - - if (fh->buffers.allocated) { - dprintk(1, - KERN_ERR - "%s: BUZIOC_REQBUFS - buffers already allocated\n", - ZR_DEVNAME(zr)); - res = -EBUSY; - goto jpgreqbuf_unlock_and_return; - } - - /* The next mmap will map the MJPEG buffers - could - * also be *_PLAY, but it doesn't matter here */ - map_mode_jpg(fh, 0); - fh->buffers.num_buffers = breq->count; - fh->buffers.buffer_size = breq->size; - - if (jpg_fbuffer_alloc(fh)) { - res = -ENOMEM; - goto jpgreqbuf_unlock_and_return; - } - -jpgreqbuf_unlock_and_return: - mutex_unlock(&zr->resource_lock); - - return res; - } - - case BUZIOC_QBUF_CAPT: - { - int *frame = arg, res; - - dprintk(3, KERN_DEBUG "%s: BUZIOC_QBUF_CAPT - frame=%d\n", - ZR_DEVNAME(zr), *frame); - - mutex_lock(&zr->resource_lock); - res = jpg_qbuf(fh, *frame, BUZ_MODE_MOTION_COMPRESS); - mutex_unlock(&zr->resource_lock); - - return res; - } - - case BUZIOC_QBUF_PLAY: - { - int *frame = arg, res; - - dprintk(3, KERN_DEBUG "%s: BUZIOC_QBUF_PLAY - frame=%d\n", - ZR_DEVNAME(zr), *frame); - - mutex_lock(&zr->resource_lock); - res = jpg_qbuf(fh, *frame, BUZ_MODE_MOTION_DECOMPRESS); - mutex_unlock(&zr->resource_lock); - - return res; - } - - case BUZIOC_SYNC: - { - struct zoran_sync *bsync = arg; - int res; - - dprintk(3, KERN_DEBUG "%s: BUZIOC_SYNC\n", ZR_DEVNAME(zr)); - - mutex_lock(&zr->resource_lock); - - if (fh->map_mode == ZORAN_MAP_MODE_RAW) { - dprintk(2, KERN_WARNING - "%s: %s - not in jpg capture mode\n", - ZR_DEVNAME(zr), __func__); - res = -EINVAL; - } else { - res = jpg_sync(fh, bsync); - } - mutex_unlock(&zr->resource_lock); - - return res; - } - - case BUZIOC_G_STATUS: - { - struct zoran_status *bstat = arg; - int status = 0, res = 0; - v4l2_std_id norm; - - dprintk(3, KERN_DEBUG "%s: BUZIOC_G_STATUS\n", ZR_DEVNAME(zr)); - - if (zr->codec_mode != BUZ_MODE_IDLE) { - dprintk(1, - KERN_ERR - "%s: BUZIOC_G_STATUS called but Buz in capture/playback mode\n", - ZR_DEVNAME(zr)); - return -EINVAL; - } - - mutex_lock(&zr->resource_lock); - - if (zr->codec_mode != BUZ_MODE_IDLE) { - dprintk(1, - KERN_ERR - "%s: BUZIOC_G_STATUS called, but Buz in capture/playback mode\n", - ZR_DEVNAME(zr)); - res = -EINVAL; - goto gstat_unlock_and_return; - } - - decoder_call(zr, video, s_routing, - zr->card.input[bstat->input].muxsel, 0, 0); - - /* sleep 1 second */ - ssleep(1); - - /* Get status of video decoder */ - decoder_call(zr, video, querystd, &norm); - decoder_call(zr, video, g_input_status, &status); - - /* restore previous input and norm */ - decoder_call(zr, video, s_routing, - zr->card.input[zr->input].muxsel, 0, 0); -gstat_unlock_and_return: - mutex_unlock(&zr->resource_lock); - - if (!res) { - bstat->signal = - (status & V4L2_IN_ST_NO_SIGNAL) ? 0 : 1; - if (norm & V4L2_STD_NTSC) - bstat->norm = ZORAN_VIDMODE_NTSC; - else if (norm & V4L2_STD_SECAM) - bstat->norm = ZORAN_VIDMODE_SECAM; - else - bstat->norm = ZORAN_VIDMODE_PAL; - - bstat->color = - (status & V4L2_IN_ST_NO_COLOR) ? 0 : 1; - } - - return res; - } - - default: - return -EINVAL; - } -} - -static int zoran_vidiocgmbuf(struct file *file, void *__fh, struct video_mbuf *vmbuf) -{ - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; - int i, res = 0; - - - mutex_lock(&zr->resource_lock); - - if (fh->buffers.allocated) { - dprintk(1, - KERN_ERR - "%s: VIDIOCGMBUF - buffers already allocated\n", - ZR_DEVNAME(zr)); - res = -EINVAL; - goto v4l1reqbuf_unlock_and_return; - } - - /* The next mmap will map the V4L buffers */ - map_mode_raw(fh); - - if (v4l_fbuffer_alloc(fh)) { - res = -ENOMEM; - goto v4l1reqbuf_unlock_and_return; - } - - vmbuf->size = fh->buffers.num_buffers * fh->buffers.buffer_size; - vmbuf->frames = fh->buffers.num_buffers; - for (i = 0; i < vmbuf->frames; i++) - vmbuf->offsets[i] = i * fh->buffers.buffer_size; - -v4l1reqbuf_unlock_and_return: - mutex_unlock(&zr->resource_lock); - - return res; -} -#endif - static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability *cap) { struct zoran_fh *fh = __fh; @@ -3364,10 +3047,6 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_queryctrl = zoran_queryctrl, .vidioc_s_ctrl = zoran_s_ctrl, .vidioc_g_ctrl = zoran_g_ctrl, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidioc_default = zoran_default, - .vidiocgmbuf = zoran_vidiocgmbuf, -#endif }; /* please use zr->resource_lock consistently and kill this wrapper */ |