diff options
-rw-r--r-- | drivers/media/video/gspca/conex.c | 98 | ||||
-rw-r--r-- | drivers/media/video/gspca/etoms.c | 546 | ||||
-rw-r--r-- | drivers/media/video/gspca/gspca.c | 6 | ||||
-rw-r--r-- | drivers/media/video/gspca/gspca.h | 26 | ||||
-rw-r--r-- | drivers/media/video/gspca/mars.c | 13 | ||||
-rw-r--r-- | drivers/media/video/gspca/ov519.c | 60 | ||||
-rw-r--r-- | drivers/media/video/gspca/pac207.c | 14 | ||||
-rw-r--r-- | drivers/media/video/gspca/pac7311.c | 40 | ||||
-rw-r--r-- | drivers/media/video/gspca/sonixj.c | 165 | ||||
-rw-r--r-- | drivers/media/video/gspca/spca500.c | 301 | ||||
-rw-r--r-- | drivers/media/video/gspca/spca501.c | 27 | ||||
-rw-r--r-- | drivers/media/video/gspca/spca505.c | 22 | ||||
-rw-r--r-- | drivers/media/video/gspca/spca508.c | 22 | ||||
-rw-r--r-- | drivers/media/video/gspca/spca561.c | 30 | ||||
-rw-r--r-- | drivers/media/video/gspca/stk014.c | 36 | ||||
-rw-r--r-- | drivers/media/video/gspca/sunplus.c | 28 | ||||
-rw-r--r-- | drivers/media/video/gspca/t613.c | 198 | ||||
-rw-r--r-- | drivers/media/video/gspca/tv8532.c | 22 | ||||
-rw-r--r-- | drivers/media/video/gspca/vc032x.c | 80 | ||||
-rw-r--r-- | drivers/media/video/gspca/zc3xx.c | 246 |
20 files changed, 932 insertions, 1048 deletions
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c index 473bea750b5f..6d50247b7ad2 100644 --- a/drivers/media/video/gspca/conex.c +++ b/drivers/media/video/gspca/conex.c @@ -25,8 +25,8 @@ #define CONEX_CAM 1 /* special JPEG header */ #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3) -static const char version[] = "2.1.3"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver"); @@ -229,7 +229,7 @@ static void cx11646_fw(struct gspca_dev*gspca_dev) reg_w(gspca_dev->dev, 0x006a, &val, 1); } -static __u8 cxsensor[] = { +static const __u8 cxsensor[] = { 0x88, 0x12, 0x70, 0x01, 0x88, 0x0d, 0x02, 0x01, 0x88, 0x0f, 0x00, 0x01, @@ -244,24 +244,24 @@ static __u8 cxsensor[] = { 0x00 }; -static __u8 reg20[] = { 0x10, 0x42, 0x81, 0x19, 0xd3, 0xff, 0xa7, 0xff }; -static __u8 reg28[] = { 0x87, 0x00, 0x87, 0x00, 0x8f, 0xff, 0xea, 0xff }; -static __u8 reg10[] = { 0xb1, 0xb1 }; -static __u8 reg71a[] = { 0x08, 0x18, 0x0a, 0x1e }; /* 640 */ -static __u8 reg71b[] = { 0x04, 0x0c, 0x05, 0x0f }; +static const __u8 reg20[] = { 0x10, 0x42, 0x81, 0x19, 0xd3, 0xff, 0xa7, 0xff }; +static const __u8 reg28[] = { 0x87, 0x00, 0x87, 0x00, 0x8f, 0xff, 0xea, 0xff }; +static const __u8 reg10[] = { 0xb1, 0xb1 }; +static const __u8 reg71a[] = { 0x08, 0x18, 0x0a, 0x1e }; /* 640 */ +static const __u8 reg71b[] = { 0x04, 0x0c, 0x05, 0x0f }; /* 352{0x04,0x0a,0x06,0x12}; //352{0x05,0x0e,0x06,0x11}; //352 */ -static __u8 reg71c[] = { 0x02, 0x07, 0x03, 0x09 }; +static const __u8 reg71c[] = { 0x02, 0x07, 0x03, 0x09 }; /* 320{0x04,0x0c,0x05,0x0f}; //320 */ -static __u8 reg71d[] = { 0x02, 0x07, 0x03, 0x09 }; /* 176 */ -static __u8 reg7b[] = { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff }; +static const __u8 reg71d[] = { 0x02, 0x07, 0x03, 0x09 }; /* 176 */ +static const __u8 reg7b[] = { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff }; static void cx_sensor(struct gspca_dev*gspca_dev) { - __u8 val = 0; + __u8 val; int i = 0; __u8 bufread[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - int length = 0; - __u8 *ptsensor = cxsensor; + int length; + const __u8 *ptsensor = cxsensor; reg_w(gspca_dev->dev, 0x0020, reg20, 8); reg_w(gspca_dev->dev, 0x0028, reg28, 8); @@ -305,7 +305,7 @@ static void cx_sensor(struct gspca_dev*gspca_dev) reg_r(gspca_dev->dev, 0x00e7, bufread, 8); } -static __u8 cx_inits_176[] = { +static const __u8 cx_inits_176[] = { 0x33, 0x81, 0xB0, 0x00, 0x90, 0x00, 0x0A, 0x03, /* 176x144 */ 0x00, 0x03, 0x03, 0x03, 0x1B, 0x05, 0x30, 0x03, 0x65, 0x15, 0x18, 0x25, 0x03, 0x25, 0x08, 0x30, @@ -314,7 +314,7 @@ static __u8 cx_inits_176[] = { 0xF7, 0xFF, 0x88, 0xFF, 0x66, 0x02, 0x28, 0x02, 0x1E, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static __u8 cx_inits_320[] = { +static const __u8 cx_inits_320[] = { 0x7f, 0x7f, 0x40, 0x01, 0xf0, 0x00, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x02, 0x01, 0x65, 0x45, 0xfa, 0x4c, 0x2c, 0xdf, 0xb9, 0x81, @@ -323,7 +323,7 @@ static __u8 cx_inits_320[] = { 0xf5, 0xff, 0x6d, 0xff, 0xf6, 0x01, 0x43, 0x02, 0xd3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static __u8 cx_inits_352[] = { +static const __u8 cx_inits_352[] = { 0x2e, 0x7c, 0x60, 0x01, 0x20, 0x01, 0x05, 0x03, 0x00, 0x06, 0x03, 0x06, 0x1b, 0x10, 0x05, 0x3b, 0x30, 0x25, 0x18, 0x25, 0x08, 0x30, 0x03, 0x25, @@ -332,7 +332,7 @@ static __u8 cx_inits_352[] = { 0xf5, 0xff, 0x6b, 0xff, 0xee, 0x01, 0x43, 0x02, 0xe4, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static __u8 cx_inits_640[] = { +static const __u8 cx_inits_640[] = { 0x7e, 0x7e, 0x80, 0x02, 0xe0, 0x01, 0x01, 0x01, 0x00, 0x02, 0x01, 0x02, 0x10, 0x30, 0x01, 0x01, 0x65, 0x45, 0xf7, 0x52, 0x2c, 0xdf, 0xb9, 0x81, @@ -344,7 +344,7 @@ static __u8 cx_inits_640[] = { static int cx11646_initsize(struct gspca_dev *gspca_dev) { - __u8 *cxinit; + const __u8 *cxinit; __u8 val; static const __u8 reg12[] = { 0x08, 0x05, 0x07, 0x04, 0x24 }; static const __u8 reg17[] = @@ -396,7 +396,7 @@ static int cx11646_initsize(struct gspca_dev *gspca_dev) return val; } -static __u8 cx_jpeg_init[][8] = { +static const __u8 cx_jpeg_init[][8] = { {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x15}, /* 1 */ {0x0f, 0x10, 0x12, 0x10, 0x0d, 0x15, 0x12, 0x11}, {0x12, 0x18, 0x16, 0x15, 0x19, 0x20, 0x35, 0x22}, @@ -479,7 +479,7 @@ static __u8 cx_jpeg_init[][8] = { }; -static __u8 cxjpeg_640[][8] = { +static const __u8 cxjpeg_640[][8] = { {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x10}, /* 1 */ {0x0b, 0x0c, 0x0e, 0x0c, 0x0a, 0x10, 0x0e, 0x0d}, {0x0e, 0x12, 0x11, 0x10, 0x13, 0x18, 0x28, 0x1a}, @@ -508,7 +508,7 @@ static __u8 cxjpeg_640[][8] = { {0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00}, {0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /* 27 */ }; -static __u8 cxjpeg_352[][8] = { +static const __u8 cxjpeg_352[][8] = { {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0d}, {0x09, 0x09, 0x0b, 0x09, 0x08, 0x0D, 0x0b, 0x0a}, {0x0b, 0x0e, 0x0d, 0x0d, 0x0f, 0x13, 0x1f, 0x14}, @@ -537,7 +537,7 @@ static __u8 cxjpeg_352[][8] = { {0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00}, {0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; -static __u8 cxjpeg_320[][8] = { +static const __u8 cxjpeg_320[][8] = { {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x05}, {0x03, 0x04, 0x04, 0x04, 0x03, 0x05, 0x04, 0x04}, {0x04, 0x05, 0x05, 0x05, 0x06, 0x07, 0x0c, 0x08}, @@ -566,7 +566,7 @@ static __u8 cxjpeg_320[][8] = { {0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00}, {0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /* 27 */ }; -static __u8 cxjpeg_176[][8] = { +static const __u8 cxjpeg_176[][8] = { {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0d}, {0x09, 0x09, 0x0B, 0x09, 0x08, 0x0D, 0x0B, 0x0A}, {0x0B, 0x0E, 0x0D, 0x0D, 0x0F, 0x13, 0x1F, 0x14}, @@ -595,7 +595,8 @@ static __u8 cxjpeg_176[][8] = { {0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00}, {0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; -static __u8 cxjpeg_qtable[][8] = { /* 640 take with the zcx30x part */ +/* 640 take with the zcx30x part */ +static const __u8 cxjpeg_qtable[][8] = { {0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x08}, {0x06, 0x06, 0x07, 0x06, 0x05, 0x08, 0x07, 0x07}, {0x07, 0x09, 0x09, 0x08, 0x0a, 0x0c, 0x14, 0x0a}, @@ -641,22 +642,23 @@ static void cx11646_jpegInit(struct gspca_dev*gspca_dev) reg_w(gspca_dev->dev, 0x0055, &val, 1); } -static __u8 reg12[] = { 0x0a, 0x05, 0x07, 0x04, 0x19 }; -static __u8 regE5_8[] = { 0x88, 0x00, 0xd4, 0x01, 0x88, 0x01, 0x01, 0x01 }; -static __u8 regE5a[] = { 0x88, 0x0a, 0x0c, 0x01 }; -static __u8 regE5b[] = { 0x88, 0x0b, 0x12, 0x01 }; -static __u8 regE5c[] = { 0x88, 0x05, 0x01, 0x01 }; -static __u8 reg51[] = { 0x77, 0x03 }; -static __u8 reg70 = 0x03; +static const __u8 reg12[] = { 0x0a, 0x05, 0x07, 0x04, 0x19 }; +static const __u8 regE5_8[] = + { 0x88, 0x00, 0xd4, 0x01, 0x88, 0x01, 0x01, 0x01 }; +static const __u8 regE5a[] = { 0x88, 0x0a, 0x0c, 0x01 }; +static const __u8 regE5b[] = { 0x88, 0x0b, 0x12, 0x01 }; +static const __u8 regE5c[] = { 0x88, 0x05, 0x01, 0x01 }; +static const __u8 reg51[] = { 0x77, 0x03 }; +static const __u8 reg70 = 0x03; static void cx11646_jpeg(struct gspca_dev*gspca_dev) { __u8 val; int i; - int length = 8; - __u8 Reg55 = 0x14; - __u8 bufread[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - int retry = 50; + int length; + __u8 Reg55; + __u8 bufread[8]; + int retry; val = 0x01; reg_w(gspca_dev->dev, 0x00c0, &val, 1); @@ -665,6 +667,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) val = 0x00; reg_w(gspca_dev->dev, 0x00c0, &val, 1); reg_r(gspca_dev->dev, 0x0001, &val, 1); + length = 8; switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { case 0: for (i = 0; i < 27; i++) { @@ -719,6 +722,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) val = 0x00; reg_w(gspca_dev->dev, 0x0000, &val, 1); /* wait for completion */ + retry = 50; while (retry--) { reg_r(gspca_dev->dev, 0x0002, &val, 1); /* 0x07 until 0x00 */ @@ -796,8 +800,8 @@ static void cx11646_init1(struct gspca_dev *gspca_dev) reg_w(gspca_dev->dev, 0x003f, &val, 1); val = 0x40; reg_w(gspca_dev->dev, 0x003d, &val, 1); -/* val= 0x60; */ -/* reg_w(gspca_dev->dev,0x00,0x00,0x003d,&val,1); */ +/* val= 0x60; */ +/* reg_w(gspca_dev->dev, 0x00, 0x00, 0x003d, &val, 1); */ reg_r(gspca_dev->dev, 0x0099, &val, 1); /* ->0x07 */ while (cx_sensor_init[i][0]) { @@ -827,7 +831,7 @@ static int sd_config(struct gspca_dev *gspca_dev, cam->cam_mode = vga_mode; cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; - sd->qindex = 0; /* set the quantization table */ + sd->qindex = 0; /* set the quantization */ sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; @@ -891,7 +895,7 @@ static void sd_close(struct gspca_dev *gspca_dev) static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { if (data[0] == 0xff && data[1] == 0xd8) { @@ -914,21 +918,22 @@ static void setbrightness(struct gspca_dev*gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; __u8 regE5cbx[] = { 0x88, 0x00, 0xd4, 0x01, 0x88, 0x01, 0x01, 0x01 }; - __u8 reg51c[] = { 0x77, 0x03 }; + __u8 reg51c[2]; __u8 bright; __u8 colors; __u8 val; __u8 bufread[8]; bright = sd->brightness; - colors = sd->colors; regE5cbx[2] = bright; - reg51c[1] = colors; reg_w(gspca_dev->dev, 0x00e5, regE5cbx, 8); reg_r(gspca_dev->dev, 0x00e8, bufread, 8); reg_w(gspca_dev->dev, 0x00e5, regE5c, 4); reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */ + colors = sd->colors; + reg51c[0] = 0x77; + reg51c[1] = colors; reg_w(gspca_dev->dev, 0x0051, reg51c, 2); reg_w(gspca_dev->dev, 0x0010, reg10, 2); reg_w(gspca_dev->dev, 0x0070, ®70, 1); @@ -938,14 +943,15 @@ static void setcontrast(struct gspca_dev*gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; __u8 regE5acx[] = { 0x88, 0x0a, 0x0c, 0x01 }; /* seem MSB */ - /* __u8 regE5bcx[]={0x88,0x0b,0x12,0x01}; // LSB */ - __u8 reg51c[] = { 0x77, 0x03 }; +/* __u8 regE5bcx[] = { 0x88, 0x0b, 0x12, 0x01}; * LSB */ + __u8 reg51c[2]; __u8 val; - reg51c[1] = sd->colors; regE5acx[2] = sd->contrast; reg_w(gspca_dev->dev, 0x00e5, regE5acx, 4); reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */ + reg51c[0] = 0x77; + reg51c[1] = sd->colors; reg_w(gspca_dev->dev, 0x0051, reg51c, 2); reg_w(gspca_dev->dev, 0x0010, reg10, 2); reg_w(gspca_dev->dev, 0x0070, ®70, 1); diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c index ed7a8f9c0d7a..bbbe65923cfc 100644 --- a/drivers/media/video/gspca/etoms.c +++ b/drivers/media/video/gspca/etoms.c @@ -22,8 +22,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3) -static const char version[] = "2.1.3"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("Etoms USB Camera Driver"); @@ -56,7 +56,6 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); static struct ctrl sd_ctrls[] = { -#define SD_BRIGHTNESS 0 { { .id = V4L2_CID_BRIGHTNESS, @@ -65,12 +64,12 @@ static struct ctrl sd_ctrls[] = { .minimum = 1, .maximum = 127, .step = 1, - .default_value = 63, +#define BRIGHTNESS_DEF 63 + .default_value = BRIGHTNESS_DEF, }, .set = sd_setbrightness, .get = sd_getbrightness, }, -#define SD_CONTRAST 1 { { .id = V4L2_CID_CONTRAST, @@ -79,12 +78,12 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 255, .step = 1, - .default_value = 127, +#define CONTRAST_DEF 127 + .default_value = CONTRAST_DEF, }, .set = sd_setcontrast, .get = sd_getcontrast, }, -#define SD_COLOR 2 { { .id = V4L2_CID_SATURATION, @@ -93,12 +92,12 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 15, .step = 1, - .default_value = 7, +#define COLOR_DEF 7 + .default_value = COLOR_DEF, }, .set = sd_setcolors, .get = sd_getcolors, }, -#define SD_AUTOGAIN 3 { { .id = V4L2_CID_AUTOGAIN, @@ -107,7 +106,8 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 1, .step = 1, - .default_value = 1, +#define AUTOGAIN_DEF 1 + .default_value = AUTOGAIN_DEF, }, .set = sd_setautogain, .get = sd_getautogain, @@ -205,13 +205,13 @@ static struct cam_mode sif_mode[] = { #define PAS106_REG0e 0x0e /* global gain [4..0](default 0x0e) */ #define PAS106_REG13 0x13 /* end i2c write */ -static __u8 GainRGBG[] = { 0x80, 0x80, 0x80, 0x80, 0x00, 0x00 }; +static const __u8 GainRGBG[] = { 0x80, 0x80, 0x80, 0x80, 0x00, 0x00 }; -static __u8 I2c2[] = { 0x08, 0x08, 0x08, 0x08, 0x0d }; +static const __u8 I2c2[] = { 0x08, 0x08, 0x08, 0x08, 0x0d }; -static __u8 I2c3[] = { 0x12, 0x05 }; +static const __u8 I2c3[] = { 0x12, 0x05 }; -static __u8 I2c4[] = { 0x41, 0x08 }; +static const __u8 I2c4[] = { 0x41, 0x08 }; static void reg_r(struct usb_device *dev, __u16 index, __u8 *buffer, int len) @@ -223,8 +223,21 @@ static void reg_r(struct usb_device *dev, 0, index, buffer, len, 500); } +static void reg_w_val(struct usb_device *dev, + __u16 index, __u8 val) +{ + __u8 data; + + data = val; + usb_control_msg(dev, + usb_sndctrlpipe(dev, 0), + 0, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + 0, index, &data, 1, 500); +} + static void reg_w(struct usb_device *dev, - __u16 index, __u8 *buffer, __u16 len) + __u16 index, const __u8 *buffer, __u16 len) { __u8 tmpbuf[8]; @@ -236,48 +249,42 @@ static void reg_w(struct usb_device *dev, 0, index, tmpbuf, len, 500); } -static int Et_i2cwrite(struct usb_device *dev, __u8 reg, __u8 *buffer, - __u16 length, __u8 mode) +static int Et_i2cwrite(struct usb_device *dev, __u8 reg, + const __u8 *buffer, + __u16 len, __u8 mode) { -/* buffer should be [D0..D7] */ - int i, j; - __u8 base = 0x40; /* sensor base for the pas106 */ - __u8 ptchcount = 0; - - ptchcount = (((length & 0x07) << 4) | (mode & 0x03)); -/* set the base address */ - reg_w(dev, ET_I2C_BASE, &base, 1); -/* set count and prefetch */ - reg_w(dev, ET_I2C_COUNT, &ptchcount, 1); -/* set the register base */ - reg_w(dev, ET_I2C_REG, ®, 1); - j = length - 1; - for (i = 0; i < length; i++) { - reg_w(dev, (ET_I2C_DATA0 + j), &buffer[j], 1); - j--; - } + /* buffer should be [D0..D7] */ + __u8 ptchcount; + + /* set the base address */ + reg_w_val(dev, ET_I2C_BASE, 0x40); /* sensor base for the pas106 */ + /* set count and prefetch */ + ptchcount = ((len & 0x07) << 4) | (mode & 0x03); + reg_w_val(dev, ET_I2C_COUNT, ptchcount); + /* set the register base */ + reg_w_val(dev, ET_I2C_REG, reg); + while (--len >= 0) + reg_w_val(dev, ET_I2C_DATA0 + len, buffer[len]); return 0; } -static int Et_i2cread(struct usb_device *dev, __u8 reg, __u8 *buffer, - __u16 length, __u8 mode) +static int Et_i2cread(struct usb_device *dev, __u8 reg, + __u8 *buffer, + __u16 length, __u8 mode) { -/* buffer should be [D0..D7] */ + /* buffer should be [D0..D7] */ int i, j; - __u8 base = 0x40; /* sensor base for the pas106 */ __u8 ptchcount; - __u8 prefetch = 0x02; - - ptchcount = (((length & 0x07) << 4) | (mode & 0x03)); -/* set the base address */ - reg_w(dev, ET_I2C_BASE, &base, 1); -/* set count and prefetch */ - reg_w(dev, ET_I2C_COUNT, &ptchcount, 1); -/* set the register base */ - reg_w(dev, ET_I2C_REG, ®, 1); - reg_w(dev, ET_I2C_PREFETCH, &prefetch, 1); - prefetch = 0x00; - reg_w(dev, ET_I2C_PREFETCH, &prefetch, 1); + + /* set the base address */ + reg_w_val(dev, ET_I2C_BASE, 0x40); /* sensor base for the pas106 */ + /* set count and prefetch */ + ptchcount = ((length & 0x07) << 4) | (mode & 0x03); + reg_w_val(dev, ET_I2C_COUNT, ptchcount); + /* set the register base */ + reg_w_val(dev, ET_I2C_REG, reg); + reg_w_val(dev, ET_I2C_PREFETCH, 0x02); /* prefetch */ + reg_w_val(dev, ET_I2C_PREFETCH, 0); j = length - 1; for (i = 0; i < length; i++) { reg_r(dev, (ET_I2C_DATA0 + j), &buffer[j], 1); @@ -299,222 +306,139 @@ static int Et_WaitStatus(struct usb_device *dev) return 0; } -static int Et_videoOff(struct usb_device *dev) +static int et_video(struct usb_device *dev, int on) { int err; - __u8 stopvideo = 0; - reg_w(dev, ET_GPIO_OUT, &stopvideo, 1); + reg_w_val(dev, ET_GPIO_OUT, on + ? 0x10 /* startvideo - set Bit5 */ + : 0); /* stopvideo */ err = Et_WaitStatus(dev); if (!err) - PDEBUG(D_ERR, "timeout Et_waitStatus VideoON"); - return err; -} - -static int Et_videoOn(struct usb_device *dev) -{ - int err; - __u8 startvideo = 0x10; /* set Bit5 */ - - reg_w(dev, ET_GPIO_OUT, &startvideo, 1); - err = Et_WaitStatus(dev); - if (!err) - PDEBUG(D_ERR, "timeout Et_waitStatus VideoOFF"); + PDEBUG(D_ERR, "timeout video on/off"); return err; } static void Et_init2(struct gspca_dev *gspca_dev) { struct usb_device *dev = gspca_dev->dev; - __u8 value = 0x00; - __u8 received = 0x00; - __u8 FormLine[] = { 0x84, 0x03, 0x14, 0xf4, 0x01, 0x05 }; + __u8 value; + __u8 received; + static const __u8 FormLine[] = { 0x84, 0x03, 0x14, 0xf4, 0x01, 0x05 }; PDEBUG(D_STREAM, "Open Init2 ET"); - value = 0x2f; - reg_w(dev, ET_GPIO_DIR_CTRL, &value, 1); - value = 0x10; - reg_w(dev, ET_GPIO_OUT, &value, 1); + reg_w_val(dev, ET_GPIO_DIR_CTRL, 0x2f); + reg_w_val(dev, ET_GPIO_OUT, 0x10); reg_r(dev, ET_GPIO_IN, &received, 1); - value = 0x14; /* 0x14 // 0x16 enabled pattern */ - reg_w(dev, ET_ClCK, &value, 1); - value = 0x1b; - reg_w(dev, ET_CTRL, &value, 1); + reg_w_val(dev, ET_ClCK, 0x14); /* 0x14 // 0x16 enabled pattern */ + reg_w_val(dev, ET_CTRL, 0x1b); /* compression et subsampling */ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) value = ET_COMP_VAL1; /* 320 */ else value = ET_COMP_VAL0; /* 640 */ - reg_w(dev, ET_COMP, &value, 1); - value = 0x1f; - reg_w(dev, ET_MAXQt, &value, 1); - value = 0x04; - reg_w(dev, ET_MINQt, &value, 1); + reg_w_val(dev, ET_COMP, value); + reg_w_val(dev, ET_MAXQt, 0x1f); + reg_w_val(dev, ET_MINQt, 0x04); /* undocumented registers */ - value = 0xff; - reg_w(dev, ET_REG1d, &value, 1); - value = 0xff; - reg_w(dev, ET_REG1e, &value, 1); - value = 0xff; - reg_w(dev, ET_REG1f, &value, 1); - value = 0x35; - reg_w(dev, ET_REG20, &value, 1); - value = 0x01; - reg_w(dev, ET_REG21, &value, 1); - value = 0x00; - reg_w(dev, ET_REG22, &value, 1); - value = 0xff; - reg_w(dev, ET_REG23, &value, 1); - value = 0xff; - reg_w(dev, ET_REG24, &value, 1); - value = 0x0f; - reg_w(dev, ET_REG25, &value, 1); + reg_w_val(dev, ET_REG1d, 0xff); + reg_w_val(dev, ET_REG1e, 0xff); + reg_w_val(dev, ET_REG1f, 0xff); + reg_w_val(dev, ET_REG20, 0x35); + reg_w_val(dev, ET_REG21, 0x01); + reg_w_val(dev, ET_REG22, 0x00); + reg_w_val(dev, ET_REG23, 0xff); + reg_w_val(dev, ET_REG24, 0xff); + reg_w_val(dev, ET_REG25, 0x0f); /* colors setting */ - value = 0x11; - reg_w(dev, 0x30, &value, 1); /* 0x30 */ - value = 0x40; - reg_w(dev, 0x31, &value, 1); - value = 0x00; - reg_w(dev, 0x32, &value, 1); - value = 0x00; - reg_w(dev, ET_O_RED, &value, 1); /* 0x34 */ - value = 0x00; - reg_w(dev, ET_O_GREEN1, &value, 1); - value = 0x00; - reg_w(dev, ET_O_BLUE, &value, 1); - value = 0x00; - reg_w(dev, ET_O_GREEN2, &value, 1); + reg_w_val(dev, 0x30, 0x11); /* 0x30 */ + reg_w_val(dev, 0x31, 0x40); + reg_w_val(dev, 0x32, 0x00); + reg_w_val(dev, ET_O_RED, 0x00); /* 0x34 */ + reg_w_val(dev, ET_O_GREEN1, 0x00); + reg_w_val(dev, ET_O_BLUE, 0x00); + reg_w_val(dev, ET_O_GREEN2, 0x00); /*************/ - value = 0x80; - reg_w(dev, ET_G_RED, &value, 1); /* 0x4d */ - value = 0x80; - reg_w(dev, ET_G_GREEN1, &value, 1); - value = 0x80; - reg_w(dev, ET_G_BLUE, &value, 1); - value = 0x80; - reg_w(dev, ET_G_GREEN2, &value, 1); - value = 0x00; - reg_w(dev, ET_G_GR_H, &value, 1); - value = 0x00; - reg_w(dev, ET_G_GB_H, &value, 1); /* 0x52 */ + reg_w_val(dev, ET_G_RED, 0x80); /* 0x4d */ + reg_w_val(dev, ET_G_GREEN1, 0x80); + reg_w_val(dev, ET_G_BLUE, 0x80); + reg_w_val(dev, ET_G_GREEN2, 0x80); + reg_w_val(dev, ET_G_GR_H, 0x00); + reg_w_val(dev, ET_G_GB_H, 0x00); /* 0x52 */ /* Window control registers */ - - value = 0x80; /* use cmc_out */ - reg_w(dev, 0x61, &value, 1); - - value = 0x02; - reg_w(dev, 0x62, &value, 1); - value = 0x03; - reg_w(dev, 0x63, &value, 1); - value = 0x14; - reg_w(dev, 0x64, &value, 1); - value = 0x0e; - reg_w(dev, 0x65, &value, 1); - value = 0x02; - reg_w(dev, 0x66, &value, 1); - value = 0x02; - reg_w(dev, 0x67, &value, 1); + reg_w_val(dev, 0x61, 0x80); /* use cmc_out */ + reg_w_val(dev, 0x62, 0x02); + reg_w_val(dev, 0x63, 0x03); + reg_w_val(dev, 0x64, 0x14); + reg_w_val(dev, 0x65, 0x0e); + reg_w_val(dev, 0x66, 0x02); + reg_w_val(dev, 0x67, 0x02); /**************************************/ - value = 0x8f; - reg_w(dev, ET_SYNCHRO, &value, 1); /* 0x68 */ - value = 0x69; /* 0x6a //0x69 */ - reg_w(dev, ET_STARTX, &value, 1); - value = 0x0d; /* 0x0d //0x0c */ - reg_w(dev, ET_STARTY, &value, 1); - value = 0x80; - reg_w(dev, ET_WIDTH_LOW, &value, 1); - value = 0xe0; - reg_w(dev, ET_HEIGTH_LOW, &value, 1); - value = 0x60; - reg_w(dev, ET_W_H_HEIGTH, &value, 1); /* 6d */ - value = 0x86; - reg_w(dev, ET_REG6e, &value, 1); - value = 0x01; - reg_w(dev, ET_REG6f, &value, 1); - value = 0x26; - reg_w(dev, ET_REG70, &value, 1); - value = 0x7a; - reg_w(dev, ET_REG71, &value, 1); - value = 0x01; - reg_w(dev, ET_REG72, &value, 1); + reg_w_val(dev, ET_SYNCHRO, 0x8f); /* 0x68 */ + reg_w_val(dev, ET_STARTX, 0x69); /* 0x6a //0x69 */ + reg_w_val(dev, ET_STARTY, 0x0d); /* 0x0d //0x0c */ + reg_w_val(dev, ET_WIDTH_LOW, 0x80); + reg_w_val(dev, ET_HEIGTH_LOW, 0xe0); + reg_w_val(dev, ET_W_H_HEIGTH, 0x60); /* 6d */ + reg_w_val(dev, ET_REG6e, 0x86); + reg_w_val(dev, ET_REG6f, 0x01); + reg_w_val(dev, ET_REG70, 0x26); + reg_w_val(dev, ET_REG71, 0x7a); + reg_w_val(dev, ET_REG72, 0x01); /* Clock Pattern registers ***************** */ - value = 0x00; - reg_w(dev, ET_REG73, &value, 1); - value = 0x18; /* 0x28 */ - reg_w(dev, ET_REG74, &value, 1); - value = 0x0f; /* 0x01 */ - reg_w(dev, ET_REG75, &value, 1); + reg_w_val(dev, ET_REG73, 0x00); + reg_w_val(dev, ET_REG74, 0x18); /* 0x28 */ + reg_w_val(dev, ET_REG75, 0x0f); /* 0x01 */ /**********************************************/ - value = 0x20; - reg_w(dev, 0x8a, &value, 1); - value = 0x0f; - reg_w(dev, 0x8d, &value, 1); - value = 0x08; - reg_w(dev, 0x8e, &value, 1); + reg_w_val(dev, 0x8a, 0x20); + reg_w_val(dev, 0x8d, 0x0f); + reg_w_val(dev, 0x8e, 0x08); /**************************************/ - value = 0x08; - reg_w(dev, 0x03, &value, 1); - value = 0x03; - reg_w(dev, ET_PXL_CLK, &value, 1); - value = 0xff; - reg_w(dev, 0x81, &value, 1); - value = 0x00; - reg_w(dev, 0x80, &value, 1); - value = 0xff; - reg_w(dev, 0x81, &value, 1); - value = 0x20; - reg_w(dev, 0x80, &value, 1); - value = 0x01; - reg_w(dev, 0x03, &value, 1); - value = 0x00; - reg_w(dev, 0x03, &value, 1); - value = 0x08; - reg_w(dev, 0x03, &value, 1); + reg_w_val(dev, 0x03, 0x08); + reg_w_val(dev, ET_PXL_CLK, 0x03); + reg_w_val(dev, 0x81, 0xff); + reg_w_val(dev, 0x80, 0x00); + reg_w_val(dev, 0x81, 0xff); + reg_w_val(dev, 0x80, 0x20); + reg_w_val(dev, 0x03, 0x01); + reg_w_val(dev, 0x03, 0x00); + reg_w_val(dev, 0x03, 0x08); /********************************************/ - /* reg_r(dev,0x0,ET_I2C_BASE,&received,1); +/* reg_r(dev, ET_I2C_BASE, &received, 1); always 0x40 as the pas106 ??? */ /* set the sensor */ - if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { - value = 0x04; /* 320 */ - reg_w(dev, ET_PXL_CLK, &value, 1); - /* now set by fifo the FormatLine setting */ - reg_w(dev, 0x62, FormLine, 6); - } else { /* 640 */ - /* setting PixelClock - 0x03 mean 24/(3+1) = 6 Mhz - 0x05 -> 24/(5+1) = 4 Mhz - 0x0b -> 24/(11+1) = 2 Mhz - 0x17 -> 24/(23+1) = 1 Mhz - */ - value = 0x1e; /* 0x17 */ - reg_w(dev, ET_PXL_CLK, &value, 1); - /* now set by fifo the FormatLine setting */ - reg_w(dev, 0x62, FormLine, 6); - } + if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) + value = 0x04; /* 320 */ + else /* 640 */ + value = 0x1e; /* 0x17 * setting PixelClock + * 0x03 mean 24/(3+1) = 6 Mhz + * 0x05 -> 24/(5+1) = 4 Mhz + * 0x0b -> 24/(11+1) = 2 Mhz + * 0x17 -> 24/(23+1) = 1 Mhz + */ + reg_w_val(dev, ET_PXL_CLK, value); + /* now set by fifo the FormatLine setting */ + reg_w(dev, 0x62, FormLine, 6); /* set exposure times [ 0..0x78] 0->longvalue 0x78->shortvalue */ - value = 0x47; /* 0x47; */ - reg_w(dev, 0x81, &value, 1); - value = 0x40; /* 0x40; */ - reg_w(dev, 0x80, &value, 1); + reg_w_val(dev, 0x81, 0x47); /* 0x47; */ + reg_w_val(dev, 0x80, 0x40); /* 0x40; */ /* Pedro change */ /* Brightness change Brith+ decrease value */ /* Brigth- increase value */ /* original value = 0x70; */ - value = 0x30; /* 0x20; */ - reg_w(dev, 0x81, &value, 1); /* set brightness */ - value = 0x20; /* 0x20; */ - reg_w(dev, 0x80, &value, 1); + reg_w_val(dev, 0x81, 0x30); /* 0x20; - set brightness */ + reg_w_val(dev, 0x80, 0x20); /* 0x20; */ } static void setcolors(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; - static __u8 I2cc[] = { 0x05, 0x02, 0x02, 0x05, 0x0d }; + __u8 I2cc[] = { 0x05, 0x02, 0x02, 0x05, 0x0d }; __u8 i2cflags = 0x01; /* __u8 green = 0; */ __u8 colors = sd->colors; @@ -525,7 +449,7 @@ static void setcolors(struct gspca_dev *gspca_dev) /* I2cc[1] = I2cc[2] = green; */ if (sd->sensor == SENSOR_PAS106) { Et_i2cwrite(dev, PAS106_REG13, &i2cflags, 1, 3); - Et_i2cwrite(dev, PAS106_REG9, I2cc, sizeof(I2cc), 1); + Et_i2cwrite(dev, PAS106_REG9, I2cc, sizeof I2cc, 1); } /* PDEBUG(D_CONF , "Etoms red %d blue %d green %d", I2cc[3], I2cc[0], green); */ @@ -534,11 +458,11 @@ static void setcolors(struct gspca_dev *gspca_dev) static void getcolors(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - /* __u8 valblue = 0; */ +/* __u8 valblue; */ __u8 valred; if (sd->sensor == SENSOR_PAS106) { - /* Et_i2cread(gspca_dev->dev,PAS106_REG9,&valblue,1,1); */ +/* Et_i2cread(gspca_dev->dev, PAS106_REG9, &valblue, 1, 1); */ Et_i2cread(gspca_dev->dev, PAS106_REG9 + 3, &valred, 1, 1); sd->colors = valred & 0x0f; } @@ -547,126 +471,87 @@ static void getcolors(struct gspca_dev *gspca_dev) static void Et_init1(struct gspca_dev *gspca_dev) { struct usb_device *dev = gspca_dev->dev; - __u8 value = 0x00; - __u8 received = 0x00; -/* __u8 I2c0 [] ={0x0a,0x12,0x05,0x22,0xac,0x00,0x01,0x00}; */ + __u8 value; + __u8 received; +/* __u8 I2c0 [] = {0x0a, 0x12, 0x05, 0x22, 0xac, 0x00, 0x01, 0x00}; */ __u8 I2c0[] = { 0x0a, 0x12, 0x05, 0x6d, 0xcd, 0x00, 0x01, 0x00 }; /* try 1/120 0x6d 0xcd 0x40 */ -/* __u8 I2c0 [] ={0x0a,0x12,0x05,0xfe,0xfe,0xc0,0x01,0x00}; +/* __u8 I2c0 [] = {0x0a, 0x12, 0x05, 0xfe, 0xfe, 0xc0, 0x01, 0x00}; * 1/60000 hmm ?? */ PDEBUG(D_STREAM, "Open Init1 ET"); - value = 7; - reg_w(dev, ET_GPIO_DIR_CTRL, &value, 1); + reg_w_val(dev, ET_GPIO_DIR_CTRL, 7); reg_r(dev, ET_GPIO_IN, &received, 1); - value = 1; - reg_w(dev, ET_RESET_ALL, &value, 1); - value = 0; - reg_w(dev, ET_RESET_ALL, &value, 1); - value = 0x10; - reg_w(dev, ET_ClCK, &value, 1); - value = 0x19; - reg_w(dev, ET_CTRL, &value, 1); + reg_w_val(dev, ET_RESET_ALL, 1); + reg_w_val(dev, ET_RESET_ALL, 0); + reg_w_val(dev, ET_ClCK, 0x10); + reg_w_val(dev, ET_CTRL, 0x19); /* compression et subsampling */ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) value = ET_COMP_VAL1; else value = ET_COMP_VAL0; - PDEBUG(D_STREAM, "Open mode %d Compression %d", gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode, value); - reg_w(dev, ET_COMP, &value, 1); - value = 0x1d; - reg_w(dev, ET_MAXQt, &value, 1); - value = 0x02; - reg_w(dev, ET_MINQt, &value, 1); + reg_w_val(dev, ET_COMP, value); + reg_w_val(dev, ET_MAXQt, 0x1d); + reg_w_val(dev, ET_MINQt, 0x02); /* undocumented registers */ - value = 0xff; - reg_w(dev, ET_REG1d, &value, 1); - value = 0xff; - reg_w(dev, ET_REG1e, &value, 1); - value = 0xff; - reg_w(dev, ET_REG1f, &value, 1); - value = 0x35; - reg_w(dev, ET_REG20, &value, 1); - value = 0x01; - reg_w(dev, ET_REG21, &value, 1); - value = 0x00; - reg_w(dev, ET_REG22, &value, 1); - value = 0xf7; - reg_w(dev, ET_REG23, &value, 1); - value = 0xff; - reg_w(dev, ET_REG24, &value, 1); - value = 0x07; - reg_w(dev, ET_REG25, &value, 1); + reg_w_val(dev, ET_REG1d, 0xff); + reg_w_val(dev, ET_REG1e, 0xff); + reg_w_val(dev, ET_REG1f, 0xff); + reg_w_val(dev, ET_REG20, 0x35); + reg_w_val(dev, ET_REG21, 0x01); + reg_w_val(dev, ET_REG22, 0x00); + reg_w_val(dev, ET_REG23, 0xf7); + reg_w_val(dev, ET_REG24, 0xff); + reg_w_val(dev, ET_REG25, 0x07); /* colors setting */ - value = 0x80; - reg_w(dev, ET_G_RED, &value, 1); - value = 0x80; - reg_w(dev, ET_G_GREEN1, &value, 1); - value = 0x80; - reg_w(dev, ET_G_BLUE, &value, 1); - value = 0x80; - reg_w(dev, ET_G_GREEN2, &value, 1); - value = 0x00; - reg_w(dev, ET_G_GR_H, &value, 1); - value = 0x00; - reg_w(dev, ET_G_GB_H, &value, 1); + reg_w_val(dev, ET_G_RED, 0x80); + reg_w_val(dev, ET_G_GREEN1, 0x80); + reg_w_val(dev, ET_G_BLUE, 0x80); + reg_w_val(dev, ET_G_GREEN2, 0x80); + reg_w_val(dev, ET_G_GR_H, 0x00); + reg_w_val(dev, ET_G_GB_H, 0x00); /* Window control registers */ - value = 0xf0; - reg_w(dev, ET_SYNCHRO, &value, 1); - value = 0x56; /* 0x56 */ - reg_w(dev, ET_STARTX, &value, 1); - value = 0x05; /* 0x04 */ - reg_w(dev, ET_STARTY, &value, 1); - value = 0x60; - reg_w(dev, ET_WIDTH_LOW, &value, 1); - value = 0x20; - reg_w(dev, ET_HEIGTH_LOW, &value, 1); - value = 0x50; - reg_w(dev, ET_W_H_HEIGTH, &value, 1); - value = 0x86; - reg_w(dev, ET_REG6e, &value, 1); - value = 0x01; - reg_w(dev, ET_REG6f, &value, 1); - value = 0x86; - reg_w(dev, ET_REG70, &value, 1); - value = 0x14; - reg_w(dev, ET_REG71, &value, 1); - value = 0x00; - reg_w(dev, ET_REG72, &value, 1); + reg_w_val(dev, ET_SYNCHRO, 0xf0); + reg_w_val(dev, ET_STARTX, 0x56); /* 0x56 */ + reg_w_val(dev, ET_STARTY, 0x05); /* 0x04 */ + reg_w_val(dev, ET_WIDTH_LOW, 0x60); + reg_w_val(dev, ET_HEIGTH_LOW, 0x20); + reg_w_val(dev, ET_W_H_HEIGTH, 0x50); + reg_w_val(dev, ET_REG6e, 0x86); + reg_w_val(dev, ET_REG6f, 0x01); + reg_w_val(dev, ET_REG70, 0x86); + reg_w_val(dev, ET_REG71, 0x14); + reg_w_val(dev, ET_REG72, 0x00); /* Clock Pattern registers */ - value = 0x00; - reg_w(dev, ET_REG73, &value, 1); - value = 0x00; - reg_w(dev, ET_REG74, &value, 1); - value = 0x0a; - reg_w(dev, ET_REG75, &value, 1); - value = 0x04; - reg_w(dev, ET_I2C_CLK, &value, 1); - value = 0x01; - reg_w(dev, ET_PXL_CLK, &value, 1); + reg_w_val(dev, ET_REG73, 0x00); + reg_w_val(dev, ET_REG74, 0x00); + reg_w_val(dev, ET_REG75, 0x0a); + reg_w_val(dev, ET_I2C_CLK, 0x04); + reg_w_val(dev, ET_PXL_CLK, 0x01); /* set the sensor */ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) { I2c0[0] = 0x06; - Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof(I2c0), 1); - Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof(I2c2), 1); + Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof I2c0, 1); + Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof I2c2, 1); value = 0x06; Et_i2cwrite(dev, PAS106_REG2, &value, 1, 1); - Et_i2cwrite(dev, PAS106_REG3, I2c3, sizeof(I2c3), 1); + Et_i2cwrite(dev, PAS106_REG3, I2c3, sizeof I2c3, 1); /* value = 0x1f; */ value = 0x04; Et_i2cwrite(dev, PAS106_REG0e, &value, 1, 1); } else { I2c0[0] = 0x0a; - Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof(I2c0), 1); - Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof(I2c2), 1); + Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof I2c0, 1); + Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof I2c2, 1); value = 0x0a; Et_i2cwrite(dev, PAS106_REG2, &value, 1, 1); - Et_i2cwrite(dev, PAS106_REG3, I2c3, sizeof(I2c3), 1); + Et_i2cwrite(dev, PAS106_REG3, I2c3, sizeof I2c3, 1); value = 0x04; /* value = 0x10; */ Et_i2cwrite(dev, PAS106_REG0e, &value, 1, 1); @@ -720,10 +605,10 @@ static int sd_config(struct gspca_dev *gspca_dev, cam->cam_mode = vga_mode; cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; } - sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; - sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; - sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; - sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; + sd->brightness = BRIGHTNESS_DEF; + sd->contrast = CONTRAST_DEF; + sd->colors = COLOR_DEF; + sd->autogain = AUTOGAIN_DEF; return 0; } @@ -732,18 +617,13 @@ static int sd_open(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; - int err; - __u8 value; - PDEBUG(D_STREAM, "Initialize ET1"); if (sd->sensor == SENSOR_PAS106) Et_init1(gspca_dev); else Et_init2(gspca_dev); - value = 0x08; - reg_w(dev, ET_RESET_ALL, &value, 1); - err = Et_videoOff(dev); - PDEBUG(D_STREAM, "Et_Init_VideoOff %d", err); + reg_w_val(dev, ET_RESET_ALL, 0x08); + et_video(dev, 0); /* video off */ return 0; } @@ -752,27 +632,19 @@ static void sd_start(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; - int err; - __u8 value; if (sd->sensor == SENSOR_PAS106) Et_init1(gspca_dev); else Et_init2(gspca_dev); - value = 0x08; - reg_w(dev, ET_RESET_ALL, &value, 1); - err = Et_videoOn(dev); - PDEBUG(D_STREAM, "Et_VideoOn %d", err); + reg_w_val(dev, ET_RESET_ALL, 0x08); + et_video(dev, 1); /* video on */ } static void sd_stopN(struct gspca_dev *gspca_dev) { - int err; - - err = Et_videoOff(gspca_dev->dev); - PDEBUG(D_STREAM, "Et_VideoOff %d", err); - + et_video(gspca_dev->dev, 0); /* video off */ } static void sd_stop0(struct gspca_dev *gspca_dev) @@ -790,7 +662,7 @@ static void setbrightness(struct gspca_dev *gspca_dev) __u8 brightness = sd->brightness; for (i = 0; i < 4; i++) - reg_w(gspca_dev->dev, (ET_O_RED + i), &brightness, 1); + reg_w_val(gspca_dev->dev, (ET_O_RED + i), brightness); } static void getbrightness(struct gspca_dev *gspca_dev) @@ -798,7 +670,7 @@ static void getbrightness(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; int i; int brightness = 0; - __u8 value = 0; + __u8 value; for (i = 0; i < 4; i++) { reg_r(gspca_dev->dev, (ET_O_RED + i), &value, 1); @@ -895,7 +767,7 @@ static void setautogain(struct gspca_dev *gspca_dev) static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { struct sd *sd; diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index b36913017d7b..ad4721b06920 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -247,7 +247,7 @@ static void isoc_transfer(struct gspca_dev *gspca_dev) struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, int packet_type, struct gspca_frame *frame, - __u8 *data, + const __u8 *data, int len) { int i, j; @@ -1053,7 +1053,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct gspca_dev *gspca_dev = priv; - struct ctrl *ctrls; + const struct ctrl *ctrls; int i, ret; for (i = 0, ctrls = gspca_dev->sd_desc->ctrls; @@ -1079,7 +1079,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, { struct gspca_dev *gspca_dev = priv; - struct ctrl *ctrls; + const struct ctrl *ctrls; int i, ret; for (i = 0, ctrls = gspca_dev->sd_desc->ctrls; diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h index 9c894daf356a..0d23e0a90c77 100644 --- a/drivers/media/video/gspca/gspca.h +++ b/drivers/media/video/gspca/gspca.h @@ -9,25 +9,6 @@ #include <media/v4l2-common.h> #include <linux/mutex.h> -/* values in 2.6.27 */ -#ifndef V4L2_PIX_FMT_SPCA501 -#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') -#endif -#ifndef V4L2_PIX_FMT_SPCA561 -#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') -#endif - -/* values in 2.6.26 */ -#ifndef V4L2_CID_POWER_LINE_FREQUENCY -#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) -#endif -#ifndef V4L2_CID_WHITE_BALANCE_TEMPERATURE -#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE + 26) -#endif -#ifndef V4L2_CID_SHARPNESS -#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) -#endif - #ifdef CONFIG_VIDEO_ADV_DEBUG /* GSPCA our debug messages */ extern int gspca_debug; @@ -76,7 +57,6 @@ struct cam_mode { short width; short height; short mode; /* subdriver value */ - short reserved; /* subdriver value */ }; struct cam { char *dev_name; @@ -110,9 +90,9 @@ struct ctrl { /* subdriver description */ struct sd_desc { /* information */ - char *name; /* sub-driver name */ + const char *name; /* sub-driver name */ /* controls */ - struct ctrl *ctrls; + const struct ctrl *ctrls; int nctrls; /* operations */ cam_cf_op config; /* called on probe */ @@ -195,6 +175,6 @@ void gspca_disconnect(struct usb_interface *intf); struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, int packet_type, struct gspca_frame *frame, - __u8 *data, + const __u8 *data, int len); #endif /* GSPCAV2_H */ diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c index 6556e0a330fa..c70ccc8fe68b 100644 --- a/drivers/media/video/gspca/mars.c +++ b/drivers/media/video/gspca/mars.c @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver"); @@ -140,7 +140,8 @@ static void sd_start(struct gspca_dev *gspca_dev) __u16 MI_buf[242]; int h_size, v_size; int intpipe; - /* struct usb_device *dev = pcam->dev; */ +/* struct usb_device *dev = pcam->dev; */ + memset(data, 0, sizeof data); memset(MI_buf, 0, sizeof MI_buf); @@ -351,7 +352,7 @@ static void sd_close(struct gspca_dev *gspca_dev) static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { struct sd *sd = (struct sd *) gspca_dev; @@ -389,7 +390,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -404,7 +405,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x093a, 0x050f), DVNM("Mars-Semi Pc-Camera")}, {} }; diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index 7d6237f18ba0..d92729ac41f0 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); MODULE_DESCRIPTION("OV519 USB Camera Driver"); @@ -266,15 +266,15 @@ static unsigned char ov7670_abs_to_sm(unsigned char v) static int reg_w(struct sd *sd, __u16 index, __u8 value) { int ret; - __u8 buf[4]; + __u8 data; - buf[0] = value; + data = value; ret = usb_control_msg(sd->gspca_dev.dev, usb_sndctrlpipe(sd->gspca_dev.dev, 0), 1, /* REQ_IO (ov518/519) */ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, index, - &buf[0], 1, 500); + &data, 1, 500); if (ret < 0) PDEBUG(D_ERR, "Write reg [%02x] %02x failed", index, value); return ret; @@ -285,16 +285,16 @@ static int reg_w(struct sd *sd, __u16 index, __u8 value) static int reg_r(struct sd *sd, __u16 index) { int ret; - __u8 buf[4]; + __u8 data; ret = usb_control_msg(sd->gspca_dev.dev, usb_rcvctrlpipe(sd->gspca_dev.dev, 0), 1, /* REQ_IO */ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0, index, &buf[0], 1, 500); + 0, index, &data, 1, 500); if (ret >= 0) - ret = buf[0]; + ret = data; else PDEBUG(D_ERR, "Read reg [0x%02x] failed", index); return ret; @@ -302,7 +302,7 @@ static int reg_r(struct sd *sd, __u16 index) /* Read 8 values from a OV519 register */ static int reg_r8(struct sd *sd, - __u16 index) + __u16 index) { int ret; __u8 buf[8]; @@ -528,7 +528,7 @@ struct ov_i2c_regvals { }; static int write_regvals(struct sd *sd, - struct ov_regvals *regvals, + const struct ov_regvals *regvals, int n) { int rc; @@ -543,7 +543,7 @@ static int write_regvals(struct sd *sd, } static int write_i2c_regvals(struct sd *sd, - struct ov_i2c_regvals *regvals, + const struct ov_i2c_regvals *regvals, int n) { int rc; @@ -569,7 +569,7 @@ static int write_i2c_regvals(struct sd *sd, static int ov8xx0_configure(struct sd *sd) { int rc; - static struct ov_i2c_regvals norm_8610[] = { + static const struct ov_i2c_regvals norm_8610[] = { { 0x12, 0x80 }, { 0x00, 0x00 }, { 0x01, 0x80 }, @@ -707,7 +707,7 @@ static int ov7xx0_configure(struct sd *sd) * 0x05 (old driver setting): very overexposed, too much * contrast */ - static struct ov_i2c_regvals norm_7610[] = { + static const struct ov_i2c_regvals norm_7610[] = { { 0x10, 0xff }, { 0x16, 0x06 }, { 0x28, 0x24 }, @@ -737,7 +737,7 @@ static int ov7xx0_configure(struct sd *sd) { 0x0d, 0x24 }, }; - static struct ov_i2c_regvals norm_7620[] = { + static const struct ov_i2c_regvals norm_7620[] = { { 0x00, 0x00 }, /* gain */ { 0x01, 0x80 }, /* blue gain */ { 0x02, 0x80 }, /* red gain */ @@ -804,14 +804,14 @@ static int ov7xx0_configure(struct sd *sd) }; /* 7640 and 7648. The defaults should be OK for most registers. */ - static struct ov_i2c_regvals norm_7640[] = { + static const struct ov_i2c_regvals norm_7640[] = { { 0x12, 0x80 }, { 0x12, 0x14 }, }; /* 7670. Defaults taken from OmniVision provided data, * as provided by Jonathan Corbet of OLPC */ - static struct ov_i2c_regvals norm_7670[] = { + static const struct ov_i2c_regvals norm_7670[] = { { OV7670_REG_COM7, OV7670_COM7_RESET }, { OV7670_REG_TSLB, 0x04 }, /* OV */ { OV7670_REG_COM7, OV7670_COM7_FMT_VGA }, /* VGA */ @@ -1075,7 +1075,7 @@ static int ov7xx0_configure(struct sd *sd) static int ov6xx0_configure(struct sd *sd) { int rc; - static struct ov_i2c_regvals norm_6x20[] = { + static const struct ov_i2c_regvals norm_6x20[] = { { 0x12, 0x80 }, /* reset */ { 0x11, 0x01 }, { 0x03, 0x60 }, @@ -1118,7 +1118,7 @@ static int ov6xx0_configure(struct sd *sd) /* Toggle 0x12[2] off and on here? */ }; - static struct ov_i2c_regvals norm_6x30[] = { + static const struct ov_i2c_regvals norm_6x30[] = { { 0x12, 0x80 }, /* Reset */ { 0x00, 0x1f }, /* Gain */ { 0x01, 0x99 }, /* Blue gain */ @@ -1284,7 +1284,7 @@ static int sd_config(struct gspca_dev *gspca_dev, struct cam *cam; /* (from ov519_configure) */ - static struct ov_regvals init_519[] = { + static const struct ov_regvals init_519[] = { { 0x5a, 0x6d }, /* EnableSystem */ /* jfm trace usbsnoop3-1.txt */ /* jfm 53 = fb */ @@ -1302,8 +1302,7 @@ static int sd_config(struct gspca_dev *gspca_dev, /* windows reads 0x55 at this point*/ }; - if (write_regvals(sd, init_519, - sizeof init_519 / sizeof init_519[0])) + if (write_regvals(sd, init_519, ARRAY_SIZE(init_519))) goto error; /* jfm: not seen in windows trace */ if (ov519_init_compression(sd)) @@ -1389,7 +1388,7 @@ static int sd_open(struct gspca_dev *gspca_dev) static int ov519_mode_init_regs(struct sd *sd, int width, int height) { - static struct ov_regvals mode_init_519_ov7670[] = { + static const struct ov_regvals mode_init_519_ov7670[] = { { 0x5d, 0x03 }, /* Turn off suspend mode */ { 0x53, 0x9f }, /* was 9b in 1.65-1.08 */ { 0x54, 0x0f }, /* bit2 (jpeg enable) */ @@ -1412,7 +1411,7 @@ static int ov519_mode_init_regs(struct sd *sd, /* windows reads 0x55 at this point, why? */ }; - static struct ov_regvals mode_init_519[] = { + static const struct ov_regvals mode_init_519[] = { { 0x5d, 0x03 }, /* Turn off suspend mode */ { 0x53, 0x9f }, /* was 9b in 1.65-1.08 */ { 0x54, 0x0f }, /* bit2 (jpeg enable) */ @@ -1448,12 +1447,11 @@ static int ov519_mode_init_regs(struct sd *sd, /******** Set the mode ********/ if (sd->sensor != SEN_OV7670) { if (write_regvals(sd, mode_init_519, - sizeof mode_init_519 / sizeof mode_init_519[0])) + ARRAY_SIZE(mode_init_519))) return -EIO; } else { if (write_regvals(sd, mode_init_519_ov7670, - sizeof mode_init_519_ov7670 - / sizeof mode_init_519_ov7670[0])) + ARRAY_SIZE(mode_init_519_ov7670))) return -EIO; } @@ -1883,7 +1881,7 @@ static void sd_close(struct gspca_dev *gspca_dev) static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { /* Header of ov519 is 16 bytes: @@ -1982,7 +1980,7 @@ static void setcontrast(struct gspca_dev *gspca_dev) case SEN_OV6630: i2c_w_mask(sd, OV7610_REG_CNT, val >> 4, 0x0f); case SEN_OV8610: { - static __u8 ctab[] = { + static const __u8 ctab[] = { 0x03, 0x09, 0x0b, 0x0f, 0x53, 0x6f, 0x35, 0x7f }; @@ -1991,7 +1989,7 @@ static void setcontrast(struct gspca_dev *gspca_dev) break; } case SEN_OV7620: { - static __u8 ctab[] = { + static const __u8 ctab[] = { 0x01, 0x05, 0x09, 0x11, 0x15, 0x35, 0x37, 0x57, 0x5b, 0xa5, 0xa7, 0xc7, 0xc9, 0xcf, 0xef, 0xff }; @@ -2104,7 +2102,7 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val) } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -2119,7 +2117,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x041e, 0x4052), DVNM("Creative Live! VISTA IM")}, {USB_DEVICE(0x041e, 0x405f), DVNM("Creative Live! VISTA VF0330")}, {USB_DEVICE(0x041e, 0x4060), DVNM("Creative Live! VISTA VF0350")}, diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c index 84986684c4db..7e067456e62b 100644 --- a/drivers/media/video/gspca/pac207.c +++ b/drivers/media/video/gspca/pac207.c @@ -27,8 +27,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); MODULE_DESCRIPTION("Pixart PAC207"); @@ -716,7 +716,7 @@ static int pac207_decode_frame_data(struct gspca_dev *gspca_dev, static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, - unsigned char *data, + __u8 *data, int len) { unsigned char *sof; @@ -754,8 +754,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, n = pac207_decode_frame_data(gspca_dev, frame, data, len); if (n) - frame = gspca_frame_add(gspca_dev, LAST_PACKET, - frame, NULL, 0); + gspca_frame_add(gspca_dev, LAST_PACKET, + frame, NULL, 0); } static void setbrightness(struct gspca_dev *gspca_dev) @@ -879,7 +879,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -895,7 +895,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x041e, 0x4028), DVNM("Creative Webcam Vista Plus")}, {USB_DEVICE(0x093a, 0x2460), DVNM("Q-Tec Webcam 100")}, {USB_DEVICE(0x093a, 0x2463), DVNM("Philips spc200nc pac207")}, diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c index 14cc49a4c2cc..c2d4b6a4dcf4 100644 --- a/drivers/media/video/gspca/pac7311.c +++ b/drivers/media/video/gspca/pac7311.c @@ -23,8 +23,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3) -static const char version[] = "2.1.3"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); MODULE_DESCRIPTION("Pixart PAC7311"); @@ -37,7 +37,6 @@ struct sd { int avg_lum; unsigned char brightness; -#define BRIGHTNESS_MAX 0x20 unsigned char contrast; unsigned char colors; unsigned char autogain; @@ -58,21 +57,21 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); static struct ctrl sd_ctrls[] = { -#define SD_BRIGHTNESS 0 { { .id = V4L2_CID_BRIGHTNESS, .type = V4L2_CTRL_TYPE_INTEGER, .name = "Brightness", .minimum = 0, +#define BRIGHTNESS_MAX 0x20 .maximum = BRIGHTNESS_MAX, .step = 1, - .default_value = 0x10, +#define BRIGHTNESS_DEF 0x10 + .default_value = BRIGHTNESS_DEF, }, .set = sd_setbrightness, .get = sd_getbrightness, }, -#define SD_CONTRAST 1 { { .id = V4L2_CID_CONTRAST, @@ -81,12 +80,12 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 255, .step = 1, - .default_value = 127, +#define CONTRAST_DEF 127 + .default_value = CONTRAST_DEF, }, .set = sd_setcontrast, .get = sd_getcontrast, }, -#define SD_COLOR 2 { { .id = V4L2_CID_SATURATION, @@ -95,12 +94,12 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 255, .step = 1, - .default_value = 127, +#define COLOR_DEF 127 + .default_value = COLOR_DEF, }, .set = sd_setcolors, .get = sd_getcolors, }, -#define SD_AUTOGAIN 3 { { .id = V4L2_CID_AUTOGAIN, @@ -109,7 +108,8 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 1, .step = 1, - .default_value = 1, +#define AUTOGAIN_DEF 1 + .default_value = AUTOGAIN_DEF, }, .set = sd_setautogain, .get = sd_getautogain, @@ -124,7 +124,7 @@ static struct cam_mode vga_mode[] = { #define PAC7311_JPEG_HEADER_SIZE (sizeof pac7311_jpeg_header) /* (594) */ -const unsigned char pac7311_jpeg_header[] = { +static const __u8 pac7311_jpeg_header[] = { 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x03, 0x20, 0xff, 0xc0, 0x00, 0x11, 0x08, @@ -195,8 +195,8 @@ const unsigned char pac7311_jpeg_header[] = { }; static void reg_w(struct usb_device *dev, - __u16 index, - char *buffer, __u16 len) + __u16 index, + const char *buffer, __u16 len) { __u8 tmpbuf[8]; @@ -263,10 +263,10 @@ static int sd_config(struct gspca_dev *gspca_dev, cam->cam_mode = vga_mode; cam->nmodes = ARRAY_SIZE(vga_mode); - sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; - sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; - sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; - sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; + sd->brightness = BRIGHTNESS_DEF; + sd->contrast = CONTRAST_DEF; + sd->colors = COLOR_DEF; + sd->autogain = AUTOGAIN_DEF; return 0; } @@ -278,7 +278,7 @@ static void setbrightness(struct gspca_dev *gspca_dev) /*jfm: inverted?*/ brightness = BRIGHTNESS_MAX - sd->brightness; pac7311_reg_write(gspca_dev->dev, 0xff, 0x04); - /* pac7311_reg_write(gspca_dev->dev, 0x0e, 0x00); */ +/* pac7311_reg_write(gspca_dev->dev, 0x0e, 0x00); */ pac7311_reg_write(gspca_dev->dev, 0x0f, brightness); /* load registers to sensor (Bit 0, auto clear) */ pac7311_reg_write(gspca_dev->dev, 0x11, 0x01); @@ -502,7 +502,7 @@ static void setautogain(struct gspca_dev *gspca_dev, int luma) static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { struct sd *sd = (struct sd *) gspca_dev; diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 4f23b16c89a8..eb5e1bfd7911 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3) -static const char version[] = "2.1.3"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); @@ -74,7 +74,6 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); static struct ctrl sd_ctrls[] = { -#define SD_BRIGHTNESS 0 { { .id = V4L2_CID_BRIGHTNESS, @@ -83,12 +82,12 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 0xffff, .step = 1, - .default_value = 0x7fff, +#define BRIGHTNESS_DEF 0x7fff + .default_value = BRIGHTNESS_DEF, }, .set = sd_setbrightness, .get = sd_getbrightness, }, -#define SD_CONTRAST 1 { { .id = V4L2_CID_CONTRAST, @@ -97,12 +96,12 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 127, .step = 1, - .default_value = 63, +#define CONTRAST_DEF 63 + .default_value = CONTRAST_DEF, }, .set = sd_setcontrast, .get = sd_getcontrast, }, -#define SD_COLOR 2 { { .id = V4L2_CID_SATURATION, @@ -111,12 +110,12 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 255, .step = 1, - .default_value = 127, +#define COLOR_DEF 127 + .default_value = COLOR_DEF, }, .set = sd_setcolors, .get = sd_getcolors, }, -#define SD_AUTOGAIN 3 { { .id = V4L2_CID_AUTOGAIN, @@ -125,7 +124,8 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 1, .step = 1, - .default_value = 1, +#define AUTOGAIN_DEF 1 + .default_value = AUTOGAIN_DEF, }, .set = sd_setautogain, .get = sd_getautogain, @@ -139,7 +139,7 @@ static struct cam_mode vga_mode[] = { }; /*Data from sn9c102p+hv71331r */ -static __u8 sn_hv7131[] = { +static const __u8 sn_hv7131[] = { 0x00, 0x03, 0x64, 0x00, 0x1A, 0x20, 0x20, 0x20, 0xA1, 0x11, /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 */ 0x02, 0x09, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, /* 00 */ @@ -150,7 +150,7 @@ static __u8 sn_hv7131[] = { /* reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23 */ }; -static __u8 sn_mi0360[] = { +static const __u8 sn_mi0360[] = { 0x00, 0x61, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0xb1, 0x5d, /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 */ 0x07, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, @@ -161,7 +161,7 @@ static __u8 sn_mi0360[] = { /* reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23 */ }; -static __u8 sn_mo4000[] = { +static const __u8 sn_mo4000[] = { 0x12, 0x23, 0x60, 0x00, 0x1A, 0x00, 0x20, 0x18, 0x81, /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 */ 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, @@ -174,13 +174,13 @@ static __u8 sn_mo4000[] = { 0xd3, 0xdf, 0xea, 0xf5 }; -static __u8 sn_ov7648[] = { +static const __u8 sn_ov7648[] = { 0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20, 0xA1, 0x6E, 0x18, 0x65, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x06, 0x06, 0x28, 0x1E, 0x82, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static __u8 sn_ov7660[] = { +static const __u8 sn_ov7660[] = { /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 */ 0x00, 0x61, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x81, /* reg9 rega regb regc regd rege regf reg10 reg11*/ @@ -192,7 +192,7 @@ static __u8 sn_ov7660[] = { }; /* sequence specific to the sensors - !! index = SENSOR_xxx */ -static __u8 *sn_tb[] = { +static const __u8 *sn_tb[] = { sn_hv7131, sn_mi0360, sn_mo4000, @@ -200,28 +200,28 @@ static __u8 *sn_tb[] = { sn_ov7660 }; -static __u8 regsn20[] = { +static const __u8 regsn20[] = { 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99, 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff }; -static __u8 regsn20_sn9c325[] = { +static const __u8 regsn20_sn9c325[] = { 0x0a, 0x3a, 0x56, 0x6c, 0x7e, 0x8d, 0x9a, 0xa4, 0xaf, 0xbb, 0xc5, 0xcd, 0xd5, 0xde, 0xe8, 0xed, 0xf5 }; -static __u8 reg84[] = { +static const __u8 reg84[] = { 0x14, 0x00, 0x27, 0x00, 0x07, 0x00, 0xe5, 0x0f, 0xe4, 0x0f, 0x38, 0x00, 0x3e, 0x00, 0xc3, 0x0f, /* 0x00, 0x00, 0x00, 0x00, 0x00 */ 0xf7, 0x0f, 0x0a, 0x00, 0x00 }; -static __u8 reg84_sn9c325[] = { +static const __u8 reg84_sn9c325[] = { 0x14, 0x00, 0x27, 0x00, 0x07, 0x00, 0xe4, 0x0f, 0xd3, 0x0f, 0x4b, 0x00, 0x48, 0x00, 0xc0, 0x0f, 0xf8, 0x0f, 0x00, 0x00, 0x00 }; -static __u8 hv7131r_sensor_init[][8] = { +static const __u8 hv7131r_sensor_init[][8] = { {0xC1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10}, {0xB1, 0x11, 0x34, 0x17, 0x7F, 0x00, 0x00, 0x10}, {0xD1, 0x11, 0x40, 0xFF, 0x7F, 0x7F, 0x7F, 0x10}, @@ -250,9 +250,9 @@ static __u8 hv7131r_sensor_init[][8] = { {0xA1, 0x11, 0x21, 0xD0, 0x00, 0x00, 0x00, 0x10}, {0xA1, 0x11, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, {0xA1, 0x11, 0x23, 0x10, 0x00, 0x00, 0x00, 0x10}, - {0, 0, 0, 0, 0, 0, 0, 0} + {} }; -static __u8 mi0360_sensor_init[][8] = { +static const __u8 mi0360_sensor_init[][8] = { {0xB1, 0x5D, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, {0xB1, 0x5D, 0x0D, 0x00, 0x01, 0x00, 0x00, 0x10}, {0xB1, 0x5D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x10}, @@ -304,9 +304,9 @@ static __u8 mi0360_sensor_init[][8] = { /* {0xB1, 0x5D, 0x35, 0x00, 0x20, 0x00, 0x00, 0x10}, * gain */ {0xB1, 0x5D, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10}, /* update */ {0xB1, 0x5D, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, /* sensor on */ - {0, 0, 0, 0, 0, 0, 0, 0} + {} }; -static __u8 mo4000_sensor_init[][8] = { +static const __u8 mo4000_sensor_init[][8] = { {0xa1, 0x21, 0x01, 0x02, 0x00, 0x00, 0x00, 0x10}, {0xa1, 0x21, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10}, {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}, @@ -327,9 +327,9 @@ static __u8 mo4000_sensor_init[][8] = { {0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10}, {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10}, - {0, 0, 0, 0, 0, 0, 0, 0} + {} }; -static __u8 ov7660_sensor_init[][8] = { +static const __u8 ov7660_sensor_init[][8] = { {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10}, /* Outformat ?? rawRGB */ @@ -420,12 +420,12 @@ static __u8 ov7660_sensor_init[][8] = { {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10}, {0xa1, 0x21, 0x2b, 0xc3, 0x00, 0x00, 0x00, 0x10}, /* here may start the isoc exchanges */ - {0, 0, 0, 0, 0, 0, 0, 0} + {} }; /* reg0x04 reg0x07 reg 0x10 */ /* expo = (COM1 & 0x02) | (AECHH & 0x2f <<10) [ (AECh << 2) */ -static __u8 ov7648_sensor_init[][8] = { +static const __u8 ov7648_sensor_init[][8] = { {0xC1, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00}, {0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00}, {0xC1, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00}, @@ -478,10 +478,10 @@ static __u8 ov7648_sensor_init[][8] = { {0xA1, 0x6E, 0x07, 0x66, 0x00, 0x00, 0x00, 0x10}, /* B.. */ {0xC1, 0x6E, 0x1A, 0x03, 0x65, 0x90, 0x00, 0x10}, /* Bright/Witen....*/ /* {0xC1, 0x6E, 0x16, 0x45, 0x40, 0x60, 0x00, 0x10}, * Bright/Witene */ - {0, 0, 0, 0, 0, 0, 0, 0} + {} }; -static __u8 qtable4[] = { +static const __u8 qtable4[] = { 0x06, 0x04, 0x04, 0x06, 0x04, 0x04, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x08, 0x0A, 0x11, 0x0A, 0x0A, 0x08, 0x08, 0x0A, 0x15, 0x0F, 0x0F, 0x0C, 0x11, 0x19, 0x15, @@ -518,27 +518,36 @@ static void reg_w(struct usb_device *dev, const __u8 *buffer, int len) { - __u8 tmpbuf[64]; - -#ifdef CONFIG_VIDEO_ADV_DEBUG - if (len > sizeof tmpbuf) { - PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow"); - return; + if (len < 16) { + __u8 tmpbuf[16]; + + memcpy(tmpbuf, buffer, len); + usb_control_msg(dev, + usb_sndctrlpipe(dev, 0), + 0x08, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + value, 0, + tmpbuf, len, + 500); + } else { + __u8 *tmpbuf; + + tmpbuf = kmalloc(len, GFP_KERNEL); + memcpy(tmpbuf, buffer, len); + usb_control_msg(dev, + usb_sndctrlpipe(dev, 0), + 0x08, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + value, 0, + tmpbuf, len, + 500); + kfree(tmpbuf); } -#endif - memcpy(tmpbuf, buffer, len); - usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), - 0x08, - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, - value, 0, - tmpbuf, len, - 500); } /* write 2 bytes */ static void i2c_w2(struct gspca_dev *gspca_dev, - __u8 *buffer) + const __u8 *buffer) { struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; @@ -557,7 +566,7 @@ static void i2c_w2(struct gspca_dev *gspca_dev, } /* write 8 bytes */ -static void i2c_w8(struct usb_device *dev, __u8 *buffer) +static void i2c_w8(struct usb_device *dev, const __u8 *buffer) { reg_w(dev, 0x08, buffer, 8); msleep(1); @@ -565,7 +574,7 @@ static void i2c_w8(struct usb_device *dev, __u8 *buffer) /* read 5 bytes */ static void i2c_r5(struct gspca_dev *gspca_dev, __u8 reg, - __u8 *buffer) + __u8 *buffer) { struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; @@ -591,7 +600,7 @@ static int probesensor(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; __u8 reg02; - static __u8 datasend[] = { 2, 0 }; + static const __u8 datasend[] = { 2, 0 }; /* reg val1 val2 val3 val4 */ __u8 datarecd[6]; @@ -618,18 +627,18 @@ static int probesensor(struct gspca_dev *gspca_dev) } static int configure_gpio(struct gspca_dev *gspca_dev, - __u8 *sn9c1xx) + const __u8 *sn9c1xx) { struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; __u8 data; __u8 regF1; - __u8 *reg9a; - static __u8 reg9a_def[] = + const __u8 *reg9a; + static const __u8 reg9a_def[] = {0x08, 0x40, 0x20, 0x10, 0x00, 0x04}; - static __u8 reg9a_sn9c120[] = /* from win trace */ + static const __u8 reg9a_sn9c120[] = /* from win trace */ {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; - static __u8 reg9a_sn9c325[] = + static const __u8 reg9a_sn9c325[] = {0x0a, 0x40, 0x38, 0x30, 0x00, 0x20}; @@ -697,7 +706,7 @@ static void hv7131R_InitSensor(struct gspca_dev *gspca_dev) { int i = 0; struct usb_device *dev = gspca_dev->dev; - static __u8 SetSensorClk[] = /* 0x08 Mclk */ + static const __u8 SetSensorClk[] = /* 0x08 Mclk */ { 0xa1, 0x11, 0x01, 0x18, 0x00, 0x00, 0x00, 0x10 }; while (hv7131r_sensor_init[i][0]) { @@ -971,11 +980,12 @@ static int sd_config(struct gspca_dev *gspca_dev, cam->epaddr = 0x01; cam->cam_mode = vga_mode; cam->nmodes = ARRAY_SIZE(vga_mode); + sd->qindex = 4; /* set the quantization table */ - sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; - sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; - sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; - sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; + sd->brightness = BRIGHTNESS_DEF; + sd->contrast = CONTRAST_DEF; + sd->colors = COLOR_DEF; + sd->autogain = AUTOGAIN_DEF; return 0; } @@ -984,7 +994,7 @@ static int sd_open(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; -/* __u8 *sn9c1xx; */ +/* const __u8 *sn9c1xx; */ __u8 regF1; __u8 regGpio[] = { 0x29, 0x74 }; @@ -1036,11 +1046,11 @@ static unsigned int setexposure(struct gspca_dev *gspca_dev, unsigned int expo) { struct sd *sd = (struct sd *) gspca_dev; - static __u8 doit[] = /* update sensor */ + static const __u8 doit[] = /* update sensor */ { 0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10 }; - static __u8 sensorgo[] = /* sensor on */ + static const __u8 sensorgo[] = /* sensor on */ { 0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10 }; - static __u8 gainMo[] = + static const __u8 gainMo[] = { 0xa1, 0x21, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1d }; switch (sd->sensor) { @@ -1164,14 +1174,15 @@ static void sd_start(struct gspca_dev *gspca_dev) __u8 data; __u8 reg1; __u8 reg17; - __u8 *sn9c1xx; + const __u8 *sn9c1xx; int mode; - static __u8 DC29[] = { 0x6a, 0x50, 0x00, 0x00, 0x50, 0x3c }; - static __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; - static __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; - static __u8 CA_sn9c120[] = { 0x14, 0xec, 0x0a, 0xf6 }; /* SN9C120 */ - static __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ - static __u8 CE_sn9c325[] = + static const __u8 DC29[] = { 0x6a, 0x50, 0x00, 0x00, 0x50, 0x3c }; + static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; + static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; + static const __u8 CA_sn9c120[] = + { 0x14, 0xec, 0x0a, 0xf6 }; /* SN9C120 */ + static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ + static const __u8 CE_sn9c325[] = { 0x32, 0xdd, 0x32, 0xdd }; /* OV7648 - SN9C325 */ sn9c1xx = sn_tb[(int) sd->sensor]; @@ -1311,13 +1322,13 @@ static void sd_stopN(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; - static __u8 stophv7131[] = + static const __u8 stophv7131[] = { 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 }; - static __u8 stopmi0360[] = + static const __u8 stopmi0360[] = { 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 }; __u8 regF1; __u8 data; - __u8 *sn9c1xx; + const __u8 *sn9c1xx; data = 0x0b; switch (sd->sensor) { @@ -1392,7 +1403,7 @@ static void setautogain(struct gspca_dev *gspca_dev) static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { struct sd *sd = (struct sd *) gspca_dev; @@ -1567,7 +1578,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -1582,7 +1593,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x0458, 0x7025), DVNM("Genius Eye 311Q")}, {USB_DEVICE(0x045e, 0x00f5), DVNM("MicroSoft VX3000")}, {USB_DEVICE(0x045e, 0x00f7), DVNM("MicroSoft VX1000")}, diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c index 1db5b33ad85e..3a42506830f8 100644 --- a/drivers/media/video/gspca/spca500.c +++ b/drivers/media/video/gspca/spca500.c @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver"); @@ -35,7 +35,7 @@ MODULE_LICENSE("GPL"); struct sd { struct gspca_dev gspca_dev; /* !! must be the first item */ - unsigned char packet[ISO_MAX_SIZE + 128]; + __u8 packet[ISO_MAX_SIZE + 128]; /* !! no more than 128 ff in an ISO packet */ unsigned char brightness; @@ -70,44 +70,44 @@ static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val); static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val); static struct ctrl sd_ctrls[] = { -#define SD_BRIGHTNESS 0 { { .id = V4L2_CID_BRIGHTNESS, .type = V4L2_CTRL_TYPE_INTEGER, .name = "Brightness", .minimum = 0, - .maximum = 0xff, + .maximum = 255, .step = 1, - .default_value = 0x7f, +#define BRIGHTNESS_DEF 127 + .default_value = BRIGHTNESS_DEF, }, .set = sd_setbrightness, .get = sd_getbrightness, }, -#define SD_CONTRAST 1 { { .id = V4L2_CID_CONTRAST, .type = V4L2_CTRL_TYPE_INTEGER, .name = "Contrast", .minimum = 0, - .maximum = 255, + .maximum = 63, .step = 1, - .default_value = 127, +#define CONTRAST_DEF 31 + .default_value = CONTRAST_DEF, }, .set = sd_setcontrast, .get = sd_getcontrast, }, -#define SD_COLOR 2 { { .id = V4L2_CID_SATURATION, .type = V4L2_CTRL_TYPE_INTEGER, .name = "Color", .minimum = 0, - .maximum = 255, + .maximum = 63, .step = 1, - .default_value = 127, +#define COLOR_DEF 31 + .default_value = COLOR_DEF, }, .set = sd_setcolors, .get = sd_getcolors, @@ -139,7 +139,7 @@ static struct cam_mode sif_mode[] = { #define SPCA500_OFFSET_DATA 16 -static __u16 spca500_visual_defaults[][3] = { +static const __u16 spca500_visual_defaults[][3] = { {0x00, 0x0003, 0x816b}, /* SSI not active sync with vsync, * hue (H byte) = 0, * saturation/hue enable, @@ -161,10 +161,9 @@ static __u16 spca500_visual_defaults[][3] = { {0x00, 0x0001, 0x8202}, /* clock rate compensation = 1/25 sec/frame */ {0x0c, 0x0004, 0x0000}, /* set interface */ - - {0, 0, 0} + {} }; -static __u16 Clicksmart510_defaults[][3] = { +static const __u16 Clicksmart510_defaults[][3] = { {0x00, 0x00, 0x8211}, {0x00, 0x01, 0x82c0}, {0x00, 0x10, 0x82cb}, @@ -293,7 +292,7 @@ static __u16 Clicksmart510_defaults[][3] = { {} }; -static unsigned char qtable_creative_pccam[2][64] = { +static const __u8 qtable_creative_pccam[2][64] = { { /* Q-table Y-components */ 0x05, 0x03, 0x03, 0x05, 0x07, 0x0c, 0x0f, 0x12, 0x04, 0x04, 0x04, 0x06, 0x08, 0x11, 0x12, 0x11, @@ -314,7 +313,7 @@ static unsigned char qtable_creative_pccam[2][64] = { 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e} }; -static unsigned char qtable_kodak_ez200[2][64] = { +static const __u8 qtable_kodak_ez200[2][64] = { { /* Q-table Y-components */ 0x02, 0x01, 0x01, 0x02, 0x02, 0x04, 0x05, 0x06, 0x01, 0x01, 0x01, 0x02, 0x03, 0x06, 0x06, 0x06, @@ -335,7 +334,7 @@ static unsigned char qtable_kodak_ez200[2][64] = { 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a} }; -static unsigned char qtable_pocketdv[2][64] = { +static const __u8 qtable_pocketdv[2][64] = { { /* Q-table Y-components start registers 0x8800 */ 0x06, 0x04, 0x04, 0x06, 0x0a, 0x10, 0x14, 0x18, 0x05, 0x05, 0x06, 0x08, 0x0a, 0x17, 0x18, 0x16, @@ -357,7 +356,7 @@ static unsigned char qtable_pocketdv[2][64] = { 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28} }; -static void spca5xxRegRead(struct usb_device *dev, +static void reg_r(struct usb_device *dev, __u16 index, __u8 *buffer, __u16 length) { @@ -369,25 +368,24 @@ static void spca5xxRegRead(struct usb_device *dev, index, buffer, length, 500); } -static int reg_write(struct usb_device *dev, +static int reg_w(struct usb_device *dev, __u16 req, __u16 index, __u16 value) { int ret; + PDEBUG(D_USBO, "reg write: [0x%02x] = 0x%02x", index, value); ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), req, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, NULL, 0, 500); - PDEBUG(D_USBO, "reg write: [0x%02x] = 0x%02x, 0x%x", - index, value, ret); if (ret < 0) PDEBUG(D_ERR, "reg write: error %d", ret); return ret; } /* returns: negative is error, pos or zero is data */ -static int reg_read(struct usb_device *dev, +static int reg_r_12(struct usb_device *dev, __u16 req, /* bRequest */ __u16 index, /* wIndex */ __u16 length) /* wLength (1 or 2 only) */ @@ -405,7 +403,7 @@ static int reg_read(struct usb_device *dev, buf, length, 500); /* timeout */ if (ret < 0) { - PDEBUG(D_ERR, "reg_read err %d", ret); + PDEBUG(D_ERR, "reg_r_12 err %d", ret); return -1; } return (buf[1] << 8) + buf[0]; @@ -416,13 +414,13 @@ static int reg_read(struct usb_device *dev, * a reg_read call. * Returns: negative is error or timeout, zero is success. */ -static int reg_readwait(struct usb_device *dev, +static int reg_r_wait(struct usb_device *dev, __u16 reg, __u16 index, __u16 value) { int ret, cnt = 20; while (--cnt > 0) { - ret = reg_read(dev, reg, index, 1); + ret = reg_r_12(dev, reg, index, 1); if (ret == value) return 0; msleep(50); @@ -431,13 +429,13 @@ static int reg_readwait(struct usb_device *dev, } static int write_vector(struct gspca_dev *gspca_dev, - __u16 data[][3]) + const __u16 data[][3]) { struct usb_device *dev = gspca_dev->dev; int ret, i = 0; while (data[i][0] != 0 || data[i][1] != 0 || data[i][2] != 0) { - ret = reg_write(dev, data[i][0], data[i][2], data[i][1]); + ret = reg_w(dev, data[i][0], data[i][2], data[i][1]); if (ret < 0) return ret; i++; @@ -449,21 +447,21 @@ static int spca50x_setup_qtable(struct gspca_dev *gspca_dev, unsigned int request, unsigned int ybase, unsigned int cbase, - unsigned char qtable[2][64]) + const __u8 qtable[2][64]) { struct usb_device *dev = gspca_dev->dev; int i, err; /* loop over y components */ for (i = 0; i < 64; i++) { - err = reg_write(dev, request, ybase + i, qtable[0][i]); + err = reg_w(dev, request, ybase + i, qtable[0][i]); if (err < 0) return err; } /* loop over c components */ for (i = 0; i < 64; i++) { - err = reg_write(dev, request, cbase + i, qtable[1][i]); + err = reg_w(dev, request, cbase + i, qtable[1][i]); if (err < 0) return err; } @@ -474,8 +472,8 @@ static void spca500_ping310(struct gspca_dev *gspca_dev) { __u8 Data[2]; - spca5xxRegRead(gspca_dev->dev, 0x0d04, Data, 2); - PDEBUG(D_PACK, "ClickSmart310 ping 0x0d04 0x%02x 0x%02x", + reg_r(gspca_dev->dev, 0x0d04, Data, 2); + PDEBUG(D_STREAM, "ClickSmart310 ping 0x0d04 0x%02x 0x%02x", Data[0], Data[1]); } @@ -483,26 +481,26 @@ static void spca500_clksmart310_init(struct gspca_dev *gspca_dev) { __u8 Data[2]; - spca5xxRegRead(gspca_dev->dev, 0x0d05, Data, 2); - PDEBUG(D_PACK, "ClickSmart310 init 0x0d05 0x%02x 0x%02x", Data[0], - Data[1]); - reg_write(gspca_dev->dev, 0x00, 0x8167, 0x5a); + reg_r(gspca_dev->dev, 0x0d05, Data, 2); + PDEBUG(D_STREAM, "ClickSmart310 init 0x0d05 0x%02x 0x%02x", + Data[0], Data[1]); + reg_w(gspca_dev->dev, 0x00, 0x8167, 0x5a); spca500_ping310(gspca_dev); - reg_write(gspca_dev->dev, 0x00, 0x8168, 0x22); - reg_write(gspca_dev->dev, 0x00, 0x816a, 0xc0); - reg_write(gspca_dev->dev, 0x00, 0x816b, 0x0b); - reg_write(gspca_dev->dev, 0x00, 0x8169, 0x25); - reg_write(gspca_dev->dev, 0x00, 0x8157, 0x5b); - reg_write(gspca_dev->dev, 0x00, 0x8158, 0x5b); - reg_write(gspca_dev->dev, 0x00, 0x813f, 0x03); - reg_write(gspca_dev->dev, 0x00, 0x8151, 0x4a); - reg_write(gspca_dev->dev, 0x00, 0x8153, 0x78); - reg_write(gspca_dev->dev, 0x00, 0x0d01, 0x04); + reg_w(gspca_dev->dev, 0x00, 0x8168, 0x22); + reg_w(gspca_dev->dev, 0x00, 0x816a, 0xc0); + reg_w(gspca_dev->dev, 0x00, 0x816b, 0x0b); + reg_w(gspca_dev->dev, 0x00, 0x8169, 0x25); + reg_w(gspca_dev->dev, 0x00, 0x8157, 0x5b); + reg_w(gspca_dev->dev, 0x00, 0x8158, 0x5b); + reg_w(gspca_dev->dev, 0x00, 0x813f, 0x03); + reg_w(gspca_dev->dev, 0x00, 0x8151, 0x4a); + reg_w(gspca_dev->dev, 0x00, 0x8153, 0x78); + reg_w(gspca_dev->dev, 0x00, 0x0d01, 0x04); /* 00 for adjust shutter */ - reg_write(gspca_dev->dev, 0x00, 0x0d02, 0x01); - reg_write(gspca_dev->dev, 0x00, 0x8169, 0x25); - reg_write(gspca_dev->dev, 0x00, 0x0d01, 0x02); + reg_w(gspca_dev->dev, 0x00, 0x0d02, 0x01); + reg_w(gspca_dev->dev, 0x00, 0x8169, 0x25); + reg_w(gspca_dev->dev, 0x00, 0x0d01, 0x02); } static void spca500_setmode(struct gspca_dev *gspca_dev, @@ -511,14 +509,14 @@ static void spca500_setmode(struct gspca_dev *gspca_dev, int mode; /* set x multiplier */ - reg_write(gspca_dev->dev, 0, 0x8001, xmult); + reg_w(gspca_dev->dev, 0, 0x8001, xmult); /* set y multiplier */ - reg_write(gspca_dev->dev, 0, 0x8002, ymult); + reg_w(gspca_dev->dev, 0, 0x8002, ymult); /* use compressed mode, VGA, with mode specific subsample */ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; - reg_write(gspca_dev->dev, 0, 0x8003, mode << 4); + reg_w(gspca_dev->dev, 0, 0x8003, mode << 4); } static int spca500_full_reset(struct gspca_dev *gspca_dev) @@ -526,20 +524,20 @@ static int spca500_full_reset(struct gspca_dev *gspca_dev) int err; /* send the reset command */ - err = reg_write(gspca_dev->dev, 0xe0, 0x0001, 0x0000); + err = reg_w(gspca_dev->dev, 0xe0, 0x0001, 0x0000); if (err < 0) return err; /* wait for the reset to complete */ - err = reg_readwait(gspca_dev->dev, 0x06, 0x0000, 0x0000); + err = reg_r_wait(gspca_dev->dev, 0x06, 0x0000, 0x0000); if (err < 0) return err; - err = reg_write(gspca_dev->dev, 0xe0, 0x0000, 0x0000); + err = reg_w(gspca_dev->dev, 0xe0, 0x0000, 0x0000); if (err < 0) return err; - err = reg_readwait(gspca_dev->dev, 0x06, 0, 0); + err = reg_r_wait(gspca_dev->dev, 0x06, 0, 0); if (err < 0) { - PDEBUG(D_ERR, "reg_readwait() failed"); + PDEBUG(D_ERR, "reg_r_wait() failed"); return err; } /* all ok */ @@ -562,7 +560,7 @@ static int spca500_synch310(struct gspca_dev *gspca_dev) } spca500_ping310(gspca_dev); - spca5xxRegRead(gspca_dev->dev, 0x0d00, &Data, 1); + reg_r(gspca_dev->dev, 0x0d00, &Data, 1); /* need alt setting here */ PDEBUG(D_PACK, "ClickSmart310 sync alt: %d", gspca_dev->alt); @@ -586,12 +584,12 @@ static void spca500_reinit(struct gspca_dev *gspca_dev) /* some unknow command from Aiptek pocket dv and family300 */ - reg_write(gspca_dev->dev, 0x00, 0x0d01, 0x01); - reg_write(gspca_dev->dev, 0x00, 0x0d03, 0x00); - reg_write(gspca_dev->dev, 0x00, 0x0d02, 0x01); + reg_w(gspca_dev->dev, 0x00, 0x0d01, 0x01); + reg_w(gspca_dev->dev, 0x00, 0x0d03, 0x00); + reg_w(gspca_dev->dev, 0x00, 0x0d02, 0x01); /* enable drop packet */ - reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001); + reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_pocketdv); @@ -599,22 +597,22 @@ static void spca500_reinit(struct gspca_dev *gspca_dev) PDEBUG(D_ERR|D_STREAM, "spca50x_setup_qtable failed on init"); /* set qtable index */ - reg_write(gspca_dev->dev, 0x00, 0x8880, 2); + reg_w(gspca_dev->dev, 0x00, 0x8880, 2); /* family cam Quicksmart stuff */ - reg_write(gspca_dev->dev, 0x00, 0x800a, 0x00); + reg_w(gspca_dev->dev, 0x00, 0x800a, 0x00); /* Set agc transfer: synced inbetween frames */ - reg_write(gspca_dev->dev, 0x00, 0x820f, 0x01); + reg_w(gspca_dev->dev, 0x00, 0x820f, 0x01); /* Init SDRAM - needed for SDRAM access */ - reg_write(gspca_dev->dev, 0x00, 0x870a, 0x04); + reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04); /*Start init sequence or stream */ - reg_write(gspca_dev->dev, 0, 0x8003, 0x00); + reg_w(gspca_dev->dev, 0, 0x8003, 0x00); /* switch to video camera mode */ - reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); msleep(2000); - if (reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) - spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1); - reg_write(gspca_dev->dev, 0x00, 0x816b, Data); + if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) + reg_r(gspca_dev->dev, 0x816b, &Data, 1); + reg_w(gspca_dev->dev, 0x00, 0x816b, Data); } /* this function is called at probe time */ @@ -734,9 +732,9 @@ static int sd_config(struct gspca_dev *gspca_dev, cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; } sd->qindex = 5; - sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; - sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; - sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; + sd->brightness = BRIGHTNESS_DEF; + sd->contrast = CONTRAST_DEF; + sd->colors = COLOR_DEF; return 0; } @@ -771,7 +769,7 @@ static void sd_start(struct gspca_dev *gspca_dev) } /* is there a sensor here ? */ - spca5xxRegRead(gspca_dev->dev, 0x8a04, &Data, 1); + reg_r(gspca_dev->dev, 0x8a04, &Data, 1); PDEBUG(D_STREAM, "Spca500 Sensor Address 0x%02X", Data); PDEBUG(D_STREAM, "Spca500 curr_mode: %d Xmult: 0x%02X, Ymult: 0x%02X", gspca_dev->curr_mode, xmult, ymult); @@ -782,33 +780,33 @@ static void sd_start(struct gspca_dev *gspca_dev) spca500_setmode(gspca_dev, xmult, ymult); /* enable drop packet */ - reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001); - reg_write(gspca_dev->dev, 0x00, 0x8880, 3); + reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); + reg_w(gspca_dev->dev, 0x00, 0x8880, 3); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_creative_pccam); if (err < 0) PDEBUG(D_ERR, "spca50x_setup_qtable failed"); /* Init SDRAM - needed for SDRAM access */ - reg_write(gspca_dev->dev, 0x00, 0x870a, 0x04); + reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04); /* switch to video camera mode */ - reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); msleep(500); - if (reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) - PDEBUG(D_ERR, "reg_readwait() failed"); + if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) + PDEBUG(D_ERR, "reg_r_wait() failed"); - spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1); - reg_write(gspca_dev->dev, 0x00, 0x816b, Data); + reg_r(gspca_dev->dev, 0x816b, &Data, 1); + reg_w(gspca_dev->dev, 0x00, 0x816b, Data); spca500_synch310(gspca_dev); write_vector(gspca_dev, spca500_visual_defaults); spca500_setmode(gspca_dev, xmult, ymult); /* enable drop packet */ - reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001); + reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); PDEBUG(D_ERR, "failed to enable drop packet"); - reg_write(gspca_dev->dev, 0x00, 0x8880, 3); + reg_w(gspca_dev->dev, 0x00, 0x8880, 3); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_creative_pccam); @@ -816,16 +814,16 @@ static void sd_start(struct gspca_dev *gspca_dev) PDEBUG(D_ERR, "spca50x_setup_qtable failed"); /* Init SDRAM - needed for SDRAM access */ - reg_write(gspca_dev->dev, 0x00, 0x870a, 0x04); + reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04); /* switch to video camera mode */ - reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); - if (reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) - PDEBUG(D_ERR, "reg_readwait() failed"); + if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) + PDEBUG(D_ERR, "reg_r_wait() failed"); - spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1); - reg_write(gspca_dev->dev, 0x00, 0x816b, Data); + reg_r(gspca_dev->dev, 0x816b, &Data, 1); + reg_w(gspca_dev->dev, 0x00, 0x816b, Data); break; case CreativePCCam300: /* Creative PC-CAM 300 640x480 CCD */ case IntelPocketPCCamera: /* FIXME: Temporary fix for @@ -838,10 +836,10 @@ static void sd_start(struct gspca_dev *gspca_dev) PDEBUG(D_ERR, "spca500_full_reset failed"); /* enable drop packet */ - err = reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001); + err = reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); if (err < 0) PDEBUG(D_ERR, "failed to enable drop packet"); - reg_write(gspca_dev->dev, 0x00, 0x8880, 3); + reg_w(gspca_dev->dev, 0x00, 0x8880, 3); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_creative_pccam); @@ -849,18 +847,18 @@ static void sd_start(struct gspca_dev *gspca_dev) PDEBUG(D_ERR, "spca50x_setup_qtable failed"); spca500_setmode(gspca_dev, xmult, ymult); - reg_write(gspca_dev->dev, 0x20, 0x0001, 0x0004); + reg_w(gspca_dev->dev, 0x20, 0x0001, 0x0004); /* switch to video camera mode */ - reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); - if (reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) - PDEBUG(D_ERR, "reg_readwait() failed"); + if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) + PDEBUG(D_ERR, "reg_r_wait() failed"); - spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1); - reg_write(gspca_dev->dev, 0x00, 0x816b, Data); + reg_r(gspca_dev->dev, 0x816b, &Data, 1); + reg_w(gspca_dev->dev, 0x00, 0x816b, Data); - /* write_vector(gspca_dev, spca500_visual_defaults); */ +/* write_vector(gspca_dev, spca500_visual_defaults); */ break; case KodakEZ200: /* Kodak EZ200 */ @@ -869,8 +867,8 @@ static void sd_start(struct gspca_dev *gspca_dev) if (err < 0) PDEBUG(D_ERR, "spca500_full_reset failed"); /* enable drop packet */ - reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001); - reg_write(gspca_dev->dev, 0x00, 0x8880, 0); + reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); + reg_w(gspca_dev->dev, 0x00, 0x8880, 0); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_kodak_ez200); @@ -878,18 +876,18 @@ static void sd_start(struct gspca_dev *gspca_dev) PDEBUG(D_ERR, "spca50x_setup_qtable failed"); spca500_setmode(gspca_dev, xmult, ymult); - reg_write(gspca_dev->dev, 0x20, 0x0001, 0x0004); + reg_w(gspca_dev->dev, 0x20, 0x0001, 0x0004); /* switch to video camera mode */ - reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); - if (reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) - PDEBUG(D_ERR, "reg_readwait() failed"); + if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) + PDEBUG(D_ERR, "reg_r_wait() failed"); - spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1); - reg_write(gspca_dev->dev, 0x00, 0x816b, Data); + reg_r(gspca_dev->dev, 0x816b, &Data, 1); + reg_w(gspca_dev->dev, 0x00, 0x816b, Data); - /* write_vector(gspca_dev, spca500_visual_defaults); */ +/* write_vector(gspca_dev, spca500_visual_defaults); */ break; case BenqDC1016: @@ -902,56 +900,56 @@ static void sd_start(struct gspca_dev *gspca_dev) case ToptroIndus: case AgfaCl20: spca500_reinit(gspca_dev); - reg_write(gspca_dev->dev, 0x00, 0x0d01, 0x01); + reg_w(gspca_dev->dev, 0x00, 0x0d01, 0x01); /* enable drop packet */ - reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001); + reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_pocketdv); if (err < 0) PDEBUG(D_ERR, "spca50x_setup_qtable failed"); - reg_write(gspca_dev->dev, 0x00, 0x8880, 2); + reg_w(gspca_dev->dev, 0x00, 0x8880, 2); /* familycam Quicksmart pocketDV stuff */ - reg_write(gspca_dev->dev, 0x00, 0x800a, 0x00); + reg_w(gspca_dev->dev, 0x00, 0x800a, 0x00); /* Set agc transfer: synced inbetween frames */ - reg_write(gspca_dev->dev, 0x00, 0x820f, 0x01); + reg_w(gspca_dev->dev, 0x00, 0x820f, 0x01); /* Init SDRAM - needed for SDRAM access */ - reg_write(gspca_dev->dev, 0x00, 0x870a, 0x04); + reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04); spca500_setmode(gspca_dev, xmult, ymult); /* switch to video camera mode */ - reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); - reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44); + reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44); - spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1); - reg_write(gspca_dev->dev, 0x00, 0x816b, Data); + reg_r(gspca_dev->dev, 0x816b, &Data, 1); + reg_w(gspca_dev->dev, 0x00, 0x816b, Data); break; case LogitechTraveler: case LogitechClickSmart510: - reg_write(gspca_dev->dev, 0x02, 0x00, 0x00); + reg_w(gspca_dev->dev, 0x02, 0x00, 0x00); /* enable drop packet */ - reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001); + reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_creative_pccam); if (err < 0) PDEBUG(D_ERR, "spca50x_setup_qtable failed"); - reg_write(gspca_dev->dev, 0x00, 0x8880, 3); - reg_write(gspca_dev->dev, 0x00, 0x800a, 0x00); + reg_w(gspca_dev->dev, 0x00, 0x8880, 3); + reg_w(gspca_dev->dev, 0x00, 0x800a, 0x00); /* Init SDRAM - needed for SDRAM access */ - reg_write(gspca_dev->dev, 0x00, 0x870a, 0x04); + reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04); spca500_setmode(gspca_dev, xmult, ymult); /* switch to video camera mode */ - reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004); - reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44); + reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44); - spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1); - reg_write(gspca_dev->dev, 0x00, 0x816b, Data); + reg_r(gspca_dev->dev, 0x816b, &Data, 1); + reg_w(gspca_dev->dev, 0x00, 0x816b, Data); write_vector(gspca_dev, Clicksmart510_defaults); break; } @@ -959,13 +957,13 @@ static void sd_start(struct gspca_dev *gspca_dev) static void sd_stopN(struct gspca_dev *gspca_dev) { - __u8 data = 0; + __u8 data; - reg_write(gspca_dev->dev, 0, 0x8003, 0x00); + reg_w(gspca_dev->dev, 0, 0x8003, 0x00); /* switch to video camera mode */ - reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004); - spca5xxRegRead(gspca_dev->dev, 0x8000, &data, 1); + reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_r(gspca_dev->dev, 0x8000, &data, 1); PDEBUG(D_STREAM, "stop SPCA500 done reg8000: 0x%2x", data); } @@ -979,13 +977,13 @@ static void sd_close(struct gspca_dev *gspca_dev) static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { struct sd *sd = (struct sd *) gspca_dev; int i; - unsigned char *s, *d; - static unsigned char ffd9[] = {0xff, 0xd9}; + __u8 *s, *d; + static __u8 ffd9[] = {0xff, 0xd9}; /* frames are jpeg 4.1.1 without 0xff escape */ if (data[0] == 0xff) { @@ -997,9 +995,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ffd9, 2); /* put the JPEG header in the new frame */ - jpeg_put_header(gspca_dev, frame, - ((struct sd *) gspca_dev)->qindex, - 0x22); + jpeg_put_header(gspca_dev, frame, sd->qindex, 0x22); data += SPCA500_OFFSET_DATA; len -= SPCA500_OFFSET_DATA; @@ -1031,43 +1027,52 @@ static void setbrightness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - reg_write(gspca_dev->dev, 0x00, 0x8167, + reg_w(gspca_dev->dev, 0x00, 0x8167, (__u8) (sd->brightness - 128)); } static void getbrightness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; + int ret; - sd->brightness = reg_read(gspca_dev->dev, 0x00, 0x8167, 1) + 128; + ret = reg_r_12(gspca_dev->dev, 0x00, 0x8167, 1); + if (ret >= 0) + sd->brightness = ret + 128; } static void setcontrast(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - reg_write(gspca_dev->dev, 0x00, 0x8168, sd->contrast >> 2); + reg_w(gspca_dev->dev, 0x00, 0x8168, sd->contrast); } static void getcontrast(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; + int ret; - sd->contrast = reg_read(gspca_dev->dev, 0x0, 0x8168, 1) << 2; + ret = reg_r_12(gspca_dev->dev, 0x0, 0x8168, 1); + if (ret >= 0) + sd->contrast = ret; } static void setcolors(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - reg_write(gspca_dev->dev, 0x00, 0x8169, sd->colors >> 2); + reg_w(gspca_dev->dev, 0x00, 0x8169, sd->colors); } static void getcolors(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; + int ret; - sd->colors = reg_read(gspca_dev->dev, 0x0, 0x8169, 1) << 2; + ret = reg_r_12(gspca_dev->dev, 0x0, 0x8169, 1); + if (ret >= 0) + sd->colors = ret; } static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) @@ -1131,7 +1136,7 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val) static struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, - .nctrls = sizeof sd_ctrls / sizeof sd_ctrls[0], + .nctrls = ARRAY_SIZE(sd_ctrls), .config = sd_config, .open = sd_open, .start = sd_start, @@ -1143,7 +1148,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x040a, 0x0300), DVNM("Kodak EZ200")}, {USB_DEVICE(0x041e, 0x400a), DVNM("Creative PC-CAM 300")}, {USB_DEVICE(0x046d, 0x0890), DVNM("Logitech QuickCam traveler")}, diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c index c6468cf3506a..417fbe2214be 100644 --- a/drivers/media/video/gspca/spca501.c +++ b/drivers/media/video/gspca/spca501.c @@ -23,8 +23,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver"); @@ -151,7 +151,7 @@ static struct cam_mode vga_mode[] = { #define SPCA501_A33 0x10 /* Data for video camera initialization before capturing */ -static __u16 spca501_open_data[][3] = { +static const __u16 spca501_open_data[][3] = { /* bmRequest,value,index */ {0x2, 0x50, 0x00}, /* C/S enable soft reset */ @@ -257,7 +257,7 @@ static __u16 spca501_open_data[][3] = { */ /* Data for chip initialization (set default values) */ -static __u16 spca501_init_data[][3] = { +static const __u16 spca501_init_data[][3] = { /* Set all the values to powerup defaults */ /* bmRequest,value,index */ {0x0, 0xAA, 0x00}, @@ -544,7 +544,7 @@ static __u16 spca501_init_data[][3] = { * Capture and decoding by Colin Peart. * This is is for the 3com HomeConnect Lite which is spca501a based. */ -static __u16 spca501_3com_open_data[][3] = { +static const __u16 spca501_3com_open_data[][3] = { /* bmRequest,value,index */ {0x2, 0x0050, 0x0000}, /* C/S Enable TG soft reset, timing mode=010 */ {0x2, 0x0043, 0x0000}, /* C/S Disable TG soft reset, timing mode=010 */ @@ -639,7 +639,7 @@ static __u16 spca501_3com_open_data[][3] = { * 2) Understand why some values seem to appear more than once * 3) Write a small comment for each line of the following arrays. */ -static __u16 spca501c_arowana_open_data[][3] = { +static const __u16 spca501c_arowana_open_data[][3] = { /* bmRequest,value,index */ {0x02, 0x0007, 0x0005}, {0x02, 0xa048, 0x0000}, @@ -661,7 +661,7 @@ static __u16 spca501c_arowana_open_data[][3] = { {} }; -static __u16 spca501c_arowana_init_data[][3] = { +static const __u16 spca501c_arowana_init_data[][3] = { /* bmRequest,value,index */ {0x02, 0x0007, 0x0005}, {0x02, 0xa048, 0x0000}, @@ -1595,7 +1595,7 @@ static __u16 spca501c_arowana_init_data[][3] = { /* Unknow camera from Ori Usbid 0x0000:0x0000 */ /* Based on snoops from Ori Cohen */ -static __u16 spca501c_mysterious_open_data[][3] = { +static const __u16 spca501c_mysterious_open_data[][3] = { {0x02, 0x000f, 0x0005}, {0x02, 0xa048, 0x0000}, {0x05, 0x0022, 0x0004}, @@ -1646,7 +1646,7 @@ static __u16 spca501c_mysterious_open_data[][3] = { }; /* Based on snoops from Ori Cohen */ -static __u16 spca501c_mysterious_init_data[][3] = { +static const __u16 spca501c_mysterious_init_data[][3] = { /* Part 3 */ /* TG registers */ /* {0x00, 0x0000, 0x0000}, */ @@ -1839,7 +1839,7 @@ static int reg_read(struct usb_device *dev, } static int write_vector(struct gspca_dev *gspca_dev, - __u16 data[][3]) + const __u16 data[][3]) { struct usb_device *dev = gspca_dev->dev; int ret, i = 0; @@ -2001,7 +2001,6 @@ static int sd_open(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - PDEBUG(D_STREAM, "SPCA501 init"); switch (sd->subtype) { case ThreeComHomeConnectLite: /* Special handling for 3com data */ @@ -2050,7 +2049,7 @@ static void sd_start(struct gspca_dev *gspca_dev) reg_write(dev, SPCA501_REG_CTLRL, 0x01, 0x02); /* HDG atleast the Intel CreateAndShare needs to have one of its - * brightness / contrast / color set otherwise it assumes wath seems + * brightness / contrast / color set otherwise it assumes what seems * max contrast. Note that strange enough setting any of these is * enough to fix the max contrast problem, to be sure we set all 3 */ setbrightness(gspca_dev); @@ -2159,7 +2158,7 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val) } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -2174,7 +2173,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x040a, 0x0002), DVNM("Kodak DVC-325")}, {USB_DEVICE(0x0497, 0xc001), DVNM("Smile International")}, {USB_DEVICE(0x0506, 0x00df), DVNM("3Com HomeConnect Lite")}, diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c index d8ff121c2c5a..30d174fc4b9c 100644 --- a/drivers/media/video/gspca/spca505.c +++ b/drivers/media/video/gspca/spca505.c @@ -23,8 +23,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver"); @@ -91,7 +91,7 @@ static struct cam_mode vga_mode[] = { /* * Data to initialize a SPCA505. Common to the CCD and external modes */ -static __u16 spca505_init_data[][3] = { +static const __u16 spca505_init_data[][3] = { /* line bmRequest,value,index */ /* 1819 */ {SPCA50X_REG_GLOBAL, SPCA50X_GMISC3_SAA7113RST, SPCA50X_GLOBAL_MISC3}, @@ -130,7 +130,7 @@ static __u16 spca505_init_data[][3] = { /* * Data to initialize the camera using the internal CCD */ -static __u16 spca505_open_data_ccd[][3] = { +static const __u16 spca505_open_data_ccd[][3] = { /* line bmRequest,value,index */ /* Internal CCD data set */ /* 1891 */ {0x3, 0x04, 0x01}, @@ -319,7 +319,7 @@ static __u16 spca505_open_data_ccd[][3] = { /* * Data to initialize a SPCA505. Common to the CCD and external modes */ -static __u16 spca505b_init_data[][3] = { +static const __u16 spca505b_init_data[][3] = { /* start */ {0x02, 0x00, 0x00}, /* init */ {0x02, 0x00, 0x01}, @@ -383,7 +383,7 @@ static __u16 spca505b_init_data[][3] = { /* * Data to initialize the camera using the internal CCD */ -static __u16 spca505b_open_data_ccd[][3] = { +static const __u16 spca505b_open_data_ccd[][3] = { /* {0x02,0x00,0x00}, */ {0x03, 0x04, 0x01}, /* rst */ @@ -579,7 +579,7 @@ static int reg_read(struct usb_device *dev, __u16 length) /* wLength (1 or 2 only) */ { int ret; - unsigned char buf[4]; + __u8 buf[4]; buf[1] = 0; ret = usb_control_msg(dev, @@ -599,7 +599,7 @@ static int reg_read(struct usb_device *dev, } static int write_vector(struct gspca_dev *gspca_dev, - __u16 data[][3]) + const __u16 data[][3]) { struct usb_device *dev = gspca_dev->dev; int ret, i = 0; @@ -801,7 +801,7 @@ static void yyuv_decode(unsigned char *out, static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { struct sd *sd = (struct sd *) gspca_dev; @@ -878,7 +878,7 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -893,7 +893,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x041e, 0x401d), DVNM("Creative Webcam NX ULTRA")}, {USB_DEVICE(0x0733, 0x0430), DVNM("Intel PC Camera Pro")}, {} diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c index 2ccd877b998d..3b54f41d21c1 100644 --- a/drivers/media/video/gspca/spca508.c +++ b/drivers/media/video/gspca/spca508.c @@ -22,8 +22,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver"); @@ -92,7 +92,7 @@ static struct cam_mode sif_mode[] = { * Initialization data: this is the first set-up data written to the * device (before the open data). */ -static __u16 spca508_init_data[][3] = +static const __u16 spca508_init_data[][3] = #define IGN(x) /* nothing */ { /* line URB value, index */ @@ -584,7 +584,7 @@ static __u16 spca508_init_data[][3] = /* * Initialization data for Intel EasyPC Camera CS110 */ -static __u16 spca508cs110_init_data[][3] = { +static const __u16 spca508cs110_init_data[][3] = { {0x0000, 0x870b}, /* Reset CTL3 */ {0x0003, 0x8111}, /* Soft Reset compression, memory, TG & CDSP */ {0x0000, 0x8111}, /* Normal operation on reset */ @@ -668,7 +668,7 @@ static __u16 spca508cs110_init_data[][3] = { {} }; -static __u16 spca508_sightcam_init_data[][3] = { +static const __u16 spca508_sightcam_init_data[][3] = { /* This line seems to setup the frame/canvas */ /*368 */ {0x000f, 0x8402}, @@ -752,7 +752,7 @@ static __u16 spca508_sightcam_init_data[][3] = { {0, 0} }; -static __u16 spca508_sightcam2_init_data[][3] = { +static const __u16 spca508_sightcam2_init_data[][3] = { /* 35 */ {0x0020, 0x8112}, /* 36 */ {0x000f, 0x8402}, @@ -1099,7 +1099,7 @@ static __u16 spca508_sightcam2_init_data[][3] = { /* * Initialization data for Creative Webcam Vista */ -static __u16 spca508_vista_init_data[][3] = { +static const __u16 spca508_vista_init_data[][3] = { {0x0008, 0x8200}, /* Clear register */ {0x0000, 0x870b}, /* Reset CTL3 */ {0x0020, 0x8112}, /* Video Drop packet enable */ @@ -1441,7 +1441,7 @@ static int reg_read(struct usb_device *dev, } static int write_vector(struct gspca_dev *gspca_dev, - __u16 data[][3]) + const __u16 data[][3]) { struct usb_device *dev = gspca_dev->dev; int ret, i = 0; @@ -1639,7 +1639,7 @@ static void yuvy_decode(unsigned char *out, static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { struct sd *sd = (struct sd *) gspca_dev; @@ -1717,7 +1717,7 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -1732,7 +1732,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x041e, 0x4018), DVNM("Creative Webcam Vista (PD1100)")}, {USB_DEVICE(0x0461, 0x0815), DVNM("Micro Innovation IC200")}, {USB_DEVICE(0x0733, 0x0110), DVNM("ViewQuest VQ110")}, diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c index dbd1648a655f..8e39cbdda2a5 100644 --- a/drivers/media/video/gspca/spca561.c +++ b/drivers/media/video/gspca/spca561.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver"); @@ -148,7 +148,8 @@ static void reg_w_val(struct usb_device *dev, __u16 index, __u16 value) PDEBUG(D_ERR, "reg write: error %d", ret); } -static void write_vector(struct gspca_dev *gspca_dev, __u16 data[][2]) +static void write_vector(struct gspca_dev *gspca_dev, + const __u16 data[][2]) { struct usb_device *dev = gspca_dev->dev; int i; @@ -171,13 +172,16 @@ static void reg_r(struct usb_device *dev, } static void reg_w_buf(struct usb_device *dev, - __u16 index, __u8 *buffer, __u16 length) + __u16 index, const __u8 *buffer, __u16 len) { + __u8 tmpbuf[8]; + + memcpy(tmpbuf, buffer, len); usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 0, /* request */ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ - index, buffer, length, 500); + index, tmpbuf, len, 500); } static void i2c_init(struct gspca_dev *gspca_dev, __u8 mode) @@ -227,7 +231,7 @@ static int i2c_read(struct gspca_dev *gspca_dev, __u16 reg, __u8 mode) return ((int) value << 8) | vallsb; } -static __u16 spca561_init_data[][2] = { +static const __u16 spca561_init_data[][2] = { {0x0000, 0x8114}, /* Software GPIO output data */ {0x0001, 0x8114}, /* Software GPIO output data */ {0x0000, 0x8112}, /* Some kind of reset */ @@ -437,7 +441,7 @@ static void sensor_reset(struct gspca_dev *gspca_dev) } /******************** QC Express etch2 stuff ********************/ -static __u16 Pb100_1map8300[][2] = { +static const __u16 Pb100_1map8300[][2] = { /* reg, value */ {0x8320, 0x3304}, @@ -452,14 +456,14 @@ static __u16 Pb100_1map8300[][2] = { {0x8302, 0x000e}, {} }; -static __u16 Pb100_2map8300[][2] = { +static const __u16 Pb100_2map8300[][2] = { /* reg, value */ {0x8339, 0x0000}, {0x8307, 0x00aa}, {} }; -static __u16 spca561_161rev12A_data1[][2] = { +static const __u16 spca561_161rev12A_data1[][2] = { {0x21, 0x8118}, {0x01, 0x8114}, {0x00, 0x8112}, @@ -467,7 +471,7 @@ static __u16 spca561_161rev12A_data1[][2] = { {0x04, 0x8802}, /* windows uses 08 */ {} }; -static __u16 spca561_161rev12A_data2[][2] = { +static const __u16 spca561_161rev12A_data2[][2] = { {0x21, 0x8118}, {0x10, 0x8500}, {0x07, 0x8601}, @@ -513,7 +517,7 @@ static __u16 spca561_161rev12A_data2[][2] = { }; static void sensor_mapwrite(struct gspca_dev *gspca_dev, - __u16 sensormap[][2]) + const __u16 sensormap[][2]) { int i = 0; __u8 usbval[2]; @@ -956,7 +960,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -971,7 +975,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x041e, 0x401a), DVNM("Creative Webcam Vista (PD1100)")}, {USB_DEVICE(0x041e, 0x403b), DVNM("Creative Webcam Vista (VF0010)")}, {USB_DEVICE(0x0458, 0x7004), DVNM("Genius VideoCAM Express V2")}, diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c index 6832fe0f3403..ad59c5ab5d90 100644 --- a/drivers/media/video/gspca/stk014.c +++ b/drivers/media/video/gspca/stk014.c @@ -23,8 +23,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); @@ -54,7 +54,6 @@ static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); static struct ctrl sd_ctrls[] = { -#define SD_BRIGHTNESS 0 { { .id = V4L2_CID_BRIGHTNESS, @@ -63,12 +62,12 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 255, .step = 1, - .default_value = 127, +#define BRIGHTNESS_DEF 127 + .default_value = BRIGHTNESS_DEF, }, .set = sd_setbrightness, .get = sd_getbrightness, }, -#define SD_CONTRAST 1 { { .id = V4L2_CID_CONTRAST, @@ -77,26 +76,26 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 255, .step = 1, - .default_value = 127, +#define CONTRAST_DEF 127 + .default_value = CONTRAST_DEF, }, .set = sd_setcontrast, .get = sd_getcontrast, }, -#define SD_COLOR 2 { { .id = V4L2_CID_SATURATION, .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Saturation", + .name = "Color", .minimum = 0, .maximum = 255, .step = 1, - .default_value = 127, +#define COLOR_DEF 127 + .default_value = COLOR_DEF, }, .set = sd_setcolors, .get = sd_getcolors, }, -#define SD_FREQ 3 { { .id = V4L2_CID_POWER_LINE_FREQUENCY, @@ -105,7 +104,8 @@ static struct ctrl sd_ctrls[] = { .minimum = 1, .maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */ .step = 1, - .default_value = 1, +#define FREQ_DEF 1 + .default_value = FREQ_DEF, }, .set = sd_setfreq, .get = sd_getfreq, @@ -296,10 +296,10 @@ static int sd_config(struct gspca_dev *gspca_dev, cam->epaddr = 0x02; gspca_dev->cam.cam_mode = vga_mode; gspca_dev->cam.nmodes = sizeof vga_mode / sizeof vga_mode[0]; - sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; - sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; - sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; - sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value; + sd->brightness = BRIGHTNESS_DEF; + sd->contrast = CONTRAST_DEF; + sd->colors = COLOR_DEF; + sd->lightfreq = FREQ_DEF; return 0; } @@ -408,7 +408,7 @@ static void sd_close(struct gspca_dev *gspca_dev) static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { static unsigned char ffd9[] = {0xff, 0xd9}; @@ -518,10 +518,10 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, case V4L2_CID_POWER_LINE_FREQUENCY: switch (menu->index) { case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ - strcpy(menu->name, "50 Hz"); + strcpy((char *) menu->name, "50 Hz"); return 0; case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */ - strcpy(menu->name, "60 Hz"); + strcpy((char *) menu->name, "60 Hz"); return 0; } break; diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c index 113c07106924..f2d033508581 100644 --- a/drivers/media/video/gspca/sunplus.c +++ b/drivers/media/video/gspca/sunplus.c @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 1) -static const char version[] = "2.1.1"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver"); @@ -35,7 +35,7 @@ MODULE_LICENSE("GPL"); struct sd { struct gspca_dev gspca_dev; /* !! must be the first item */ - unsigned char packet[ISO_MAX_SIZE + 128]; + __u8 packet[ISO_MAX_SIZE + 128]; /* !! no more than 128 ff in an ISO packet */ unsigned char brightness; @@ -156,7 +156,7 @@ static struct cam_mode vga_mode2[] = { #define SPCA536_OFFSET_FRAMSEQ 1 /* Initialisation data for the Creative PC-CAM 600 */ -static __u16 spca504_pccam600_init_data[][3] = { +static const __u16 spca504_pccam600_init_data[][3] = { /* {0xa0, 0x0000, 0x0503}, * capture mode */ {0x00, 0x0000, 0x2000}, {0x00, 0x0013, 0x2301}, @@ -186,7 +186,7 @@ static __u16 spca504_pccam600_init_data[][3] = { /* Creative PC-CAM 600 specific open data, sent before using the * generic initialisation data from spca504_open_data. */ -static __u16 spca504_pccam600_open_data[][3] = { +static const __u16 spca504_pccam600_open_data[][3] = { {0x00, 0x0001, 0x2501}, {0x20, 0x0500, 0x0001}, /* snapshot mode */ {0x00, 0x0003, 0x2880}, @@ -195,7 +195,7 @@ static __u16 spca504_pccam600_open_data[][3] = { }; /* Initialisation data for the logitech clicksmart 420 */ -static __u16 spca504A_clicksmart420_init_data[][3] = { +static const __u16 spca504A_clicksmart420_init_data[][3] = { /* {0xa0, 0x0000, 0x0503}, * capture mode */ {0x00, 0x0000, 0x2000}, {0x00, 0x0013, 0x2301}, @@ -226,7 +226,7 @@ static __u16 spca504A_clicksmart420_init_data[][3] = { }; /* clicksmart 420 open data ? */ -static __u16 spca504A_clicksmart420_open_data[][3] = { +static const __u16 spca504A_clicksmart420_open_data[][3] = { {0x00, 0x0001, 0x2501}, {0x20, 0x0502, 0x0000}, {0x06, 0x0000, 0x0000}, @@ -373,7 +373,7 @@ static __u16 spca504A_clicksmart420_open_data[][3] = { {} }; -static unsigned char qtable_creative_pccam[2][64] = { +static const __u8 qtable_creative_pccam[2][64] = { { /* Q-table Y-components */ 0x05, 0x03, 0x03, 0x05, 0x07, 0x0c, 0x0f, 0x12, 0x04, 0x04, 0x04, 0x06, 0x08, 0x11, 0x12, 0x11, @@ -398,7 +398,7 @@ static unsigned char qtable_creative_pccam[2][64] = { * except for one byte. Possibly a typo? * NWG: 18/05/2003. */ -static unsigned char qtable_spca504_default[2][64] = { +static const __u8 qtable_spca504_default[2][64] = { { /* Q-table Y-components */ 0x05, 0x03, 0x03, 0x05, 0x07, 0x0c, 0x0f, 0x12, 0x04, 0x04, 0x04, 0x06, 0x08, 0x11, 0x12, 0x11, @@ -512,7 +512,7 @@ static int reg_read(struct usb_device *dev, } static int write_vector(struct gspca_dev *gspca_dev, - __u16 data[][3]) + const __u16 data[][3]) { struct usb_device *dev = gspca_dev->dev; int ret, i = 0; @@ -534,7 +534,7 @@ static int spca50x_setup_qtable(struct gspca_dev *gspca_dev, unsigned int request, unsigned int ybase, unsigned int cbase, - unsigned char qtable[2][64]) + const __u8 qtable[2][64]) { struct usb_device *dev = gspca_dev->dev; int i, err; @@ -1242,7 +1242,7 @@ static void sd_close(struct gspca_dev *gspca_dev) static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { struct sd *sd = (struct sd *) gspca_dev; @@ -1530,7 +1530,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -1545,7 +1545,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x041e, 0x400b), DVNM("Creative PC-CAM 600")}, {USB_DEVICE(0x041e, 0x4012), DVNM("PC-Cam350")}, {USB_DEVICE(0x041e, 0x4013), DVNM("Creative Pccam750")}, diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index de43118dec7a..4e69a8e16357 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c @@ -26,13 +26,8 @@ #define MODULE_NAME "t613" #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3) -static const char version[] = "2.1.3"; - -struct control_menu_info { - int value; - char name[32]; -}; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; #define MAX_GAMMA 0x10 /* 0 to 15 */ @@ -227,19 +222,16 @@ static struct ctrl sd_ctrls[] = { }, }; -static struct control_menu_info effects_control[] = { - {0, "Normal"}, - {1, "Emboss"}, /* disabled */ - {2, "Monochrome"}, - {3, "Sepia"}, - {4, "Sketch"}, - {5, "Sun Effect"}, /* disabled */ - {6, "Negative"}, +static char *effects_control[] = { + "Normal", + "Emboss", /* disabled */ + "Monochrome", + "Sepia", + "Sketch", + "Sun Effect", /* disabled */ + "Negative", }; -#define NUM_EFFECTS_CONTROL \ - (sizeof(effects_control)/sizeof(effects_control[0])) - static struct cam_mode vga_mode_t16[] = { {V4L2_PIX_FMT_JPEG, 160, 120, 4}, {V4L2_PIX_FMT_JPEG, 176, 144, 3}, @@ -252,7 +244,7 @@ static struct cam_mode vga_mode_t16[] = { #define MAX_EFFECTS 7 /* easily done by soft, this table could be removed, * i keep it here just in case */ -unsigned char effects_table[MAX_EFFECTS][6] = { +static const __u8 effects_table[MAX_EFFECTS][6] = { {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x00}, /* Normal */ {0xa8, 0xc8, 0xc6, 0x52, 0xc0, 0x04}, /* Repujar */ {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x20}, /* Monochrome */ @@ -262,7 +254,7 @@ unsigned char effects_table[MAX_EFFECTS][6] = { {0xa8, 0xc8, 0xc6, 0xd2, 0xc0, 0x40}, /* Negative */ }; -unsigned char gamma_table[MAX_GAMMA][34] = { +static const __u8 gamma_table[MAX_GAMMA][34] = { {0x90, 0x00, 0x91, 0x3e, 0x92, 0x69, 0x93, 0x85, 0x94, 0x95, 0x95, 0xa1, 0x96, 0xae, 0x97, 0xb9, 0x98, 0xc2, 0x99, 0xcb, 0x9a, 0xd4, 0x9b, 0xdb, @@ -345,7 +337,7 @@ unsigned char gamma_table[MAX_GAMMA][34] = { 0xA0, 0xFF} }; -static __u8 tas5130a_sensor_init[][8] = { +static const __u8 tas5130a_sensor_init[][8] = { {0x62, 0x08, 0x63, 0x70, 0x64, 0x1d, 0x60, 0x09}, {0x62, 0x20, 0x63, 0x01, 0x64, 0x02, 0x60, 0x09}, {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09}, @@ -366,22 +358,41 @@ static void t16RegRead(struct usb_device *dev, static void t16RegWrite(struct usb_device *dev, __u16 value, - __u16 index, __u8 *buffer, __u16 len) + __u16 index, + const __u8 *buffer, __u16 len) { - __u8 tmpbuf[70]; - -#ifdef CONFIG_VIDEO_ADV_DEBUG - if (len > sizeof tmpbuf) { - PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow"); + if (buffer == NULL) { + usb_control_msg(dev, + usb_sndctrlpipe(dev, 0), + 0, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + value, index, + NULL, 0, 500); return; } -#endif - memcpy(tmpbuf, buffer, len); - usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), - 0, /* request */ - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - value, index, tmpbuf, len, 500); + if (len < 16) { + __u8 tmpbuf[16]; + + memcpy(tmpbuf, buffer, len); + usb_control_msg(dev, + usb_sndctrlpipe(dev, 0), + 0, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + value, index, + tmpbuf, len, 500); + } else { + __u8 *tmpbuf; + + tmpbuf = kmalloc(len, GFP_KERNEL); + memcpy(tmpbuf, buffer, len); + usb_control_msg(dev, + usb_sndctrlpipe(dev, 0), + 0, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + value, index, + tmpbuf, len, 500); + kfree(tmpbuf); + } } /* this function is called at probe time */ @@ -421,18 +432,18 @@ static int init_default_parameters(struct gspca_dev *gspca_dev) int i = 0; __u8 test_byte; - static unsigned char read_indexs[] = + static const __u8 read_indexs[] = { 0x06, 0x07, 0x0a, 0x0b, 0x66, 0x80, 0x81, 0x8e, 0x8f, 0xa5, 0xa6, 0xa8, 0xbb, 0xbc, 0xc6, 0x00, 0x00 }; - static unsigned char n1[6] = + static const __u8 n1[6] = {0x08, 0x03, 0x09, 0x03, 0x12, 0x04}; - static unsigned char n2[2] = + static const __u8 n2[2] = {0x08, 0x00}; - static unsigned char nset[6] = + static const __u8 nset[6] = { 0x61, 0x68, 0x62, 0xff, 0x60, 0x07 }; - static unsigned char n3[6] = + static const __u8 n3[6] = {0x61, 0x68, 0x65, 0x0a, 0x60, 0x04}; - static unsigned char n4[0x46] = + static const __u8 n4[0x46] = {0x09, 0x01, 0x12, 0x04, 0x66, 0x8a, 0x80, 0x3c, 0x81, 0x22, 0x84, 0x50, 0x8a, 0x78, 0x8b, 0x68, 0x8c, 0x88, 0x8e, 0x33, 0x8f, 0x24, 0xaa, 0xb1, @@ -442,40 +453,40 @@ static int init_default_parameters(struct gspca_dev *gspca_dev) 0x65, 0x0a, 0xbb, 0x86, 0xaf, 0x58, 0xb0, 0x68, 0x87, 0x40, 0x89, 0x2b, 0x8d, 0xff, 0x83, 0x40, 0xac, 0x84, 0xad, 0x86, 0xaf, 0x46}; - static unsigned char nset4[18] = { + static const __u8 nset4[18] = { 0xe0, 0x60, 0xe1, 0xa8, 0xe2, 0xe0, 0xe3, 0x60, 0xe4, 0xa8, 0xe5, 0xe0, 0xe6, 0x60, 0xe7, 0xa8, 0xe8, 0xe0 }; /* ojo puede ser 0xe6 en vez de 0xe9 */ - static unsigned char nset2[20] = { + static const __u8 nset2[20] = { 0xd0, 0xbb, 0xd1, 0x28, 0xd2, 0x10, 0xd3, 0x10, 0xd4, 0xbb, 0xd5, 0x28, 0xd6, 0x1e, 0xd7, 0x27, 0xd8, 0xc8, 0xd9, 0xfc }; - static unsigned char missing[8] = + static const __u8 missing[8] = { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 }; - static unsigned char nset3[18] = { + static const __u8 nset3[18] = { 0xc7, 0x60, 0xc8, 0xa8, 0xc9, 0xe0, 0xca, 0x60, 0xcb, 0xa8, 0xcc, 0xe0, 0xcd, 0x60, 0xce, 0xa8, 0xcf, 0xe0 }; - static unsigned char nset5[4] = + static const __u8 nset5[4] = { 0x8f, 0x24, 0xc3, 0x00 }; /* bright */ - static unsigned char nset6[34] = { + static const __u8 nset6[34] = { 0x90, 0x00, 0x91, 0x1c, 0x92, 0x30, 0x93, 0x43, 0x94, 0x54, 0x95, 0x65, 0x96, 0x75, 0x97, 0x84, 0x98, 0x93, 0x99, 0xa1, 0x9a, 0xb0, 0x9b, 0xbd, 0x9c, 0xca, 0x9d, 0xd8, 0x9e, 0xe5, 0x9f, 0xf2, 0xa0, 0xff }; /* Gamma */ - static unsigned char nset7[4] = + static const __u8 nset7[4] = { 0x66, 0xca, 0xa8, 0xf8 }; /* 50/60 Hz */ - static unsigned char nset9[4] = + static const __u8 nset9[4] = { 0x0b, 0x04, 0x0a, 0x78 }; - static unsigned char nset8[6] = + static const __u8 nset8[6] = { 0xa8, 0xf0, 0xc6, 0x88, 0xc0, 0x00 }; - static unsigned char nset10[6] = + static const __u8 nset10[6] = { 0x0c, 0x03, 0xab, 0x10, 0x81, 0x20 }; t16RegWrite(dev, 0x01, 0x0000, n1, 0x06); @@ -493,31 +504,31 @@ static int init_default_parameters(struct gspca_dev *gspca_dev) t16RegWrite(dev, 0x01, 0x0000, n3, 0x06); t16RegWrite(dev, 0x01, 0x0000, n4, 0x46); t16RegRead(dev, 0x0080, &test_byte, 1); - t16RegWrite(dev, 0x00, 0x2c80, 0x00, 0x0); + t16RegWrite(dev, 0x00, 0x2c80, NULL, 0x0); t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14); t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12); t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12); - t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0); - t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0); - t16RegWrite(dev, 0x00, 0x338e, 0x00, 0x0); + t16RegWrite(dev, 0x00, 0x3880, NULL, 0x0); + t16RegWrite(dev, 0x00, 0x3880, NULL, 0x0); + t16RegWrite(dev, 0x00, 0x338e, NULL, 0x0); t16RegWrite(dev, 0x01, 0x0000, nset5, 0x04); - t16RegWrite(dev, 0x00, 0x00a9, 0x00, 0x0); + t16RegWrite(dev, 0x00, 0x00a9, NULL, 0x0); t16RegWrite(dev, 0x01, 0x0000, nset6, 0x22); - t16RegWrite(dev, 0x00, 0x86bb, 0x00, 0x0); - t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x0); + t16RegWrite(dev, 0x00, 0x86bb, NULL, 0x0); + t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0x0); t16RegWrite(dev, 0x01, 0x0000, missing, 0x08); - t16RegWrite(dev, 0x00, 0x2087, 0x00, 0x0); - t16RegWrite(dev, 0x00, 0x2088, 0x00, 0x0); - t16RegWrite(dev, 0x00, 0x2089, 0x00, 0x0); + t16RegWrite(dev, 0x00, 0x2087, NULL, 0x0); + t16RegWrite(dev, 0x00, 0x2088, NULL, 0x0); + t16RegWrite(dev, 0x00, 0x2089, NULL, 0x0); t16RegWrite(dev, 0x01, 0x0000, nset7, 0x04); t16RegWrite(dev, 0x01, 0x0000, nset10, 0x06); t16RegWrite(dev, 0x01, 0x0000, nset8, 0x06); t16RegWrite(dev, 0x01, 0x0000, nset9, 0x04); - t16RegWrite(dev, 0x00, 0x2880, 0x00, 0x00); + t16RegWrite(dev, 0x00, 0x2880, NULL, 0x00); t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14); t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12); t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12); @@ -530,7 +541,7 @@ static void setbrightness(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; unsigned int brightness; - unsigned char set6[4] = { 0x8f, 0x26, 0xc3, 0x80 }; + __u8 set6[4] = { 0x8f, 0x26, 0xc3, 0x80 }; brightness = sd->brightness; if (brightness < 7) { @@ -548,7 +559,7 @@ static void setflip(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; - unsigned char flipcmd[8] = + __u8 flipcmd[8] = { 0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09 }; if (sd->mirror == 1) @@ -570,9 +581,9 @@ static void seteffect(struct gspca_dev *gspca_dev) } if (sd->effect == 1 || sd->effect == 4) - t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x00); + t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0x00); else - t16RegWrite(dev, 0x00, 0xfaa6, 0x00, 0x00); + t16RegWrite(dev, 0x00, 0xfaa6, NULL, 0x00); } static void setwhitebalance(struct gspca_dev *gspca_dev) @@ -580,7 +591,7 @@ static void setwhitebalance(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; - unsigned char white_balance[8] = + __u8 white_balance[8] = { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 }; if (sd->whitebalance == 1) @@ -613,18 +624,17 @@ static void setcontrast(struct gspca_dev *gspca_dev) else reg_to_write = (0x00a9 + ((contrast - 7) * 0x200)); - t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0); - + t16RegWrite(dev, 0x00, reg_to_write, NULL, 0); } static void setcolors(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; - __u16 reg_to_write = 0x00; + __u16 reg_to_write; reg_to_write = 0xc0bb + sd->colors * 0x100; - t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0); + t16RegWrite(dev, 0x00, reg_to_write, NULL, 0); } static void setgamma(struct gspca_dev *gspca_dev) @@ -635,11 +645,11 @@ static void setsharpness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; - __u16 reg_to_write = 0x00; + __u16 reg_to_write; reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness; - t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0x00); + t16RegWrite(dev, 0x00, reg_to_write, NULL, 0x00); } static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) @@ -655,6 +665,7 @@ static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; + *val = sd->brightness; return *val; } @@ -677,7 +688,6 @@ static int sd_getwhitebalance(struct gspca_dev *gspca_dev, __s32 *val) return *val; } - static int sd_setflip(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; @@ -811,9 +821,9 @@ static int sd_setlowlight(struct gspca_dev *gspca_dev, __s32 val) sd->autogain = val; if (val != 0) - t16RegWrite(dev, 0x00, 0xf48e, 0x00, 0); + t16RegWrite(dev, 0x00, 0xf48e, NULL, 0); else - t16RegWrite(dev, 0x00, 0xb48e, 0x00, 0); + t16RegWrite(dev, 0x00, 0xb48e, NULL, 0); return 0; } @@ -831,12 +841,12 @@ static void sd_start(struct gspca_dev *gspca_dev) int mode; __u8 test_byte; - static __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 }; + static const __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 }; __u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 }; - static __u8 t3[] = + static const __u8 t3[] = { 0xb3, 0x07, 0xb4, 0x00, 0xb5, 0x88, 0xb6, 0x02, 0xb7, 0x06, 0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 }; - static __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 }; + static const __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 }; mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. mode; switch (mode) { @@ -860,16 +870,16 @@ static void sd_start(struct gspca_dev *gspca_dev) t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[1], 0x8); t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[2], 0x8); t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); - t16RegWrite(dev, 0x00, 0x3c80, 0x00, 0x00); + t16RegWrite(dev, 0x00, 0x3c80, NULL, 0x00); /* just in case and to keep sync with logs (for mine) */ t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); - t16RegWrite(dev, 0x00, 0x3c80, 0x00, 0x00); + t16RegWrite(dev, 0x00, 0x3c80, NULL, 0x00); /* just in case and to keep sync with logs (for mine) */ t16RegWrite(dev, 0x01, 0x0000, t1, 4); t16RegWrite(dev, 0x01, 0x0000, t2, 6); t16RegRead(dev, 0x0012, &test_byte, 0x1); t16RegWrite(dev, 0x01, 0x0000, t3, 0x10); - t16RegWrite(dev, 0x00, 0x0013, 0x00, 0x00); + t16RegWrite(dev, 0x00, 0x0013, NULL, 0x00); t16RegWrite(dev, 0x01, 0x0000, t4, 0x4); /* restart on each start, just in case, sometimes regs goes wrong * when using controls from app */ @@ -892,11 +902,11 @@ static void sd_close(struct gspca_dev *gspca_dev) static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso packet length */ { int sof = 0; - static unsigned char ffd9[] = { 0xff, 0xd9 }; + static __u8 ffd9[] = { 0xff, 0xd9 }; if (data[0] == 0x5a) { /* Control Packet, after this came the header again, @@ -935,27 +945,26 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, static int sd_querymenu(struct gspca_dev *gspca_dev, struct v4l2_querymenu *menu) { - memset(menu->name, 0, sizeof menu->name); - switch (menu->id) { case V4L2_CID_POWER_LINE_FREQUENCY: switch (menu->index) { case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ - strcpy(menu->name, "50 Hz"); + strcpy((char *) menu->name, "50 Hz"); return 0; case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */ - strcpy(menu->name, "60 Hz"); + strcpy((char *) menu->name, "60 Hz"); return 0; } break; case V4L2_CID_EFFECTS: - if (menu->index < 0 || menu->index >= NUM_EFFECTS_CONTROL) - return -EINVAL; - strncpy((char *) menu->name, - effects_control[menu->index].name, 32); + if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) { + strncpy((char *) menu->name, + effects_control[menu->index], 32); + return 0; + } break; } - return 0; + return -EINVAL; } /* this function is called at open time */ @@ -966,7 +975,7 @@ static int sd_open(struct gspca_dev *gspca_dev) } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -982,11 +991,10 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x17a1, 0x0128), DVNM("XPX Webcam")}, {} }; - MODULE_DEVICE_TABLE(usb, device_table); /* -- device connect -- */ diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c index 6da5280b5433..8561234d65e2 100644 --- a/drivers/media/video/gspca/tv8532.c +++ b/drivers/media/video/gspca/tv8532.c @@ -22,8 +22,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("TV8532 USB Camera Driver"); @@ -152,7 +152,7 @@ static struct cam_mode sif_mode[] = { #define TV8532_AD_ROWBEGIN_L 0x14 #define TV8532_AD_ROWBEGIN_H 0x15 -static __u32 tv_8532_eeprom_data[] = { +static const __u32 tv_8532_eeprom_data[] = { /* add dataL dataM dataH */ 0x00010001, 0x01018011, 0x02050014, 0x0305001c, 0x040d001e, 0x0505001f, 0x06050519, 0x0705011b, @@ -243,7 +243,7 @@ static int sd_config(struct gspca_dev *gspca_dev, static void tv_8532ReadRegisters(struct gspca_dev *gspca_dev) { struct usb_device *dev = gspca_dev->dev; - __u8 data = 0; + __u8 data; /* __u16 vid, pid; */ reg_r(dev, 0x0001, &data); @@ -275,7 +275,7 @@ static void tv_8532ReadRegisters(struct gspca_dev *gspca_dev) static void tv_8532_setReg(struct gspca_dev *gspca_dev) { struct usb_device *dev = gspca_dev->dev; - __u8 data = 0; + __u8 data; __u8 value[2] = { 0, 0 }; data = ADCBEGINL; @@ -320,7 +320,7 @@ static void tv_8532_setReg(struct gspca_dev *gspca_dev) static void tv_8532_PollReg(struct gspca_dev *gspca_dev) { struct usb_device *dev = gspca_dev->dev; - __u8 data = 0; + __u8 data; int i; /* strange polling from tgc */ @@ -338,9 +338,9 @@ static void tv_8532_PollReg(struct gspca_dev *gspca_dev) static int sd_open(struct gspca_dev *gspca_dev) { struct usb_device *dev = gspca_dev->dev; - __u8 data = 0; - __u8 dataStart = 0; - __u8 value[2] = { 0, 0 }; + __u8 data; + __u8 dataStart; + __u8 value[2]; data = 0x32; reg_w(dev, TV8532_AD_SLOPE, &data, 1); @@ -646,7 +646,7 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -661,7 +661,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x046d, 0x0920), DVNM("QC Express")}, {USB_DEVICE(0x046d, 0x0921), DVNM("Labtec Webcam")}, {USB_DEVICE(0x0545, 0x808b), DVNM("Veo Stingray")}, diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index 8b5f6d17d2a5..4144e11c60bb 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver"); @@ -97,7 +97,7 @@ static struct cam_mode vc0323_mode[] = { {V4L2_PIX_FMT_JPEG, 640, 480, 0}, }; -static __u8 mi1310_socinitVGA_JPG[][4] = { +static const __u8 mi1310_socinitVGA_JPG[][4] = { {0xb0, 0x03, 0x19, 0xcc}, {0xb0, 0x04, 0x02, 0xcc}, {0xb3, 0x00, 0x64, 0xcc}, @@ -249,7 +249,7 @@ static __u8 mi1310_socinitVGA_JPG[][4] = { {0x03, 0x03, 0xc0, 0xbb}, {}, }; -static __u8 mi1310_socinitQVGA_JPG[][4] = { +static const __u8 mi1310_socinitQVGA_JPG[][4] = { {0xb0, 0x03, 0x19, 0xcc}, {0xb0, 0x04, 0x02, 0xcc}, {0xb3, 0x00, 0x64, 0xcc}, {0xb3, 0x00, 0x65, 0xcc}, {0xb3, 0x05, 0x00, 0xcc}, {0xb3, 0x06, 0x00, 0xcc}, @@ -323,14 +323,14 @@ static __u8 mi1310_socinitQVGA_JPG[][4] = { {}, }; -static __u8 mi1320_gamma[17] = { +static const __u8 mi1320_gamma[17] = { 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8, 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff }; -static __u8 mi1320_matrix[9] = { +static const __u8 mi1320_matrix[9] = { 0x54, 0xda, 0x06, 0xf1, 0x50, 0xf4, 0xf7, 0xea, 0x52 }; -static __u8 mi1320_initVGA_data[][4] = { +static const __u8 mi1320_initVGA_data[][4] = { {0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x33, 0xdd}, {0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x33, 0xdd}, {0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x33, 0xdd}, @@ -409,7 +409,7 @@ static __u8 mi1320_initVGA_data[][4] = { {0xb3, 0x5c, 0x01, 0xcc}, {0xb3, 0x01, 0x41, 0xcc}, {} }; -static __u8 mi1320_initQVGA_data[][4] = { +static const __u8 mi1320_initQVGA_data[][4] = { {0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x33, 0xdd}, {0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x33, 0xdd}, {0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x33, 0xdd}, @@ -478,15 +478,15 @@ static __u8 mi1320_initQVGA_data[][4] = { {} }; -static __u8 po3130_gamma[17] = { +static const __u8 po3130_gamma[17] = { 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8, 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff }; -static __u8 po3130_matrix[9] = { +static const __u8 po3130_matrix[9] = { 0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63 }; -static __u8 po3130_initVGA_data[][4] = { +static const __u8 po3130_initVGA_data[][4] = { {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc}, {0xb3, 0x00, 0x04, 0xcc}, {0xb3, 0x00, 0x24, 0xcc}, @@ -569,7 +569,7 @@ static __u8 po3130_initVGA_data[][4] = { {0xb3, 0x5c, 0x00, 0xcc}, {0xb3, 0x01, 0x41, 0xcc}, {} }; -static __u8 po3130_rundata[][4] = { +static const __u8 po3130_rundata[][4] = { {0x00, 0x47, 0x45, 0xaa}, {0x00, 0x48, 0x9b, 0xaa}, {0x00, 0x49, 0x3a, 0xaa}, {0x00, 0x4a, 0x01, 0xaa}, {0x00, 0x44, 0x40, 0xaa}, @@ -584,7 +584,7 @@ static __u8 po3130_rundata[][4] = { {} }; -static __u8 po3130_initQVGA_data[][4] = { +static const __u8 po3130_initQVGA_data[][4] = { {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x09, 0xcc}, {0xb3, 0x00, 0x04, 0xcc}, {0xb3, 0x00, 0x24, 0xcc}, @@ -670,16 +670,16 @@ static __u8 po3130_initQVGA_data[][4] = { {} }; -static __u8 hv7131r_gamma[17] = { +static const __u8 hv7131r_gamma[17] = { /* 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8, * 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff */ 0x04, 0x1a, 0x36, 0x55, 0x6f, 0x87, 0x9d, 0xb0, 0xc1, 0xcf, 0xda, 0xe4, 0xec, 0xf3, 0xf8, 0xfd, 0xff }; -static __u8 hv7131r_matrix[9] = { +static const __u8 hv7131r_matrix[9] = { 0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63 }; -static __u8 hv7131r_initVGA_data[][4] = { +static const __u8 hv7131r_initVGA_data[][4] = { {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc}, {0xb3, 0x00, 0x24, 0xcc}, @@ -722,7 +722,7 @@ static __u8 hv7131r_initVGA_data[][4] = { {} }; -static __u8 hv7131r_initQVGA_data[][4] = { +static const __u8 hv7131r_initQVGA_data[][4] = { {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc}, {0xb3, 0x00, 0x24, 0xcc}, @@ -777,14 +777,14 @@ static __u8 hv7131r_initQVGA_data[][4] = { {} }; -static __u8 ov7660_gamma[17] = { +static const __u8 ov7660_gamma[17] = { 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8, 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff }; -static __u8 ov7660_matrix[9] = { +static const __u8 ov7660_matrix[9] = { 0x5a, 0xf0, 0xf6, 0xf3, 0x57, 0xf6, 0xf3, 0xef, 0x62 }; -static __u8 ov7660_initVGA_data[][4] = { +static const __u8 ov7660_initVGA_data[][4] = { {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc}, @@ -842,7 +842,7 @@ static __u8 ov7660_initVGA_data[][4] = { {0x00, 0x29, 0x3c, 0xaa}, {0xb3, 0x01, 0x45, 0xcc}, {} }; -static __u8 ov7660_initQVGA_data[][4] = { +static const __u8 ov7660_initQVGA_data[][4] = { {0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc}, {0xb3, 0x00, 0x21, 0xcc}, {0xb3, 0x00, 0x26, 0xcc}, @@ -911,26 +911,26 @@ static __u8 ov7660_initQVGA_data[][4] = { {0x00, 0x00, 0x00, 0x00} }; -static __u8 ov7660_50HZ[][4] = { +static const __u8 ov7660_50HZ[][4] = { {0x00, 0x3b, 0x08, 0xaa}, {0x00, 0x9d, 0x40, 0xaa}, {0x00, 0x13, 0xa7, 0xaa}, {0x00, 0x00, 0x00, 0x00} }; -static __u8 ov7660_60HZ[][4] = { +static const __u8 ov7660_60HZ[][4] = { {0x00, 0x3b, 0x00, 0xaa}, {0x00, 0x9e, 0x40, 0xaa}, {0x00, 0x13, 0xa7, 0xaa}, {} }; -static __u8 ov7660_NoFliker[][4] = { +static const __u8 ov7660_NoFliker[][4] = { {0x00, 0x13, 0x87, 0xaa}, {} }; -static __u8 ov7670_initVGA_JPG[][4] = { +static const __u8 ov7670_initVGA_JPG[][4] = { {0xb3, 0x01, 0x05, 0xcc}, {0x00, 0x00, 0x30, 0xdd}, {0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x10, 0xdd}, @@ -1058,7 +1058,7 @@ static __u8 ov7670_initVGA_JPG[][4] = { {}, }; -static __u8 ov7670_initQVGA_JPG[][4] = { +static const __u8 ov7670_initQVGA_JPG[][4] = { {0xb3, 0x01, 0x05, 0xcc}, {0x00, 0x00, 0x30, 0xdd}, {0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x10, 0xdd}, {0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x10, 0xdd}, @@ -1200,7 +1200,7 @@ struct sensor_info { __u8 op; }; -static struct sensor_info sensor_info_data[] = { +static const struct sensor_info sensor_info_data[] = { /* sensorId, I2cAdd, IdAdd, VpId, m1, m2, op */ {SENSOR_HV7131R, 0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01}, {SENSOR_OV7660, 0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05}, @@ -1282,7 +1282,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) int i; __u8 data; __u16 value; - struct sensor_info *ptsensor_info; + const struct sensor_info *ptsensor_info; reg_r(dev, 0xa1, 0xbfcf, &data, 1); PDEBUG(D_PROBE, "check sensor header %d", data); @@ -1309,7 +1309,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) } static __u8 i2c_write(struct usb_device *dev, - __u8 reg, __u8 *val, __u8 size) + __u8 reg, const __u8 *val, __u8 size) { __u8 retbyte; @@ -1341,7 +1341,7 @@ static __u8 i2c_write(struct usb_device *dev, } static void put_tab_to_reg(struct gspca_dev *gspca_dev, - __u8 *tab, __u8 tabsize, __u16 addr) + const __u8 *tab, __u8 tabsize, __u16 addr) { int j; __u16 ad = addr; @@ -1351,7 +1351,7 @@ static void put_tab_to_reg(struct gspca_dev *gspca_dev, } static void usb_exchange(struct gspca_dev *gspca_dev, - __u8 data[][4]) + const __u8 data[][4]) { struct usb_device *dev = gspca_dev->dev; int i = 0; @@ -1511,7 +1511,7 @@ static void setautogain(struct gspca_dev *gspca_dev) static void setlightfreq(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - static __u8 (*ov7660_freq_tb[3])[4] = + static const __u8 (*ov7660_freq_tb[3])[4] = {ov7660_NoFliker, ov7660_50HZ, ov7660_60HZ}; if (sd->sensor != SENSOR_OV7660) @@ -1523,8 +1523,8 @@ static void sd_start(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; /* __u8 tmp2; */ - __u8 *GammaT = NULL; - __u8 *MatrixT = NULL; + const __u8 *GammaT = NULL; + const __u8 *MatrixT = NULL; int mode; /* Assume start use the good resolution from gspca_dev->mode */ @@ -1673,7 +1673,7 @@ static void sd_close(struct gspca_dev *gspca_dev) static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ - unsigned char *data, /* isoc packet */ + __u8 *data, /* isoc packet */ int len) /* iso pkt length */ { struct sd *sd = (struct sd *) gspca_dev; @@ -1739,13 +1739,13 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, case V4L2_CID_POWER_LINE_FREQUENCY: switch (menu->index) { case 0: /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */ - strcpy(menu->name, "NoFliker"); + strcpy((char *) menu->name, "NoFliker"); return 0; case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ - strcpy(menu->name, "50 Hz"); + strcpy((char *) menu->name, "50 Hz"); return 0; case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */ - strcpy(menu->name, "60 Hz"); + strcpy((char *) menu->name, "60 Hz"); return 0; } break; @@ -1754,7 +1754,7 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -1770,7 +1770,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x046d, 0x0892), DVNM("Logitech Orbicam")}, {USB_DEVICE(0x046d, 0x0896), DVNM("Logitech Orbicam")}, {USB_DEVICE(0x0ac8, 0x0321), DVNM("Vimicro generic vc0321")}, diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c index ccd24cb92b3f..878344e4d2ec 100644 --- a/drivers/media/video/gspca/zc3xx.c +++ b/drivers/media/video/gspca/zc3xx.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) -static const char version[] = "2.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) +static const char version[] = "2.1.4"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, " "Serge A. Suchkov <Serge.A.S@tochka.ru>"); @@ -190,7 +190,7 @@ struct usb_action { __u16 idx; }; -static struct usb_action cs2102_Initial[] = { +static const struct usb_action cs2102_Initial[] = { {0xa1, 0x01, 0x0008}, {0xa1, 0x01, 0x0008}, {0xa0, 0x01, 0x0000}, @@ -320,7 +320,7 @@ static struct usb_action cs2102_Initial[] = { {} }; -static struct usb_action cs2102_InitialScale[] = { +static const struct usb_action cs2102_InitialScale[] = { {0xa1, 0x01, 0x0008}, {0xa1, 0x01, 0x0008}, {0xa0, 0x01, 0x0000}, @@ -449,7 +449,7 @@ static struct usb_action cs2102_InitialScale[] = { {0xa0, 0x40, 0x0118}, {} }; -static struct usb_action cs2102_50HZ[] = { +static const struct usb_action cs2102_50HZ[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x0f, 0x008c}, /* 00,0f,8c,aa */ {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */ @@ -474,7 +474,7 @@ static struct usb_action cs2102_50HZ[] = { {0xa0, 0xd0, 0x001f}, /* 00,1f,d0,cc */ {} }; -static struct usb_action cs2102_50HZScale[] = { +static const struct usb_action cs2102_50HZScale[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x0f, 0x0093}, /* 00,0f,93,aa */ {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */ @@ -499,7 +499,7 @@ static struct usb_action cs2102_50HZScale[] = { {0xa0, 0xd0, 0x001f}, /* 00,1f,d0,cc */ {} }; -static struct usb_action cs2102_60HZ[] = { +static const struct usb_action cs2102_60HZ[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x0f, 0x005d}, /* 00,0f,5d,aa */ {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */ @@ -524,7 +524,7 @@ static struct usb_action cs2102_60HZ[] = { {0xa0, 0xd0, 0x00c8}, /* 00,c8,d0,cc */ {} }; -static struct usb_action cs2102_60HZScale[] = { +static const struct usb_action cs2102_60HZScale[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x0f, 0x00b7}, /* 00,0f,b7,aa */ {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */ @@ -549,7 +549,7 @@ static struct usb_action cs2102_60HZScale[] = { {0xa0, 0xe8, 0x001f}, /* 00,1f,e8,cc */ {} }; -static struct usb_action cs2102_NoFliker[] = { +static const struct usb_action cs2102_NoFliker[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x0f, 0x0059}, /* 00,0f,59,aa */ {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */ @@ -574,7 +574,7 @@ static struct usb_action cs2102_NoFliker[] = { {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */ {} }; -static struct usb_action cs2102_NoFlikerScale[] = { +static const struct usb_action cs2102_NoFlikerScale[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x0f, 0x0059}, /* 00,0f,59,aa */ {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */ @@ -601,7 +601,7 @@ static struct usb_action cs2102_NoFlikerScale[] = { }; /* CS2102_KOCOM */ -static struct usb_action cs2102K_Initial[] = { +static const struct usb_action cs2102K_Initial[] = { {0xa0, 0x11, 0x0002}, {0xa0, 0x03, 0x0008}, {0xa0, 0x08, 0x0010}, @@ -860,7 +860,7 @@ static struct usb_action cs2102K_Initial[] = { {} }; -static struct usb_action cs2102K_InitialScale[] = { +static const struct usb_action cs2102K_InitialScale[] = { {0xa0, 0x11, 0x0002}, {0xa0, 0x00, 0x0002}, {0xa0, 0x03, 0x0008}, @@ -1437,7 +1437,7 @@ static struct usb_action cs2102K_InitialScale[] = { {} }; -static struct usb_action gc0305_Initial[] = { /* 640x480 */ +static const struct usb_action gc0305_Initial[] = { /* 640x480 */ {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */ {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */ @@ -1501,7 +1501,7 @@ static struct usb_action gc0305_Initial[] = { /* 640x480 */ {0xa0, 0x03, 0x0113}, /* 01,13,03,cc */ {} }; -static struct usb_action gc0305_InitialScale[] = { /* 320x240 */ +static const struct usb_action gc0305_InitialScale[] = { /* 320x240 */ {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */ {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */ @@ -1564,7 +1564,7 @@ static struct usb_action gc0305_InitialScale[] = { /* 320x240 */ {0xa0, 0x03, 0x0113}, /* 01,13,03,cc */ {} }; -static struct usb_action gc0305_50HZ[] = { +static const struct usb_action gc0305_50HZ[] = { {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ {0xaa, 0x83, 0x0002}, /* 00,83,02,aa */ {0xaa, 0x84, 0x0038}, /* 00,84,38,aa */ /* win: 00,84,ec */ @@ -1587,7 +1587,7 @@ static struct usb_action gc0305_50HZ[] = { /* {0xa0, 0x85, 0x018d}, * 01,8d,85,cc * * if 640x480 */ {} }; -static struct usb_action gc0305_60HZ[] = { +static const struct usb_action gc0305_60HZ[] = { {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */ {0xaa, 0x84, 0x00ec}, /* 00,84,ec,aa */ @@ -1611,7 +1611,7 @@ static struct usb_action gc0305_60HZ[] = { {} }; -static struct usb_action gc0305_NoFliker[] = { +static const struct usb_action gc0305_NoFliker[] = { {0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc */ {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */ @@ -1635,7 +1635,7 @@ static struct usb_action gc0305_NoFliker[] = { }; /* play poker with registers at your own risk !! */ -static struct usb_action hdcs2020xx_Initial[] = { +static const struct usb_action hdcs2020xx_Initial[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x03, 0x0008}, {0xa0, 0x0e, 0x0010}, @@ -1780,7 +1780,7 @@ static struct usb_action hdcs2020xx_Initial[] = { {} }; -static struct usb_action hdcs2020xx_InitialScale[] = { +static const struct usb_action hdcs2020xx_InitialScale[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x03, 0x0008}, {0xa0, 0x0e, 0x0010}, @@ -1922,7 +1922,7 @@ static struct usb_action hdcs2020xx_InitialScale[] = { /* {0xa0, 0x18, 0x00fe}, */ {} }; -static struct usb_action hdcs2020xb_Initial[] = { +static const struct usb_action hdcs2020xb_Initial[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x11, 0x0002}, {0xa0, 0x03, 0x0008}, /* qtable 0x05 */ @@ -2054,7 +2054,7 @@ static struct usb_action hdcs2020xb_Initial[] = { {0xa0, 0x40, 0x0118}, {} }; -static struct usb_action hdcs2020xb_InitialScale[] = { +static const struct usb_action hdcs2020xb_InitialScale[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x00, 0x0002}, {0xa0, 0x03, 0x0008}, @@ -2182,7 +2182,7 @@ static struct usb_action hdcs2020xb_InitialScale[] = { {0xa0, 0x40, 0x0118}, {} }; -static struct usb_action hdcs2020b_50HZ[] = { +static const struct usb_action hdcs2020b_50HZ[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x13, 0x0018}, /* 00,13,18,aa */ {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */ @@ -2203,7 +2203,7 @@ static struct usb_action hdcs2020b_50HZ[] = { {0xa0, 0x2f, 0x001f}, /* 00,1f,2f,cc */ {} }; -static struct usb_action hdcs2020b_60HZ[] = { +static const struct usb_action hdcs2020b_60HZ[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x13, 0x0031}, /* 00,13,31,aa */ {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */ @@ -2224,7 +2224,7 @@ static struct usb_action hdcs2020b_60HZ[] = { {0xa0, 0x2c, 0x001f}, /* 00,1f,2c,cc */ {} }; -static struct usb_action hdcs2020b_NoFliker[] = { +static const struct usb_action hdcs2020b_NoFliker[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x13, 0x0010}, /* 00,13,10,aa */ {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */ @@ -2246,7 +2246,7 @@ static struct usb_action hdcs2020b_NoFliker[] = { {} }; -static struct usb_action hv7131bxx_Initial[] = { +static const struct usb_action hv7131bxx_Initial[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x10, 0x0002}, {0xa0, 0x00, 0x0010}, @@ -2354,7 +2354,7 @@ static struct usb_action hv7131bxx_Initial[] = { {} }; -static struct usb_action hv7131bxx_InitialScale[] = { +static const struct usb_action hv7131bxx_InitialScale[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x00, 0x0002}, {0xa0, 0x00, 0x0010}, @@ -2460,7 +2460,7 @@ static struct usb_action hv7131bxx_InitialScale[] = { {} }; -static struct usb_action hv7131cxx_Initial[] = { +static const struct usb_action hv7131cxx_Initial[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x10, 0x0002}, {0xa0, 0x01, 0x0010}, @@ -2554,7 +2554,7 @@ static struct usb_action hv7131cxx_Initial[] = { {} }; -static struct usb_action hv7131cxx_InitialScale[] = { +static const struct usb_action hv7131cxx_InitialScale[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x00, 0x0002}, /* diff */ @@ -2655,7 +2655,7 @@ static struct usb_action hv7131cxx_InitialScale[] = { {} }; -static struct usb_action icm105axx_Initial[] = { +static const struct usb_action icm105axx_Initial[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x10, 0x0002}, {0xa0, 0x03, 0x0008}, @@ -2832,7 +2832,7 @@ static struct usb_action icm105axx_Initial[] = { {} }; -static struct usb_action icm105axx_InitialScale[] = { +static const struct usb_action icm105axx_InitialScale[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x00, 0x0002}, {0xa0, 0x03, 0x0008}, @@ -3011,7 +3011,7 @@ static struct usb_action icm105axx_InitialScale[] = { {0xa0, 0x40, 0x0118}, {} }; -static struct usb_action icm105a_50HZ[] = { +static const struct usb_action icm105a_50HZ[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */ {0xaa, 0x0c, 0x0020}, /* 00,0c,20,aa */ @@ -3042,7 +3042,7 @@ static struct usb_action icm105a_50HZ[] = { {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ {} }; -static struct usb_action icm105a_50HZScale[] = { +static const struct usb_action icm105a_50HZScale[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */ {0xaa, 0x0c, 0x008c}, /* 00,0c,8c,aa */ @@ -3075,7 +3075,7 @@ static struct usb_action icm105a_50HZScale[] = { {0xa0, 0xc0, 0x01a8}, /* 01,a8,c0,cc */ {} }; -static struct usb_action icm105a_60HZ[] = { +static const struct usb_action icm105a_60HZ[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */ {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */ @@ -3106,7 +3106,7 @@ static struct usb_action icm105a_60HZ[] = { {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ {} }; -static struct usb_action icm105a_60HZScale[] = { +static const struct usb_action icm105a_60HZScale[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */ {0xaa, 0x0c, 0x0008}, /* 00,0c,08,aa */ @@ -3139,7 +3139,7 @@ static struct usb_action icm105a_60HZScale[] = { {0xa0, 0xc0, 0x01a8}, /* 01,a8,c0,cc */ {} }; -static struct usb_action icm105a_NoFliker[] = { +static const struct usb_action icm105a_NoFliker[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */ {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */ @@ -3170,7 +3170,7 @@ static struct usb_action icm105a_NoFliker[] = { {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ {} }; -static struct usb_action icm105a_NoFlikerScale[] = { +static const struct usb_action icm105a_NoFlikerScale[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */ {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */ @@ -3204,7 +3204,7 @@ static struct usb_action icm105a_NoFlikerScale[] = { {} }; -static struct usb_action MC501CB_InitialScale[] = { +static const struct usb_action MC501CB_InitialScale[] = { {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ {0xa0, 0x00, 0x0002}, /* 00,02,00,cc */ {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */ @@ -3324,7 +3324,7 @@ static struct usb_action MC501CB_InitialScale[] = { {} }; -static struct usb_action MC501CB_Initial[] = { /* 320x240 */ +static const struct usb_action MC501CB_Initial[] = { /* 320x240 */ {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ {0xa0, 0x10, 0x0002}, /* 00,02,10,cc */ {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */ @@ -3443,7 +3443,7 @@ static struct usb_action MC501CB_Initial[] = { /* 320x240 */ {} }; -static struct usb_action MC501CB_50HZ[] = { +static const struct usb_action MC501CB_50HZ[] = { {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ {0xaa, 0x36, 0x001d}, /* 00,36,1D,aa */ @@ -3460,7 +3460,7 @@ static struct usb_action MC501CB_50HZ[] = { {} }; -static struct usb_action MC501CB_50HZScale[] = { +static const struct usb_action MC501CB_50HZScale[] = { {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ {0xaa, 0x36, 0x003a}, /* 00,36,3A,aa */ @@ -3477,7 +3477,7 @@ static struct usb_action MC501CB_50HZScale[] = { {} }; -static struct usb_action MC501CB_60HZ[] = { +static const struct usb_action MC501CB_60HZ[] = { {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */ @@ -3494,7 +3494,7 @@ static struct usb_action MC501CB_60HZ[] = { {} }; -static struct usb_action MC501CB_60HZScale[] = { +static const struct usb_action MC501CB_60HZScale[] = { {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */ @@ -3511,7 +3511,7 @@ static struct usb_action MC501CB_60HZScale[] = { {} }; -static struct usb_action MC501CB_NoFliker[] = { +static const struct usb_action MC501CB_NoFliker[] = { {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */ @@ -3528,7 +3528,7 @@ static struct usb_action MC501CB_NoFliker[] = { {} }; -static struct usb_action MC501CB_NoFlikerScale[] = { +static const struct usb_action MC501CB_NoFlikerScale[] = { {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */ @@ -3541,7 +3541,7 @@ static struct usb_action MC501CB_NoFlikerScale[] = { }; /* from zs211.inf - HKR,%OV7620%,Initial - 640x480 */ -static struct usb_action OV7620_mode0[] = { +static const struct usb_action OV7620_mode0[] = { {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ {0xa0, 0x40, 0x0002}, /* 00,02,40,cc */ {0xa0, 0x00, 0x0008}, /* 00,08,00,cc */ @@ -3612,7 +3612,7 @@ static struct usb_action OV7620_mode0[] = { }; /* from zs211.inf - HKR,%OV7620%,InitialScale - 320x240 */ -static struct usb_action OV7620_mode1[] = { +static const struct usb_action OV7620_mode1[] = { {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ {0xa0, 0x50, 0x0002}, /* 00,02,50,cc */ {0xa0, 0x03, 0x0008}, /* 00,08,00,cc */ /* mx change? */ @@ -3683,7 +3683,7 @@ static struct usb_action OV7620_mode1[] = { }; /* from zs211.inf - HKR,%OV7620%\AE,50HZ */ -static struct usb_action OV7620_50HZ[] = { +static const struct usb_action OV7620_50HZ[] = { {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */ {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */ {0xaa, 0x2b, 0x0096}, /* 00,2b,96,aa */ @@ -3702,7 +3702,7 @@ static struct usb_action OV7620_50HZ[] = { }; /* from zs211.inf - HKR,%OV7620%\AE,60HZ */ -static struct usb_action OV7620_60HZ[] = { +static const struct usb_action OV7620_60HZ[] = { {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */ /* (bug in zs211.inf) */ {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */ {0xaa, 0x2b, 0x0000}, /* 00,2b,00,aa */ @@ -3724,7 +3724,7 @@ static struct usb_action OV7620_60HZ[] = { }; /* from zs211.inf - HKR,%OV7620%\AE,NoFliker */ -static struct usb_action OV7620_NoFliker[] = { +static const struct usb_action OV7620_NoFliker[] = { {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */ /* (bug in zs211.inf) */ {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */ {0xaa, 0x2b, 0x0000}, /* 00,2b,00,aa */ @@ -3743,7 +3743,7 @@ static struct usb_action OV7620_NoFliker[] = { {} }; -static struct usb_action ov7630c_Initial[] = { +static const struct usb_action ov7630c_Initial[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x10, 0x0002}, {0xa0, 0x01, 0x0000}, @@ -3900,7 +3900,7 @@ static struct usb_action ov7630c_Initial[] = { {} }; -static struct usb_action ov7630c_InitialScale[] = { +static const struct usb_action ov7630c_InitialScale[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x00, 0x0002}, {0xa0, 0x03, 0x0008}, @@ -4057,7 +4057,7 @@ static struct usb_action ov7630c_InitialScale[] = { {} }; -static struct usb_action pas106b_Initial_com[] = { +static const struct usb_action pas106b_Initial_com[] = { /* Sream and Sensor specific */ {0xa1, 0x01, 0x0010}, /* CMOSSensorSelect */ /* System */ @@ -4071,7 +4071,7 @@ static struct usb_action pas106b_Initial_com[] = { {} }; -static struct usb_action pas106b_Initial[] = { /* 176x144 */ +static const struct usb_action pas106b_Initial[] = { /* 176x144 */ /* JPEG control */ {0xa0, 0x03, 0x0008}, /* ClockSetting */ /* Sream and Sensor specific */ @@ -4189,7 +4189,7 @@ static struct usb_action pas106b_Initial[] = { /* 176x144 */ {} }; -static struct usb_action pas106b_InitialScale[] = { /* 352x288 */ +static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */ /* JPEG control */ {0xa0, 0x03, 0x0008}, /* ClockSetting */ /* Sream and Sensor specific */ @@ -4312,7 +4312,7 @@ static struct usb_action pas106b_InitialScale[] = { /* 352x288 */ {0xa0, 0xff, 0x0018}, /* Frame adjust */ {} }; -static struct usb_action pas106b_50HZ[] = { +static const struct usb_action pas106b_50HZ[] = { {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ {0xa0, 0x06, 0x0191}, /* 01,91,06,cc */ {0xa0, 0x54, 0x0192}, /* 01,92,54,cc */ @@ -4328,7 +4328,7 @@ static struct usb_action pas106b_50HZ[] = { {0xa0, 0x04, 0x01a9}, /* 01,a9,04,cc */ {} }; -static struct usb_action pas106b_60HZ[] = { +static const struct usb_action pas106b_60HZ[] = { {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ {0xa0, 0x06, 0x0191}, /* 01,91,06,cc */ {0xa0, 0x2e, 0x0192}, /* 01,92,2e,cc */ @@ -4344,7 +4344,7 @@ static struct usb_action pas106b_60HZ[] = { {0xa0, 0x04, 0x01a9}, /* 01,a9,04,cc */ {} }; -static struct usb_action pas106b_NoFliker[] = { +static const struct usb_action pas106b_NoFliker[] = { {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ {0xa0, 0x06, 0x0191}, /* 01,91,06,cc */ {0xa0, 0x50, 0x0192}, /* 01,92,50,cc */ @@ -4361,7 +4361,7 @@ static struct usb_action pas106b_NoFliker[] = { {} }; -static struct usb_action pb03303x_Initial[] = { +static const struct usb_action pb03303x_Initial[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x03, 0x0008}, {0xa0, 0x0a, 0x0010}, @@ -4507,7 +4507,7 @@ static struct usb_action pb03303x_Initial[] = { {} }; -static struct usb_action pb03303x_InitialScale[] = { +static const struct usb_action pb03303x_InitialScale[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x03, 0x0008}, {0xa0, 0x0a, 0x0010}, @@ -4655,7 +4655,7 @@ static struct usb_action pb03303x_InitialScale[] = { {0xa0, 0x42, 0x0180}, {} }; -static struct usb_action pb0330xx_Initial[] = { +static const struct usb_action pb0330xx_Initial[] = { {0xa1, 0x01, 0x0008}, {0xa1, 0x01, 0x0008}, {0xa0, 0x01, 0x0000}, @@ -4770,7 +4770,7 @@ static struct usb_action pb0330xx_Initial[] = { {} }; -static struct usb_action pb0330xx_InitialScale[] = { +static const struct usb_action pb0330xx_InitialScale[] = { {0xa1, 0x01, 0x0008}, {0xa1, 0x01, 0x0008}, {0xa0, 0x01, 0x0000}, @@ -4883,7 +4883,7 @@ static struct usb_action pb0330xx_InitialScale[] = { /* {0xa0, 0x00, 0x0007}, */ {} }; -static struct usb_action pb0330_50HZ[] = { +static const struct usb_action pb0330_50HZ[] = { {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */ {0xa0, 0xee, 0x0192}, /* 01,92,ee,cc */ @@ -4899,7 +4899,7 @@ static struct usb_action pb0330_50HZ[] = { {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */ {} }; -static struct usb_action pb0330_50HZScale[] = { +static const struct usb_action pb0330_50HZScale[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */ @@ -4916,7 +4916,7 @@ static struct usb_action pb0330_50HZScale[] = { {0xa0, 0xf8, 0x001f}, /* 00,1f,f8,cc */ {} }; -static struct usb_action pb0330_60HZ[] = { +static const struct usb_action pb0330_60HZ[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */ @@ -4933,7 +4933,7 @@ static struct usb_action pb0330_60HZ[] = { {0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */ {} }; -static struct usb_action pb0330_60HZScale[] = { +static const struct usb_action pb0330_60HZScale[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */ @@ -4950,7 +4950,7 @@ static struct usb_action pb0330_60HZScale[] = { {0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */ {} }; -static struct usb_action pb0330_NoFliker[] = { +static const struct usb_action pb0330_NoFliker[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */ @@ -4967,7 +4967,7 @@ static struct usb_action pb0330_NoFliker[] = { {0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */ {} }; -static struct usb_action pb0330_NoFlikerScale[] = { +static const struct usb_action pb0330_NoFlikerScale[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */ @@ -4986,7 +4986,7 @@ static struct usb_action pb0330_NoFlikerScale[] = { }; /* from oem9.inf - HKR,%PO2030%,Initial - 640x480 - (close to CS2102) */ -static struct usb_action PO2030_mode0[] = { +static const struct usb_action PO2030_mode0[] = { {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ {0xa0, 0x04, 0x0002}, /* 00,02,04,cc */ {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */ @@ -5063,7 +5063,7 @@ static struct usb_action PO2030_mode0[] = { }; /* from oem9.inf - HKR,%PO2030%,InitialScale - 320x240 */ -static struct usb_action PO2030_mode1[] = { +static const struct usb_action PO2030_mode1[] = { {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ {0xa0, 0x10, 0x0002}, /* 00,02,10,cc */ {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */ @@ -5139,7 +5139,7 @@ static struct usb_action PO2030_mode1[] = { {} }; -static struct usb_action PO2030_50HZ[] = { +static const struct usb_action PO2030_50HZ[] = { {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */ {0xaa, 0x1a, 0x0001}, /* 00,1a,01,aa */ {0xaa, 0x1b, 0x000a}, /* 00,1b,0a,aa */ @@ -5161,7 +5161,7 @@ static struct usb_action PO2030_50HZ[] = { {} }; -static struct usb_action PO2030_60HZ[] = { +static const struct usb_action PO2030_60HZ[] = { {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */ {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */ {0xaa, 0x1b, 0x00de}, /* 00,1b,de,aa */ @@ -5183,7 +5183,7 @@ static struct usb_action PO2030_60HZ[] = { {} }; -static struct usb_action PO2030_NoFliker[] = { +static const struct usb_action PO2030_NoFliker[] = { {0xa0, 0x02, 0x0180}, /* 01,80,02,cc */ {0xaa, 0x8d, 0x000d}, /* 00,8d,0d,aa */ {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */ @@ -5195,7 +5195,7 @@ static struct usb_action PO2030_NoFliker[] = { }; /* TEST */ -static struct usb_action tas5130CK_Initial[] = { +static const struct usb_action tas5130CK_Initial[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x01, 0x003b}, {0xa0, 0x0e, 0x003a}, @@ -5398,7 +5398,7 @@ static struct usb_action tas5130CK_Initial[] = { {} }; -static struct usb_action tas5130CK_InitialScale[] = { +static const struct usb_action tas5130CK_InitialScale[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x01, 0x003b}, {0xa0, 0x0e, 0x003a}, @@ -5606,7 +5606,7 @@ static struct usb_action tas5130CK_InitialScale[] = { {} }; -static struct usb_action tas5130cxx_Initial[] = { +static const struct usb_action tas5130cxx_Initial[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x50, 0x0002}, {0xa0, 0x03, 0x0008}, @@ -5695,7 +5695,7 @@ static struct usb_action tas5130cxx_Initial[] = { {0xa0, 0x42, 0x0180}, {} }; -static struct usb_action tas5130cxx_InitialScale[] = { +static const struct usb_action tas5130cxx_InitialScale[] = { {0xa0, 0x01, 0x0000}, {0xa0, 0x01, 0x0000}, {0xa0, 0x40, 0x0002}, @@ -5785,7 +5785,7 @@ static struct usb_action tas5130cxx_InitialScale[] = { {0xa0, 0x42, 0x0180}, {} }; -static struct usb_action tas5130cxx_50HZ[] = { +static const struct usb_action tas5130cxx_50HZ[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */ {0xaa, 0xa4, 0x0063}, /* 00,a4,63,aa */ @@ -5808,7 +5808,7 @@ static struct usb_action tas5130cxx_50HZ[] = { {0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */ {} }; -static struct usb_action tas5130cxx_50HZScale[] = { +static const struct usb_action tas5130cxx_50HZScale[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */ {0xaa, 0xa4, 0x0077}, /* 00,a4,77,aa */ @@ -5831,7 +5831,7 @@ static struct usb_action tas5130cxx_50HZScale[] = { {0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */ {} }; -static struct usb_action tas5130cxx_60HZ[] = { +static const struct usb_action tas5130cxx_60HZ[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */ {0xaa, 0xa4, 0x0036}, /* 00,a4,36,aa */ @@ -5854,7 +5854,7 @@ static struct usb_action tas5130cxx_60HZ[] = { {0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */ {} }; -static struct usb_action tas5130cxx_60HZScale[] = { +static const struct usb_action tas5130cxx_60HZScale[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */ {0xaa, 0xa4, 0x0077}, /* 00,a4,77,aa */ @@ -5877,7 +5877,7 @@ static struct usb_action tas5130cxx_60HZScale[] = { {0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */ {} }; -static struct usb_action tas5130cxx_NoFliker[] = { +static const struct usb_action tas5130cxx_NoFliker[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */ {0xaa, 0xa4, 0x0040}, /* 00,a4,40,aa */ @@ -5901,7 +5901,7 @@ static struct usb_action tas5130cxx_NoFliker[] = { {} }; -static struct usb_action tas5130cxx_NoFlikerScale[] = { +static const struct usb_action tas5130cxx_NoFlikerScale[] = { {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */ {0xaa, 0xa4, 0x0090}, /* 00,a4,90,aa */ @@ -5925,7 +5925,7 @@ static struct usb_action tas5130cxx_NoFlikerScale[] = { {} }; -static struct usb_action tas5130c_vf0250_Initial[] = { +static const struct usb_action tas5130c_vf0250_Initial[] = { {0xa0, 0x01, 0x0000}, /* 00,00,01,cc, */ {0xa0, 0x02, 0x0008}, /* 00,08,02,cc, */ {0xa0, 0x01, 0x0010}, /* 00,10,01,cc, */ @@ -5989,7 +5989,7 @@ static struct usb_action tas5130c_vf0250_Initial[] = { {} }; -static struct usb_action tas5130c_vf0250_InitialScale[] = { +static const struct usb_action tas5130c_vf0250_InitialScale[] = { {0xa0, 0x01, 0x0000}, /* 00,00,01,cc, */ {0xa0, 0x02, 0x0008}, /* 00,08,02,cc, */ {0xa0, 0x01, 0x0010}, /* 00,10,01,cc, */ @@ -6053,7 +6053,7 @@ static struct usb_action tas5130c_vf0250_InitialScale[] = { {} }; /* "50HZ" light frequency banding filter */ -static struct usb_action tas5130c_vf0250_50HZ[] = { +static const struct usb_action tas5130c_vf0250_50HZ[] = { {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ {0xaa, 0x83, 0x0001}, /* 00,83,01,aa */ {0xaa, 0x84, 0x00aa}, /* 00,84,aa,aa */ @@ -6078,7 +6078,7 @@ static struct usb_action tas5130c_vf0250_50HZ[] = { }; /* "50HZScale" light frequency banding filter */ -static struct usb_action tas5130c_vf0250_50HZScale[] = { +static const struct usb_action tas5130c_vf0250_50HZScale[] = { {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ {0xaa, 0x83, 0x0003}, /* 00,83,03,aa */ {0xaa, 0x84, 0x0054}, /* 00,84,54,aa */ @@ -6103,7 +6103,7 @@ static struct usb_action tas5130c_vf0250_50HZScale[] = { }; /* "60HZ" light frequency banding filter */ -static struct usb_action tas5130c_vf0250_60HZ[] = { +static const struct usb_action tas5130c_vf0250_60HZ[] = { {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ {0xaa, 0x83, 0x0001}, /* 00,83,01,aa */ {0xaa, 0x84, 0x0062}, /* 00,84,62,aa */ @@ -6128,7 +6128,7 @@ static struct usb_action tas5130c_vf0250_60HZ[] = { }; /* "60HZScale" light frequency banding ilter */ -static struct usb_action tas5130c_vf0250_60HZScale[] = { +static const struct usb_action tas5130c_vf0250_60HZScale[] = { {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ {0xaa, 0x83, 0x0002}, /* 00,83,02,aa */ {0xaa, 0x84, 0x00c4}, /* 00,84,c4,aa */ @@ -6153,7 +6153,7 @@ static struct usb_action tas5130c_vf0250_60HZScale[] = { }; /* "NoFliker" light frequency banding flter */ -static struct usb_action tas5130c_vf0250_NoFliker[] = { +static const struct usb_action tas5130c_vf0250_NoFliker[] = { {0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc, */ {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */ @@ -6176,7 +6176,7 @@ static struct usb_action tas5130c_vf0250_NoFliker[] = { }; /* "NoFlikerScale" light frequency banding filter */ -static struct usb_action tas5130c_vf0250_NoFlikerScale[] = { +static const struct usb_action tas5130c_vf0250_NoFlikerScale[] = { {0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc, */ {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */ @@ -6272,7 +6272,7 @@ static __u8 i2c_write(struct usb_device *dev, } static void usb_exchange(struct usb_device *dev, - struct usb_action *action) + const struct usb_action *action) { __u8 buffread; @@ -6304,12 +6304,12 @@ static void setmatrix(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; int i; - __u8 *matrix; - static __u8 gc0305_matrix[9] = + const __u8 *matrix; + static const __u8 gc0305_matrix[9] = {0x50, 0xf8, 0xf8, 0xf8, 0x50, 0xf8, 0xf8, 0xf8, 0x50}; - static __u8 ov7620_matrix[9] = + static const __u8 ov7620_matrix[9] = {0x58, 0xf4, 0xf4, 0xf4, 0x58, 0xf4, 0xf4, 0xf4, 0x58}; - static __u8 po2030_matrix[9] = + static const __u8 po2030_matrix[9] = {0x60, 0xf0, 0xf0, 0xf0, 0x60, 0xf0, 0xf0, 0xf0, 0x60}; switch (sd->sensor) { @@ -6361,7 +6361,7 @@ static void setsharpness(struct gspca_dev *gspca_dev) struct usb_device *dev = gspca_dev->dev; int sharpness; __u8 retbyte; - static __u8 sharpness_tb[][2] = { + static const __u8 sharpness_tb[][2] = { {0x02, 0x03}, {0x04, 0x07}, {0x08, 0x0f}, @@ -6380,55 +6380,55 @@ static void setcontrast(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; - __u8 *Tgamma, *Tgradient; + const __u8 *Tgamma, *Tgradient; int g, i, k; - static __u8 kgamma_tb[16] = /* delta for contrast */ + static const __u8 kgamma_tb[16] = /* delta for contrast */ {0x15, 0x0d, 0x0a, 0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}; - static __u8 kgrad_tb[16] = + static const __u8 kgrad_tb[16] = {0x1b, 0x06, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x04}; - static __u8 Tgamma_1[16] = + static const __u8 Tgamma_1[16] = {0x00, 0x00, 0x03, 0x0d, 0x1b, 0x2e, 0x45, 0x5f, 0x79, 0x93, 0xab, 0xc1, 0xd4, 0xe5, 0xf3, 0xff}; - static __u8 Tgradient_1[16] = + static const __u8 Tgradient_1[16] = {0x00, 0x01, 0x05, 0x0b, 0x10, 0x15, 0x18, 0x1a, 0x1a, 0x18, 0x16, 0x14, 0x12, 0x0f, 0x0d, 0x06}; - static __u8 Tgamma_2[16] = + static const __u8 Tgamma_2[16] = {0x01, 0x0c, 0x1f, 0x3a, 0x53, 0x6d, 0x85, 0x9c, 0xb0, 0xc2, 0xd1, 0xde, 0xe9, 0xf2, 0xf9, 0xff}; - static __u8 Tgradient_2[16] = + static const __u8 Tgradient_2[16] = {0x05, 0x0f, 0x16, 0x1a, 0x19, 0x19, 0x17, 0x15, 0x12, 0x10, 0x0e, 0x0b, 0x09, 0x08, 0x06, 0x03}; - static __u8 Tgamma_3[16] = + static const __u8 Tgamma_3[16] = {0x04, 0x16, 0x30, 0x4e, 0x68, 0x81, 0x98, 0xac, 0xbe, 0xcd, 0xda, 0xe4, 0xed, 0xf5, 0xfb, 0xff}; - static __u8 Tgradient_3[16] = + static const __u8 Tgradient_3[16] = {0x0c, 0x16, 0x1b, 0x1c, 0x19, 0x18, 0x15, 0x12, 0x10, 0x0d, 0x0b, 0x09, 0x08, 0x06, 0x05, 0x03}; - static __u8 Tgamma_4[16] = + static const __u8 Tgamma_4[16] = {0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8, 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff}; - static __u8 Tgradient_4[16] = + static const __u8 Tgradient_4[16] = {0x26, 0x22, 0x20, 0x1c, 0x16, 0x13, 0x10, 0x0d, 0x0b, 0x09, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02}; - static __u8 Tgamma_5[16] = + static const __u8 Tgamma_5[16] = {0x20, 0x4b, 0x6e, 0x8d, 0xa3, 0xb5, 0xc5, 0xd2, 0xdc, 0xe5, 0xec, 0xf2, 0xf6, 0xfa, 0xfd, 0xff}; - static __u8 Tgradient_5[16] = + static const __u8 Tgradient_5[16] = {0x37, 0x26, 0x20, 0x1a, 0x14, 0x10, 0x0e, 0x0b, 0x09, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x02}; - static __u8 Tgamma_6[16] = /* ?? was gamma 5 */ + static const __u8 Tgamma_6[16] = /* ?? was gamma 5 */ {0x24, 0x44, 0x64, 0x84, 0x9d, 0xb2, 0xc4, 0xd3, 0xe0, 0xeb, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff}; - static __u8 Tgradient_6[16] = + static const __u8 Tgradient_6[16] = {0x18, 0x20, 0x20, 0x1c, 0x16, 0x13, 0x10, 0x0e, 0x0b, 0x09, 0x07, 0x00, 0x00, 0x00, 0x00, 0x01}; - static __u8 *gamma_tb[] = { + static const __u8 *gamma_tb[] = { 0, Tgamma_1, Tgamma_2, Tgamma_3, Tgamma_4, Tgamma_5, Tgamma_6 }; - static __u8 *gradient_tb[] = { + static const __u8 *gradient_tb[] = { 0, Tgradient_1, Tgradient_2, Tgradient_3, Tgradient_4, Tgradient_5, Tgradient_6 }; @@ -6529,8 +6529,8 @@ static int setlightfreq(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; int i, mode; - struct usb_action *zc3_freq; - static struct usb_action *freq_tb[SENSOR_MAX][6] = { + const struct usb_action *zc3_freq; + static const struct usb_action *freq_tb[SENSOR_MAX][6] = { /* SENSOR_CS2102 0 */ {cs2102_NoFliker, cs2102_NoFlikerScale, cs2102_50HZ, cs2102_50HZScale, @@ -6952,7 +6952,7 @@ static int sd_config(struct gspca_dev *gspca_dev, int sensor; __u8 bsensor; int vga = 1; /* 1: vga, 0: sif */ - static __u8 gamma[SENSOR_MAX] = { + static const __u8 gamma[SENSOR_MAX] = { 5, /* SENSOR_CS2102 0 */ 5, /* SENSOR_CS2102K 1 */ 4, /* SENSOR_GC0305 2 */ @@ -7145,10 +7145,10 @@ static void sd_start(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; - struct usb_action *zc3_init; + const struct usb_action *zc3_init; int mode; __u8 retbyte; - static struct usb_action *init_tb[SENSOR_MAX][2] = { + static const struct usb_action *init_tb[SENSOR_MAX][2] = { {cs2102_InitialScale, cs2102_Initial}, /* 0 */ {cs2102K_InitialScale, cs2102K_Initial}, /* 1 */ {gc0305_Initial, gc0305_InitialScale}, /* 2 */ @@ -7451,13 +7451,13 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, case V4L2_CID_POWER_LINE_FREQUENCY: switch (menu->index) { case 0: /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */ - strcpy(menu->name, "NoFliker"); + strcpy((char *) menu->name, "NoFliker"); return 0; case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ - strcpy(menu->name, "50 Hz"); + strcpy((char *) menu->name, "50 Hz"); return 0; case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */ - strcpy(menu->name, "60 Hz"); + strcpy((char *) menu->name, "60 Hz"); return 0; } break; @@ -7465,7 +7465,7 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, return -EINVAL; } -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = sizeof sd_ctrls / sizeof sd_ctrls[0], @@ -7480,7 +7480,7 @@ static struct sd_desc sd_desc = { }; #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x041e, 0x041e), DVNM("Creative WebCam Live!")}, {USB_DEVICE(0x041e, 0x4017), DVNM("Creative Webcam Mobile PD1090")}, {USB_DEVICE(0x041e, 0x401c), DVNM("Creative NX")}, |