Commit e91b5c70 authored by Luca Risolia's avatar Luca Risolia Committed by Linus Torvalds

[PATCH] Disable colour conversion in the CPiA Video Camera driver

Since in-kernel colorspace conversion is not allowed, this patch disables it
in the CPiA video camera driver by default.  Users should fix the applications
in case they don't work without conversion reenabled by setting the new
'colorspace_conv' module parameter to 1.  This is a temporary solution, so
within a few months deprecated code will be entirely removed.
Signed-off-by: default avatarLuca Risolia <luca.risolia@studio.unibo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1afdb8bb
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
...@@ -62,6 +63,15 @@ MODULE_LICENSE("GPL"); ...@@ -62,6 +63,15 @@ MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("video"); MODULE_SUPPORTED_DEVICE("video");
#endif #endif
static unsigned short colorspace_conv = 0;
module_param(colorspace_conv, ushort, 0444);
MODULE_PARM_DESC(colorspace_conv,
"\n<n> Colorspace conversion:"
"\n0 = disable"
"\n1 = enable"
"\nDefault value is 0"
"\n");
#define ABOUT "V4L-Driver for Vision CPiA based cameras" #define ABOUT "V4L-Driver for Vision CPiA based cameras"
#ifndef VID_HARDWARE_CPIA #ifndef VID_HARDWARE_CPIA
...@@ -1428,14 +1438,19 @@ static void __exit proc_cpia_destroy(void) ...@@ -1428,14 +1438,19 @@ static void __exit proc_cpia_destroy(void)
/* supported frame palettes and depths */ /* supported frame palettes and depths */
static inline int valid_mode(u16 palette, u16 depth) static inline int valid_mode(u16 palette, u16 depth)
{ {
if ((palette == VIDEO_PALETTE_YUV422 && depth == 16) ||
(palette == VIDEO_PALETTE_YUYV && depth == 16))
return 1;
if (colorspace_conv)
return (palette == VIDEO_PALETTE_GREY && depth == 8) || return (palette == VIDEO_PALETTE_GREY && depth == 8) ||
(palette == VIDEO_PALETTE_RGB555 && depth == 16) || (palette == VIDEO_PALETTE_RGB555 && depth == 16) ||
(palette == VIDEO_PALETTE_RGB565 && depth == 16) || (palette == VIDEO_PALETTE_RGB565 && depth == 16) ||
(palette == VIDEO_PALETTE_RGB24 && depth == 24) || (palette == VIDEO_PALETTE_RGB24 && depth == 24) ||
(palette == VIDEO_PALETTE_RGB32 && depth == 32) || (palette == VIDEO_PALETTE_RGB32 && depth == 32) ||
(palette == VIDEO_PALETTE_YUV422 && depth == 16) ||
(palette == VIDEO_PALETTE_YUYV && depth == 16) ||
(palette == VIDEO_PALETTE_UYVY && depth == 16); (palette == VIDEO_PALETTE_UYVY && depth == 16);
return 0;
} }
static int match_videosize( int width, int height ) static int match_videosize( int width, int height )
...@@ -4040,6 +4055,13 @@ static int __init cpia_init(void) ...@@ -4040,6 +4055,13 @@ static int __init cpia_init(void)
{ {
printk(KERN_INFO "%s v%d.%d.%d\n", ABOUT, printk(KERN_INFO "%s v%d.%d.%d\n", ABOUT,
CPIA_MAJ_VER, CPIA_MIN_VER, CPIA_PATCH_VER); CPIA_MAJ_VER, CPIA_MIN_VER, CPIA_PATCH_VER);
printk(KERN_WARNING "Since in-kernel colorspace conversion is not "
"allowed, it is disabled by default now. Users should fix the "
"applications in case they don't work without conversion "
"reenabled by setting the 'colorspace_conv' module "
"parameter to 1");
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
proc_cpia_create(); proc_cpia_create();
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment