aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-09-04 15:22:56 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-09-04 15:22:56 -0400
commitb77c0046a63e7aa87152f9978cf7c46e7bead7fc (patch)
tree2512c721dead2efd40bf4d5c11f398f8eb83a5b2
parentbf2a2202f75cda679303f09d150f9549f9835953 (diff)
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: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/gspca/spca561.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index 2ca509daf0b4..d2f689e366af 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -73,7 +73,7 @@ struct sd {
73#define AG_CNT_START 13 73#define AG_CNT_START 13
74}; 74};
75 75
76static struct v4l2_pix_format sif_mode[] = { 76static struct v4l2_pix_format sif_012a_mode[] = {
77 {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE, 77 {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
78 .bytesperline = 160, 78 .bytesperline = 160,
79 .sizeimage = 160 * 120, 79 .sizeimage = 160 * 120,
@@ -96,6 +96,29 @@ static struct v4l2_pix_format sif_mode[] = {
96 .priv = 0}, 96 .priv = 0},
97}; 97};
98 98
99static struct v4l2_pix_format sif_072a_mode[] = {
100 {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
101 .bytesperline = 160,
102 .sizeimage = 160 * 120,
103 .colorspace = V4L2_COLORSPACE_SRGB,
104 .priv = 3},
105 {176, 144, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
106 .bytesperline = 176,
107 .sizeimage = 176 * 144,
108 .colorspace = V4L2_COLORSPACE_SRGB,
109 .priv = 2},
110 {320, 240, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
111 .bytesperline = 320,
112 .sizeimage = 320 * 240,
113 .colorspace = V4L2_COLORSPACE_SRGB,
114 .priv = 1},
115 {352, 288, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
116 .bytesperline = 352,
117 .sizeimage = 352 * 288,
118 .colorspace = V4L2_COLORSPACE_SRGB,
119 .priv = 0},
120};
121
99/* 122/*
100 * Initialization data 123 * Initialization data
101 * I'm not very sure how to split initialization from open data 124 * 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 cam = &gspca_dev->cam; 569 cam = &gspca_dev->cam;
547 cam->epaddr = 0x01; 570 cam->epaddr = 0x01;
548 gspca_dev->nbalt = 7 + 1; /* choose alternate 7 first */ 571 gspca_dev->nbalt = 7 + 1; /* choose alternate 7 first */
549 cam->cam_mode = sif_mode;
550 cam->nmodes = ARRAY_SIZE(sif_mode);
551 572
552 sd->chip_revision = id->driver_info; 573 sd->chip_revision = id->driver_info;
574 if (sd->chip_revision == Rev012A) {
575 cam->cam_mode = sif_012a_mode;
576 cam->nmodes = ARRAY_SIZE(sif_012a_mode);
577 } else {
578 cam->cam_mode = sif_072a_mode;
579 cam->nmodes = ARRAY_SIZE(sif_072a_mode);
580 }
553 sd->brightness = BRIGHTNESS_DEF; 581 sd->brightness = BRIGHTNESS_DEF;
554 sd->contrast = CONTRAST_DEF; 582 sd->contrast = CONTRAST_DEF;
555 sd->white = WHITE_DEF; 583 sd->white = WHITE_DEF;
@@ -833,8 +861,9 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
833 frame, data, len); 861 frame, data, len);
834 } else { 862 } else {
835 /* raw bayer (with a header, which we skip) */ 863 /* raw bayer (with a header, which we skip) */
836 data += 20; 864/*fixme: is this specific to the rev012a? */
837 len -= 20; 865 data += 16;
866 len -= 16;
838 gspca_frame_add(gspca_dev, FIRST_PACKET, 867 gspca_frame_add(gspca_dev, FIRST_PACKET,
839 frame, data, len); 868 frame, data, len);
840 } 869 }