diff options
author | Sensoray Linux Development <linux-dev@sensoray.com> | 2011-04-04 14:23:03 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:28:41 -0400 |
commit | e42e28f9d696c6f4e7b16ad2b0f4558269b7d180 (patch) | |
tree | 748a58b208c6e0cbc52e9bc30f6bc23a381dadd0 /drivers/media/video/s2255drv.c | |
parent | d0ef8540f211ba7cde748ef4f0272cd49bfdb520 (diff) |
[media] s2255drv: jpeg enable module parameter
Adding jpeg enable module parameter.
Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/s2255drv.c')
-rw-r--r-- | drivers/media/video/s2255drv.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 46506d8381a2..5b9dce85645c 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
@@ -394,12 +394,17 @@ static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ | |||
394 | /* start video number */ | 394 | /* start video number */ |
395 | static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ | 395 | static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ |
396 | 396 | ||
397 | /* Enable jpeg capture. */ | ||
398 | static int jpeg_enable = 1; | ||
399 | |||
397 | module_param(debug, int, 0644); | 400 | module_param(debug, int, 0644); |
398 | MODULE_PARM_DESC(debug, "Debug level(0-100) default 0"); | 401 | MODULE_PARM_DESC(debug, "Debug level(0-100) default 0"); |
399 | module_param(vid_limit, int, 0644); | 402 | module_param(vid_limit, int, 0644); |
400 | MODULE_PARM_DESC(vid_limit, "video memory limit(Mb)"); | 403 | MODULE_PARM_DESC(vid_limit, "video memory limit(Mb)"); |
401 | module_param(video_nr, int, 0644); | 404 | module_param(video_nr, int, 0644); |
402 | MODULE_PARM_DESC(video_nr, "start video minor(-1 default autodetect)"); | 405 | MODULE_PARM_DESC(video_nr, "start video minor(-1 default autodetect)"); |
406 | module_param(jpeg_enable, int, 0644); | ||
407 | MODULE_PARM_DESC(jpeg_enable, "Jpeg enable(1-on 0-off) default 1"); | ||
403 | 408 | ||
404 | /* USB device table */ | 409 | /* USB device table */ |
405 | #define USB_SENSORAY_VID 0x1943 | 410 | #define USB_SENSORAY_VID 0x1943 |
@@ -413,6 +418,7 @@ MODULE_DEVICE_TABLE(usb, s2255_table); | |||
413 | #define BUFFER_TIMEOUT msecs_to_jiffies(400) | 418 | #define BUFFER_TIMEOUT msecs_to_jiffies(400) |
414 | 419 | ||
415 | /* image formats. */ | 420 | /* image formats. */ |
421 | /* JPEG formats must be defined last to support jpeg_enable parameter */ | ||
416 | static const struct s2255_fmt formats[] = { | 422 | static const struct s2255_fmt formats[] = { |
417 | { | 423 | { |
418 | .name = "4:2:2, planar, YUV422P", | 424 | .name = "4:2:2, planar, YUV422P", |
@@ -429,6 +435,10 @@ static const struct s2255_fmt formats[] = { | |||
429 | .fourcc = V4L2_PIX_FMT_UYVY, | 435 | .fourcc = V4L2_PIX_FMT_UYVY, |
430 | .depth = 16 | 436 | .depth = 16 |
431 | }, { | 437 | }, { |
438 | .name = "8bpp GREY", | ||
439 | .fourcc = V4L2_PIX_FMT_GREY, | ||
440 | .depth = 8 | ||
441 | }, { | ||
432 | .name = "JPG", | 442 | .name = "JPG", |
433 | .fourcc = V4L2_PIX_FMT_JPEG, | 443 | .fourcc = V4L2_PIX_FMT_JPEG, |
434 | .depth = 24 | 444 | .depth = 24 |
@@ -436,10 +446,6 @@ static const struct s2255_fmt formats[] = { | |||
436 | .name = "MJPG", | 446 | .name = "MJPG", |
437 | .fourcc = V4L2_PIX_FMT_MJPEG, | 447 | .fourcc = V4L2_PIX_FMT_MJPEG, |
438 | .depth = 24 | 448 | .depth = 24 |
439 | }, { | ||
440 | .name = "8bpp GREY", | ||
441 | .fourcc = V4L2_PIX_FMT_GREY, | ||
442 | .depth = 8 | ||
443 | } | 449 | } |
444 | }; | 450 | }; |
445 | 451 | ||
@@ -614,6 +620,9 @@ static const struct s2255_fmt *format_by_fourcc(int fourcc) | |||
614 | for (i = 0; i < ARRAY_SIZE(formats); i++) { | 620 | for (i = 0; i < ARRAY_SIZE(formats); i++) { |
615 | if (-1 == formats[i].fourcc) | 621 | if (-1 == formats[i].fourcc) |
616 | continue; | 622 | continue; |
623 | if (!jpeg_enable && ((formats[i].fourcc == V4L2_PIX_FMT_JPEG) || | ||
624 | (formats[i].fourcc == V4L2_PIX_FMT_MJPEG))) | ||
625 | continue; | ||
617 | if (formats[i].fourcc == fourcc) | 626 | if (formats[i].fourcc == fourcc) |
618 | return formats + i; | 627 | return formats + i; |
619 | } | 628 | } |
@@ -861,7 +870,9 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, | |||
861 | 870 | ||
862 | if (index >= ARRAY_SIZE(formats)) | 871 | if (index >= ARRAY_SIZE(formats)) |
863 | return -EINVAL; | 872 | return -EINVAL; |
864 | 873 | if (!jpeg_enable && ((formats[index].fourcc == V4L2_PIX_FMT_JPEG) || | |
874 | (formats[index].fourcc == V4L2_PIX_FMT_MJPEG))) | ||
875 | return -EINVAL; | ||
865 | dprintk(4, "name %s\n", formats[index].name); | 876 | dprintk(4, "name %s\n", formats[index].name); |
866 | strlcpy(f->description, formats[index].name, sizeof(f->description)); | 877 | strlcpy(f->description, formats[index].name, sizeof(f->description)); |
867 | f->pixelformat = formats[index].fourcc; | 878 | f->pixelformat = formats[index].fourcc; |