diff options
Diffstat (limited to 'linux/drivers/media/video/gspca/spca508.c')
-rw-r--r-- | linux/drivers/media/video/gspca/spca508.c | 96 |
1 files changed, 58 insertions, 38 deletions
diff --git a/linux/drivers/media/video/gspca/spca508.c b/linux/drivers/media/video/gspca/spca508.c index 0b8190ef6..a70d51117 100644 --- a/linux/drivers/media/video/gspca/spca508.c +++ b/linux/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, 5) +static const char version[] = "2.1.5"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver"); @@ -53,27 +53,43 @@ static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); static int sd_getbrightness(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 = 0x80, +#define BRIGHTNESS_DEF 128 + .default_value = BRIGHTNESS_DEF, }, .set = sd_setbrightness, .get = sd_getbrightness, }, }; -static struct cam_mode sif_mode[] = { - {V4L2_PIX_FMT_YUYV, 160, 120, 3}, - {V4L2_PIX_FMT_YUYV, 176, 144, 2}, - {V4L2_PIX_FMT_YUYV, 320, 240, 1}, - {V4L2_PIX_FMT_YUYV, 352, 288, 0}, +static struct v4l2_pix_format sif_mode[] = { + {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 160 * 2, + .sizeimage = 160 * 120 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 3}, + {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 176 * 2, + .sizeimage = 176 * 144 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 2}, + {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 320 * 2, + .sizeimage = 320 * 240 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 1}, + {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + .bytesperline = 352 * 2, + .sizeimage = 352 * 288 * 2, + .colorspace = V4L2_COLORSPACE_SRGB, + .priv = 0}, }; /* Frame packet header offsets for the spca508 */ @@ -92,7 +108,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 */ @@ -604,23 +620,23 @@ static __u16 spca508_init_data[][3] = /* Video drop enable, ISO streaming disable */ /* 53252 2165 */ /* UNKNOWN DIRECTION (URB_FUNCTION_SELECT_INTERFACE: (ALT=0) ) */ - {0, 0} + {} }; #if 0 /* * Data to initialize the camera using the internal CCD */ -static __u16 spca508_open_data[][3] = { +static const __u16 spca508_open_data[][3] = { /* line bmRequest,value,index */ - {0, 0} + {} }; #endif /* * 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 */ @@ -704,7 +720,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}, @@ -784,11 +800,10 @@ static __u16 spca508_sightcam_init_data[][3] = { /*542 */ {0x0040, 0x8652}, /*543 */ {0x004c, 0x8653}, /*544 */ {0x0040, 0x8654}, - - {0, 0} + {} }; -static __u16 spca508_sightcam2_init_data[][3] = { +static const __u16 spca508_sightcam2_init_data[][3] = { #if 1 /* 35 */ {0x0020, 0x8112}, @@ -1137,7 +1152,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 */ @@ -1479,7 +1494,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; @@ -1507,6 +1522,13 @@ static int sd_config(struct gspca_dev *gspca_dev, vendor = id->idVendor; product = id->idProduct; switch (vendor) { + case 0x0130: /* Clone webcam */ +/* switch (product) { */ +/* case 0x0130: */ + sd->subtype = HamaUSBSightcam; /* same as Hama 0010 */ +/* break; */ +/* } */ + break; case 0x041e: /* Creative cameras */ /* switch (product) { */ /* case 0x4018: */ @@ -1547,30 +1569,27 @@ static int sd_config(struct gspca_dev *gspca_dev, break; } - /* Read from global register the USB product and vendor IDs, just to */ - /* prove that we can communicate with the device. This works, which */ - /* confirms at we are communicating properly and that the device */ - /* is a 508. */ + /* Read from global register the USB product and vendor IDs, just to + * prove that we can communicate with the device. This works, which + * confirms at we are communicating properly and that the device + * is a 508. */ data1 = reg_read(dev, 0x8104); data2 = reg_read(dev, 0x8105); - PDEBUG(D_PROBE, - "Read from GLOBAL: USB Vendor ID 0x%02x%02x", data2, data1); + PDEBUG(D_PROBE, "Webcam Vendor ID: 0x%02x%02x", data2, data1); data1 = reg_read(dev, 0x8106); data2 = reg_read(dev, 0x8107); - PDEBUG(D_PROBE, - "Read from GLOBAL: USB Product ID 0x%02x%02x", data2, data1); + PDEBUG(D_PROBE, "Webcam Product ID: 0x%02x%02x", data2, data1); data1 = reg_read(dev, 0x8621); - PDEBUG(D_PROBE, - "Read from GLOBAL: Window 1 average luminance %d", data1); + PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1); cam = &gspca_dev->cam; cam->dev_name = (char *) id->driver_info; cam->epaddr = 0x01; cam->cam_mode = sif_mode; - cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; - sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; + cam->nmodes = ARRAY_SIZE(sif_mode); + sd->brightness = BRIGHTNESS_DEF; switch (sd->subtype) { case ViewQuestVQ110: @@ -1610,7 +1629,7 @@ static void sd_start(struct gspca_dev *gspca_dev) { int mode; - mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; reg_write(gspca_dev->dev, 0x8500, mode); switch (mode) { case 0: @@ -1675,7 +1694,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; @@ -1719,7 +1738,7 @@ static void setbrightness(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; __u8 brightness = sd->brightness; -/* MX seem contrast */ + /* MX seem contrast */ reg_write(gspca_dev->dev, 0x8651, brightness); reg_write(gspca_dev->dev, 0x8652, brightness); reg_write(gspca_dev->dev, 0x8653, brightness); @@ -1753,7 +1772,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), @@ -1768,7 +1787,8 @@ 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(0x0130, 0x0130), DVNM("Clone Digital Webcam 11043")}, {USB_DEVICE(0x041e, 0x4018), DVNM("Creative Webcam Vista (PD1100)")}, {USB_DEVICE(0x0461, 0x0815), DVNM("Micro Innovation IC200")}, {USB_DEVICE(0x0733, 0x0110), DVNM("ViewQuest VQ110")}, |