Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Sensoray Linux Development and committed by
Mauro Carvalho Chehab
e42e28f9 d0ef8540

+16 -5
+16 -5
drivers/media/video/s2255drv.c
··· 394 394 /* start video number */ 395 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 400 module_param(debug, int, 0644); 398 401 MODULE_PARM_DESC(debug, "Debug level(0-100) default 0"); 399 402 module_param(vid_limit, int, 0644); 400 403 MODULE_PARM_DESC(vid_limit, "video memory limit(Mb)"); 401 404 module_param(video_nr, int, 0644); 402 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 409 /* USB device table */ 405 410 #define USB_SENSORAY_VID 0x1943 ··· 418 413 #define BUFFER_TIMEOUT msecs_to_jiffies(400) 419 414 420 415 /* image formats. */ 416 + /* JPEG formats must be defined last to support jpeg_enable parameter */ 421 417 static const struct s2255_fmt formats[] = { 422 418 { 423 419 .name = "4:2:2, planar, YUV422P", ··· 435 429 .fourcc = V4L2_PIX_FMT_UYVY, 436 430 .depth = 16 437 431 }, { 432 + .name = "8bpp GREY", 433 + .fourcc = V4L2_PIX_FMT_GREY, 434 + .depth = 8 435 + }, { 438 436 .name = "JPG", 439 437 .fourcc = V4L2_PIX_FMT_JPEG, 440 438 .depth = 24 ··· 446 436 .name = "MJPG", 447 437 .fourcc = V4L2_PIX_FMT_MJPEG, 448 438 .depth = 24 449 - }, { 450 - .name = "8bpp GREY", 451 - .fourcc = V4L2_PIX_FMT_GREY, 452 - .depth = 8 453 439 } 454 440 }; 455 441 ··· 620 614 for (i = 0; i < ARRAY_SIZE(formats); i++) { 621 615 if (-1 == formats[i].fourcc) 622 616 continue; 617 + if (!jpeg_enable && ((formats[i].fourcc == V4L2_PIX_FMT_JPEG) || 618 + (formats[i].fourcc == V4L2_PIX_FMT_MJPEG))) 619 + continue; 623 620 if (formats[i].fourcc == fourcc) 624 621 return formats + i; 625 622 } ··· 870 861 871 862 if (index >= ARRAY_SIZE(formats)) 872 863 return -EINVAL; 873 - 864 + if (!jpeg_enable && ((formats[index].fourcc == V4L2_PIX_FMT_JPEG) || 865 + (formats[index].fourcc == V4L2_PIX_FMT_MJPEG))) 866 + return -EINVAL; 874 867 dprintk(4, "name %s\n", formats[index].name); 875 868 strlcpy(f->description, formats[index].name, sizeof(f->description)); 876 869 f->pixelformat = formats[index].fourcc;