OSDN Git Service

media: ti-vpe: cal: add vc and datatype fields to cal_ctx
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Mon, 14 Jun 2021 11:23:30 +0000 (13:23 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 12 Jul 2021 11:14:50 +0000 (13:14 +0200)
In preparation for supporting multiple virtual channels and datatypes,
add vc and datatype fields to cal_ctx, initialize them to the currently
used values, and use those fields when writing to the register.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/ti-vpe/cal.c
drivers/media/platform/ti-vpe/cal.h
drivers/media/platform/ti-vpe/cal_regs.h

index cd8ec04..2d05fb3 100644 (file)
@@ -335,8 +335,8 @@ static void cal_ctx_csi2_config(struct cal_ctx *ctx)
         *  0x2A: RAW8   1 pixel  = 1 byte
         *  0x1E: YUV422 2 pixels = 4 bytes
         */
-       cal_set_field(&val, 0x1, CAL_CSI2_CTX_DT_MASK);
-       cal_set_field(&val, 0, CAL_CSI2_CTX_VC_MASK);
+       cal_set_field(&val, ctx->datatype, CAL_CSI2_CTX_DT_MASK);
+       cal_set_field(&val, ctx->vc, CAL_CSI2_CTX_VC_MASK);
        cal_set_field(&val, ctx->v_fmt.fmt.pix.height, CAL_CSI2_CTX_LINES_MASK);
        cal_set_field(&val, CAL_CSI2_CTX_ATT_PIX, CAL_CSI2_CTX_ATT_MASK);
        cal_set_field(&val, CAL_CSI2_CTX_PACK_MODE_LINE,
@@ -927,6 +927,8 @@ static struct cal_ctx *cal_ctx_create(struct cal_dev *cal, int inst)
        ctx->dma_ctx = inst;
        ctx->csi2_ctx = inst;
        ctx->cport = inst;
+       ctx->vc = 0;
+       ctx->datatype = CAL_CSI2_CTX_DT_ANY;
 
        ret = cal_ctx_v4l2_init(ctx);
        if (ret)
index d7cc399..def0c9a 100644 (file)
@@ -223,6 +223,8 @@ struct cal_ctx {
        u8                      cport;
        u8                      csi2_ctx;
        u8                      pix_proc;
+       u8                      vc;
+       u8                      datatype;
 
        bool                    use_pix_proc;
 };
index 7eeceee..40e4f97 100644 (file)
 #define CAL_CSI2_VC_IRQ_ECC_CORRECTION_IRQ_MASK(n)     BIT(5 + ((n) * 8))
 
 #define CAL_CSI2_CTX_DT_MASK           GENMASK(5, 0)
+#define CAL_CSI2_CTX_DT_DISABLED       0
+#define CAL_CSI2_CTX_DT_ANY            1
 #define CAL_CSI2_CTX_VC_MASK           GENMASK(7, 6)
 #define CAL_CSI2_CTX_CPORT_MASK                GENMASK(12, 8)
 #define CAL_CSI2_CTX_ATT_MASK          BIT(13)