From patchwork Mon Apr 4 18:23:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sensoray-dev X-Patchwork-Id: 685201 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p34INOHq013555 for ; Mon, 4 Apr 2011 18:23:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755202Ab1DDSXG (ORCPT ); Mon, 4 Apr 2011 14:23:06 -0400 Received: from gateway09.websitewelcome.com ([67.18.144.14]:44479 "HELO gateway09.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754865Ab1DDSXF (ORCPT ); Mon, 4 Apr 2011 14:23:05 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 04 Apr 2011 18:23:27 +0000 (UTC) X-Greylist: delayed 395 seconds by postgrey-1.27 at vger.kernel.org; Mon, 04 Apr 2011 14:23:05 EDT Received: (qmail 18431 invoked from network); 4 Apr 2011 18:21:30 -0000 Received: from gator886.hostgator.com (174.120.40.226) by gateway09.websitewelcome.com with SMTP; 4 Apr 2011 18:21:30 -0000 Received: from [50.39.76.146] (port=17275 helo=[10.140.5.32]) by gator886.hostgator.com with esmtp (Exim 4.69) (envelope-from ) id 1Q6oQZ-0001md-NN for linux-media@vger.kernel.org; Mon, 04 Apr 2011 13:23:03 -0500 Message-ID: <4D9A0C87.40309@sensoray.com> Date: Mon, 04 Apr 2011 11:23:03 -0700 From: Sensoray Linux Development User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 To: Linux Media Mailing List Subject: [PATCH 2/2] [media] s2255drv: jpeg enable module parameter X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator886.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - sensoray.com X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: static-50-39-76-146.bvtn.or.frontiernet.net ([10.140.5.32]) [50.39.76.146]:17275 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Adding jpeg enable module parameter. Signed-off-by: Dean Anderson --- 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 38e5c4b..eb33e1e 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -389,12 +389,17 @@ static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ /* start video number */ static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ +/* Enable jpeg capture. */ +static int jpeg_enable = 1; + module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Debug level(0-100) default 0"); module_param(vid_limit, int, 0644); MODULE_PARM_DESC(vid_limit, "video memory limit(Mb)"); module_param(video_nr, int, 0644); MODULE_PARM_DESC(video_nr, "start video minor(-1 default autodetect)"); +module_param(jpeg_enable, int, 0644); +MODULE_PARM_DESC(jpeg_enable, "Jpeg enable(1-on 0-off) default 1"); /* USB device table */ #define USB_SENSORAY_VID 0x1943 @@ -408,6 +413,7 @@ MODULE_DEVICE_TABLE(usb, s2255_table); #define BUFFER_TIMEOUT msecs_to_jiffies(400) /* image formats. */ +/* JPEG formats must be defined last to support jpeg_enable parameter */ static const struct s2255_fmt formats[] = { { .name = "4:2:2, planar, YUV422P", @@ -424,6 +430,10 @@ static const struct s2255_fmt formats[] = { .fourcc = V4L2_PIX_FMT_UYVY, .depth = 16 }, { + .name = "8bpp GREY", + .fourcc = V4L2_PIX_FMT_GREY, + .depth = 8 + }, { .name = "JPG", .fourcc = V4L2_PIX_FMT_JPEG, .depth = 24 @@ -431,10 +441,6 @@ static const struct s2255_fmt formats[] = { .name = "MJPG", .fourcc = V4L2_PIX_FMT_MJPEG, .depth = 24 - }, { - .name = "8bpp GREY", - .fourcc = V4L2_PIX_FMT_GREY, - .depth = 8 } }; @@ -609,6 +615,9 @@ static const struct s2255_fmt *format_by_fourcc(int fourcc) for (i = 0; i < ARRAY_SIZE(formats); i++) { if (-1 == formats[i].fourcc) continue; + if (!jpeg_enable && ((formats[i].fourcc == V4L2_PIX_FMT_JPEG) || + (formats[i].fourcc == V4L2_PIX_FMT_MJPEG))) + continue; if (formats[i].fourcc == fourcc) return formats + i; } @@ -856,7 +865,9 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, if (index >= ARRAY_SIZE(formats)) return -EINVAL; - + if (!jpeg_enable && ((formats[index].fourcc == V4L2_PIX_FMT_JPEG) || + (formats[index].fourcc == V4L2_PIX_FMT_MJPEG))) + return -EINVAL; dprintk(4, "name %s\n", formats[index].name); strlcpy(f->description, formats[index].name, sizeof(f->description)); f->pixelformat = formats[index].fourcc;