diff options
-rw-r--r-- | drivers/media/platform/vivid/vivid-tpg.c | 12 | ||||
-rw-r--r-- | drivers/media/platform/vivid/vivid-vid-common.c | 8 |
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/media/platform/vivid/vivid-tpg.c b/drivers/media/platform/vivid/vivid-tpg.c index 0d31532f7f42..fd28c6a5f8e9 100644 --- a/drivers/media/platform/vivid/vivid-tpg.c +++ b/drivers/media/platform/vivid/vivid-tpg.c | |||
@@ -188,6 +188,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) | |||
188 | tpg->hmask[2] = ~0; | 188 | tpg->hmask[2] = ~0; |
189 | 189 | ||
190 | switch (fourcc) { | 190 | switch (fourcc) { |
191 | case V4L2_PIX_FMT_RGB332: | ||
191 | case V4L2_PIX_FMT_RGB565: | 192 | case V4L2_PIX_FMT_RGB565: |
192 | case V4L2_PIX_FMT_RGB565X: | 193 | case V4L2_PIX_FMT_RGB565X: |
193 | case V4L2_PIX_FMT_RGB444: | 194 | case V4L2_PIX_FMT_RGB444: |
@@ -274,6 +275,9 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) | |||
274 | } | 275 | } |
275 | 276 | ||
276 | switch (fourcc) { | 277 | switch (fourcc) { |
278 | case V4L2_PIX_FMT_RGB332: | ||
279 | tpg->twopixelsize[0] = 2; | ||
280 | break; | ||
277 | case V4L2_PIX_FMT_RGB565: | 281 | case V4L2_PIX_FMT_RGB565: |
278 | case V4L2_PIX_FMT_RGB565X: | 282 | case V4L2_PIX_FMT_RGB565X: |
279 | case V4L2_PIX_FMT_RGB444: | 283 | case V4L2_PIX_FMT_RGB444: |
@@ -717,6 +721,11 @@ static void precalculate_color(struct tpg_data *tpg, int k) | |||
717 | b = (b * 219) / 255 + (16 << 4); | 721 | b = (b * 219) / 255 + (16 << 4); |
718 | } | 722 | } |
719 | switch (tpg->fourcc) { | 723 | switch (tpg->fourcc) { |
724 | case V4L2_PIX_FMT_RGB332: | ||
725 | r >>= 9; | ||
726 | g >>= 9; | ||
727 | b >>= 10; | ||
728 | break; | ||
720 | case V4L2_PIX_FMT_RGB565: | 729 | case V4L2_PIX_FMT_RGB565: |
721 | case V4L2_PIX_FMT_RGB565X: | 730 | case V4L2_PIX_FMT_RGB565X: |
722 | r >>= 7; | 731 | r >>= 7; |
@@ -890,6 +899,9 @@ static void gen_twopix(struct tpg_data *tpg, | |||
890 | buf[0][0] = b_v; | 899 | buf[0][0] = b_v; |
891 | buf[0][2] = g_u; | 900 | buf[0][2] = g_u; |
892 | break; | 901 | break; |
902 | case V4L2_PIX_FMT_RGB332: | ||
903 | buf[0][offset] = (r_y << 5) | (g_u << 2) | b_v; | ||
904 | break; | ||
893 | case V4L2_PIX_FMT_RGB565: | 905 | case V4L2_PIX_FMT_RGB565: |
894 | buf[0][offset] = (g_u << 5) | b_v; | 906 | buf[0][offset] = (g_u << 5) | b_v; |
895 | buf[0][offset + 1] = (r_y << 3) | (g_u >> 3); | 907 | buf[0][offset + 1] = (r_y << 3) | (g_u >> 3); |
diff --git a/drivers/media/platform/vivid/vivid-vid-common.c b/drivers/media/platform/vivid/vivid-vid-common.c index aa8985054405..9e8c06a102e9 100644 --- a/drivers/media/platform/vivid/vivid-vid-common.c +++ b/drivers/media/platform/vivid/vivid-vid-common.c | |||
@@ -171,6 +171,14 @@ struct vivid_fmt vivid_formats[] = { | |||
171 | .buffers = 1, | 171 | .buffers = 1, |
172 | }, | 172 | }, |
173 | { | 173 | { |
174 | .name = "RGB332", | ||
175 | .fourcc = V4L2_PIX_FMT_RGB332, /* rrrgggbb */ | ||
176 | .vdownsampling = { 1 }, | ||
177 | .bit_depth = { 8 }, | ||
178 | .planes = 1, | ||
179 | .buffers = 1, | ||
180 | }, | ||
181 | { | ||
174 | .name = "RGB565 (LE)", | 182 | .name = "RGB565 (LE)", |
175 | .fourcc = V4L2_PIX_FMT_RGB565, /* gggbbbbb rrrrrggg */ | 183 | .fourcc = V4L2_PIX_FMT_RGB565, /* gggbbbbb rrrrrggg */ |
176 | .vdownsampling = { 1 }, | 184 | .vdownsampling = { 1 }, |