#include <linux/config.h>
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/vmalloc.h>
MODULE_SUPPORTED_DEVICE("video");
#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"
#ifndef VID_HARDWARE_CPIA
return ret;
}
-static int cpia_write_proc(struct file *file, const char *buf,
+static int cpia_write_proc(struct file *file, const char __user *buf,
unsigned long count, void *data)
{
struct cam_data *cam = data;
static void proc_cpia_create(void)
{
- cpia_proc_root = create_proc_entry("cpia", S_IFDIR, 0);
+ cpia_proc_root = create_proc_entry("cpia", S_IFDIR, NULL);
if (cpia_proc_root)
cpia_proc_root->owner = THIS_MODULE;
static void __exit proc_cpia_destroy(void)
{
- remove_proc_entry("cpia", 0);
+ remove_proc_entry("cpia", NULL);
}
#endif /* CONFIG_PROC_FS */
/* supported frame palettes and depths */
static inline int valid_mode(u16 palette, u16 depth)
{
- return (palette == VIDEO_PALETTE_GREY && depth == 8) ||
- (palette == VIDEO_PALETTE_RGB555 && depth == 16) ||
- (palette == VIDEO_PALETTE_RGB565 && depth == 16) ||
- (palette == VIDEO_PALETTE_RGB24 && depth == 24) ||
- (palette == VIDEO_PALETTE_RGB32 && depth == 32) ||
- (palette == VIDEO_PALETTE_YUV422 && depth == 16) ||
- (palette == VIDEO_PALETTE_YUYV && depth == 16) ||
- (palette == VIDEO_PALETTE_UYVY && depth == 16);
+ 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) ||
+ (palette == VIDEO_PALETTE_RGB555 && depth == 16) ||
+ (palette == VIDEO_PALETTE_RGB565 && depth == 16) ||
+ (palette == VIDEO_PALETTE_RGB24 && depth == 24) ||
+ (palette == VIDEO_PALETTE_RGB32 && depth == 32) ||
+ (palette == VIDEO_PALETTE_UYVY && depth == 16);
+
+ return 0;
}
static int match_videosize( int width, int height )
int i;
rvfree(cam->frame_buf, FRAME_NUM*CPIA_MAX_FRAME_SIZE);
- cam->frame_buf = 0;
+ cam->frame_buf = NULL;
for (i=0; i < FRAME_NUM; i++)
cam->frame[i].data = NULL;
return 0;
}
-static ssize_t cpia_read(struct file *file, char *buf,
+static ssize_t cpia_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct video_device *dev = file->private_data;
{
printk(KERN_INFO "%s v%d.%d.%d\n", ABOUT,
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
proc_cpia_create();
#endif