* [PATCH 2/2] [media] s2255drv: jpeg enable module parameter
@ 2011-04-04 18:23 Sensoray Linux Development
2011-05-02 16:39 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 2+ messages in thread
From: Sensoray Linux Development @ 2011-04-04 18:23 UTC (permalink / raw)
To: Linux Media Mailing List
Adding jpeg enable module parameter.
Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
---
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;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] [media] s2255drv: jpeg enable module parameter
2011-04-04 18:23 [PATCH 2/2] [media] s2255drv: jpeg enable module parameter Sensoray Linux Development
@ 2011-05-02 16:39 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2011-05-02 16:39 UTC (permalink / raw)
To: Sensoray Linux Development; +Cc: Linux Media Mailing List
Em 04-04-2011 15:23, Sensoray Linux Development escreveu:
> Adding jpeg enable module parameter.
This one has also some bad whitespacing.
I've applied both. Please next time, double check it before sending me a patch.
Thanks,
Mauro
>
> Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
>
> ---
> 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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-05-02 16:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-04 18:23 [PATCH 2/2] [media] s2255drv: jpeg enable module parameter Sensoray Linux Development
2011-05-02 16:39 ` Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox