Commit b77c0046 authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mauro Carvalho Chehab

V4L/DVB (8872): gspca: Bad image format and offset with rev072a of spca561.

- have 2 pixfmt tables
- offset of Bayer frames at 16 instead of 20.
Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent bf2a2202
...@@ -73,7 +73,7 @@ struct sd { ...@@ -73,7 +73,7 @@ struct sd {
#define AG_CNT_START 13 #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, {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
.bytesperline = 160, .bytesperline = 160,
.sizeimage = 160 * 120, .sizeimage = 160 * 120,
...@@ -96,6 +96,29 @@ static struct v4l2_pix_format sif_mode[] = { ...@@ -96,6 +96,29 @@ static struct v4l2_pix_format sif_mode[] = {
.priv = 0}, .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 * Initialization data
* I'm not very sure how to split initialization from open 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, ...@@ -546,10 +569,15 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam = &gspca_dev->cam; cam = &gspca_dev->cam;
cam->epaddr = 0x01; cam->epaddr = 0x01;
gspca_dev->nbalt = 7 + 1; /* choose alternate 7 first */ 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; 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->brightness = BRIGHTNESS_DEF;
sd->contrast = CONTRAST_DEF; sd->contrast = CONTRAST_DEF;
sd->white = WHITE_DEF; sd->white = WHITE_DEF;
...@@ -833,8 +861,9 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -833,8 +861,9 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
frame, data, len); frame, data, len);
} else { } else {
/* raw bayer (with a header, which we skip) */ /* raw bayer (with a header, which we skip) */
data += 20; /*fixme: is this specific to the rev012a? */
len -= 20; data += 16;
len -= 16;
gspca_frame_add(gspca_dev, FIRST_PACKET, gspca_frame_add(gspca_dev, FIRST_PACKET,
frame, data, len); frame, data, len);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment