aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/vivi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/vivi.c')
-rw-r--r--drivers/media/video/vivi.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index 2fddba6d5b39..7d7e51def461 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -149,6 +149,16 @@ static struct vivi_fmt formats[] = {
149 .fourcc = V4L2_PIX_FMT_RGB565X, /* rrrrrggg gggbbbbb */ 149 .fourcc = V4L2_PIX_FMT_RGB565X, /* rrrrrggg gggbbbbb */
150 .depth = 16, 150 .depth = 16,
151 }, 151 },
152 {
153 .name = "RGB555 (LE)",
154 .fourcc = V4L2_PIX_FMT_RGB555, /* gggbbbbb arrrrrgg */
155 .depth = 16,
156 },
157 {
158 .name = "RGB555 (BE)",
159 .fourcc = V4L2_PIX_FMT_RGB555X, /* arrrrrgg gggbbbbb */
160 .depth = 16,
161 },
152}; 162};
153 163
154static struct vivi_fmt *get_format(struct v4l2_format *f) 164static struct vivi_fmt *get_format(struct v4l2_format *f)
@@ -335,6 +345,30 @@ static void gen_twopix(struct vivi_fh *fh, unsigned char *buf, int colorpos)
335 break; 345 break;
336 } 346 }
337 break; 347 break;
348 case V4L2_PIX_FMT_RGB555:
349 switch (color) {
350 case 0:
351 case 2:
352 *p = (g_u << 5) | b_v;
353 break;
354 case 1:
355 case 3:
356 *p = (r_y << 2) | (g_u >> 3);
357 break;
358 }
359 break;
360 case V4L2_PIX_FMT_RGB555X:
361 switch (color) {
362 case 0:
363 case 2:
364 *p = (r_y << 2) | (g_u >> 3);
365 break;
366 case 1:
367 case 3:
368 *p = (g_u << 5) | b_v;
369 break;
370 }
371 break;
338 } 372 }
339 } 373 }
340} 374}
@@ -818,6 +852,12 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
818 g >>= 2; 852 g >>= 2;
819 b >>= 3; 853 b >>= 3;
820 break; 854 break;
855 case V4L2_PIX_FMT_RGB555:
856 case V4L2_PIX_FMT_RGB555X:
857 r >>= 3;
858 g >>= 3;
859 b >>= 3;
860 break;
821 } 861 }
822 862
823 if (is_yuv) { 863 if (is_yuv) {