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

V4L/DVB (8158): gspca: minor changes

main: V4L2_PIX_FMT_SPCA501 is compressed (thanks to Hans de Goede)
main: return 0 when no change on vidioc_s_fmt_cap (thanks to Hans de Goede)
pac207: cleanup
Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 6a7eba24
...@@ -316,6 +316,7 @@ static int gspca_is_compressed(__u32 format) ...@@ -316,6 +316,7 @@ static int gspca_is_compressed(__u32 format)
switch (format) { switch (format) {
case V4L2_PIX_FMT_MJPEG: case V4L2_PIX_FMT_MJPEG:
case V4L2_PIX_FMT_JPEG: case V4L2_PIX_FMT_JPEG:
case V4L2_PIX_FMT_SPCA561:
return 1; return 1;
} }
return 0; return 0;
...@@ -369,12 +370,12 @@ static __u32 get_v4l2_depth(__u32 pixfmt) ...@@ -369,12 +370,12 @@ static __u32 get_v4l2_depth(__u32 pixfmt)
case V4L2_PIX_FMT_YYUV: /* 'YYUV' */ case V4L2_PIX_FMT_YYUV: /* 'YYUV' */
return 16; return 16;
case V4L2_PIX_FMT_YUV420: /* 'YU12' planar 4.2.0 */ case V4L2_PIX_FMT_YUV420: /* 'YU12' planar 4.2.0 */
case V4L2_PIX_FMT_SPCA501: /* 'S501' YUYV per line */
return 12; return 12;
case V4L2_PIX_FMT_MJPEG: case V4L2_PIX_FMT_MJPEG:
case V4L2_PIX_FMT_JPEG: case V4L2_PIX_FMT_JPEG:
case V4L2_PIX_FMT_SBGGR8: /* 'BA81' Bayer */ case V4L2_PIX_FMT_SBGGR8: /* 'BA81' Bayer */
case V4L2_PIX_FMT_SN9C10X: /* 'S910' SN9C10x compression */ case V4L2_PIX_FMT_SN9C10X: /* 'S910' SN9C10x compression */
case V4L2_PIX_FMT_SPCA501: /* 'S501' YUYV per line */
case V4L2_PIX_FMT_SPCA561: /* 'S561' compressed BGGR bayer */ case V4L2_PIX_FMT_SPCA561: /* 'S561' compressed BGGR bayer */
return 8; return 8;
} }
...@@ -913,8 +914,10 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv, ...@@ -913,8 +914,10 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv,
goto out; goto out;
} }
if (ret == gspca_dev->curr_mode) if (ret == gspca_dev->curr_mode) {
ret = 0;
goto out; /* same mode */ goto out; /* same mode */
}
if (gspca_dev->streaming) { if (gspca_dev->streaming) {
ret = -EBUSY; ret = -EBUSY;
......
...@@ -492,7 +492,7 @@ static void pac207_do_auto_gain(struct gspca_dev *gspca_dev) ...@@ -492,7 +492,7 @@ static void pac207_do_auto_gain(struct gspca_dev *gspca_dev)
} }
static unsigned char *pac207_find_sof(struct gspca_dev *gspca_dev, static unsigned char *pac207_find_sof(struct gspca_dev *gspca_dev,
unsigned char *m, int len) unsigned char *m, int len)
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
int i; int i;
...@@ -518,7 +518,9 @@ static unsigned char *pac207_find_sof(struct gspca_dev *gspca_dev, ...@@ -518,7 +518,9 @@ static unsigned char *pac207_find_sof(struct gspca_dev *gspca_dev,
} }
static int pac207_decompress_row(struct gspca_dev *gspca_dev, static int pac207_decompress_row(struct gspca_dev *gspca_dev,
struct gspca_frame *f, unsigned char *cdata, int len) struct gspca_frame *f,
__u8 *cdata,
int len)
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
struct pac207_decoder_state *decoder_state = &sd->decoder_state; struct pac207_decoder_state *decoder_state = &sd->decoder_state;
...@@ -667,10 +669,10 @@ static int pac207_decode_frame_data(struct gspca_dev *gspca_dev, ...@@ -667,10 +669,10 @@ static int pac207_decode_frame_data(struct gspca_dev *gspca_dev,
case LINE_HEADER2: case LINE_HEADER2:
decoder_state->line_marker |= data[0]; decoder_state->line_marker |= data[0];
switch (decoder_state->line_marker) { switch (decoder_state->line_marker) {
case 0x0FF0: case 0x0ff0:
decoder_state->line_state = LINE_UNCOMPRESSED; decoder_state->line_state = LINE_UNCOMPRESSED;
break; break;
case 0x1EE1: case 0x1ee1:
decoder_state->line_state = LINE_COMPRESSED; decoder_state->line_state = LINE_COMPRESSED;
break; break;
default: default:
......
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