[media] v4l2-tpg: add Y10 and Y12 support
authorHans Verkuil <hansverk@cisco.com>
Fri, 15 Sep 2017 14:51:44 +0000 (11:51 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 4 Oct 2017 19:58:39 +0000 (16:58 -0300)
Support the 10 and 12 bit luma formats.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c

index a772976..f96968c 100644 (file)
@@ -238,6 +238,8 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
                tpg->color_enc = TGP_COLOR_ENC_RGB;
                break;
        case V4L2_PIX_FMT_GREY:
+       case V4L2_PIX_FMT_Y10:
+       case V4L2_PIX_FMT_Y12:
        case V4L2_PIX_FMT_Y16:
        case V4L2_PIX_FMT_Y16_BE:
                tpg->color_enc = TGP_COLOR_ENC_LUMA;
@@ -352,6 +354,8 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
        case V4L2_PIX_FMT_YUV444:
        case V4L2_PIX_FMT_YUV555:
        case V4L2_PIX_FMT_YUV565:
+       case V4L2_PIX_FMT_Y10:
+       case V4L2_PIX_FMT_Y12:
        case V4L2_PIX_FMT_Y16:
        case V4L2_PIX_FMT_Y16_BE:
                tpg->twopixelsize[0] = 2 * 2;
@@ -1056,6 +1060,14 @@ static void gen_twopix(struct tpg_data *tpg,
        case V4L2_PIX_FMT_GREY:
                buf[0][offset] = r_y_h;
                break;
+       case V4L2_PIX_FMT_Y10:
+               buf[0][offset] = (r_y_h << 2) & 0xff;
+               buf[0][offset+1] = r_y_h >> 6;
+               break;
+       case V4L2_PIX_FMT_Y12:
+               buf[0][offset] = (r_y_h << 4) & 0xff;
+               buf[0][offset+1] = r_y_h >> 4;
+               break;
        case V4L2_PIX_FMT_Y16:
                /*
                 * Ideally both bytes should be set to r_y_h, but then you won't