V4L/DVB (8872): gspca: Bad image format and offset with rev072a of spca561.
authorJean-Francois Moine <moinejf@free.fr>
Thu, 4 Sep 2008 19:22:56 +0000 (16:22 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 4 Sep 2008 19:22:56 +0000 (16:22 -0300)
- have 2 pixfmt tables
- offset of Bayer frames at 16 instead of 20.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/spca561.c

index 2ca509daf0b4033bd50138f5d56455d977692aa4..d2f689e366af78da7c48e8fb803c8c1d26d6a797 100644 (file)
@@ -73,7 +73,7 @@ struct sd {
 #define AG_CNT_START 13
 };
 
-static struct v4l2_pix_format sif_mode[] = {
+static struct v4l2_pix_format sif_012a_mode[] = {
        {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
                .bytesperline = 160,
                .sizeimage = 160 * 120,
@@ -96,6 +96,29 @@ static struct v4l2_pix_format sif_mode[] = {
                .priv = 0},
 };
 
+static struct v4l2_pix_format sif_072a_mode[] = {
+       {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
+               .bytesperline = 160,
+               .sizeimage = 160 * 120,
+               .colorspace = V4L2_COLORSPACE_SRGB,
+               .priv = 3},
+       {176, 144, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
+               .bytesperline = 176,
+               .sizeimage = 176 * 144,
+               .colorspace = V4L2_COLORSPACE_SRGB,
+               .priv = 2},
+       {320, 240, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
+               .bytesperline = 320,
+               .sizeimage = 320 * 240,
+               .colorspace = V4L2_COLORSPACE_SRGB,
+               .priv = 1},
+       {352, 288, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
+               .bytesperline = 352,
+               .sizeimage = 352 * 288,
+               .colorspace = V4L2_COLORSPACE_SRGB,
+               .priv = 0},
+};
+
 /*
  * Initialization data
  * I'm not very sure how to split initialization from open data
@@ -546,10 +569,15 @@ static int sd_config(struct gspca_dev *gspca_dev,
        cam = &gspca_dev->cam;
        cam->epaddr = 0x01;
        gspca_dev->nbalt = 7 + 1;       /* choose alternate 7 first */
-       cam->cam_mode = sif_mode;
-       cam->nmodes = ARRAY_SIZE(sif_mode);
 
        sd->chip_revision = id->driver_info;
+       if (sd->chip_revision == Rev012A) {
+               cam->cam_mode = sif_012a_mode;
+               cam->nmodes = ARRAY_SIZE(sif_012a_mode);
+       } else {
+               cam->cam_mode = sif_072a_mode;
+               cam->nmodes = ARRAY_SIZE(sif_072a_mode);
+       }
        sd->brightness = BRIGHTNESS_DEF;
        sd->contrast = CONTRAST_DEF;
        sd->white = WHITE_DEF;
@@ -833,8 +861,9 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
                                        frame, data, len);
                } else {
                        /* raw bayer (with a header, which we skip) */
-                       data += 20;
-                       len -= 20;
+/*fixme: is this specific to the rev012a? */
+                       data += 16;
+                       len -= 16;
                        gspca_frame_add(gspca_dev, FIRST_PACKET,
                                                frame, data, len);
                }