Message ID | 20210412113457.328012-21-tomi.valkeinen@ideasonboard.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media: ti-vpe: cal: prepare for multistream support | expand |
Hi Tomi, Thank you for the patch. On Mon, Apr 12, 2021 at 02:34:49PM +0300, Tomi Valkeinen wrote: > 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> > --- > drivers/media/platform/ti-vpe/cal.c | 6 ++++-- > drivers/media/platform/ti-vpe/cal.h | 2 ++ > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c > index 0fef892854ef..91d2139adc9b 100644 > --- a/drivers/media/platform/ti-vpe/cal.c > +++ b/drivers/media/platform/ti-vpe/cal.c > @@ -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, > @@ -926,6 +926,8 @@ static struct cal_ctx *cal_ctx_create(struct cal_dev *cal, int inst) > ctx->dma_ctx = inst; > ctx->ppi_ctx = inst; > ctx->cport = inst; > + ctx->vc = 0; > + ctx->datatype = 1; /* datatype filter disabled */ Could you define a macro in cal_regs.h for this ? You can then drop the comment. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > ret = cal_ctx_v4l2_init(ctx); > if (ret) > diff --git a/drivers/media/platform/ti-vpe/cal.h b/drivers/media/platform/ti-vpe/cal.h > index 409b7276a1fa..8aa93c92193a 100644 > --- a/drivers/media/platform/ti-vpe/cal.h > +++ b/drivers/media/platform/ti-vpe/cal.h > @@ -223,6 +223,8 @@ struct cal_ctx { > u8 cport; > u8 ppi_ctx; > u8 pix_proc; > + u8 vc; > + u8 datatype; > > bool use_pix_proc; > };
On 18/04/2021 16:06, Laurent Pinchart wrote: > Hi Tomi, > > Thank you for the patch. > > On Mon, Apr 12, 2021 at 02:34:49PM +0300, Tomi Valkeinen wrote: >> 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> >> --- >> drivers/media/platform/ti-vpe/cal.c | 6 ++++-- >> drivers/media/platform/ti-vpe/cal.h | 2 ++ >> 2 files changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c >> index 0fef892854ef..91d2139adc9b 100644 >> --- a/drivers/media/platform/ti-vpe/cal.c >> +++ b/drivers/media/platform/ti-vpe/cal.c >> @@ -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, >> @@ -926,6 +926,8 @@ static struct cal_ctx *cal_ctx_create(struct cal_dev *cal, int inst) >> ctx->dma_ctx = inst; >> ctx->ppi_ctx = inst; >> ctx->cport = inst; >> + ctx->vc = 0; >> + ctx->datatype = 1; /* datatype filter disabled */ > > Could you define a macro in cal_regs.h for this ? You can then drop the > comment. Yes, good idea. I added: #define CAL_CSI2_CTX_DT_DISABLED 0 #define CAL_CSI2_CTX_DT_ANY 1 Tomi
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c index 0fef892854ef..91d2139adc9b 100644 --- a/drivers/media/platform/ti-vpe/cal.c +++ b/drivers/media/platform/ti-vpe/cal.c @@ -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, @@ -926,6 +926,8 @@ static struct cal_ctx *cal_ctx_create(struct cal_dev *cal, int inst) ctx->dma_ctx = inst; ctx->ppi_ctx = inst; ctx->cport = inst; + ctx->vc = 0; + ctx->datatype = 1; /* datatype filter disabled */ ret = cal_ctx_v4l2_init(ctx); if (ret) diff --git a/drivers/media/platform/ti-vpe/cal.h b/drivers/media/platform/ti-vpe/cal.h index 409b7276a1fa..8aa93c92193a 100644 --- a/drivers/media/platform/ti-vpe/cal.h +++ b/drivers/media/platform/ti-vpe/cal.h @@ -223,6 +223,8 @@ struct cal_ctx { u8 cport; u8 ppi_ctx; u8 pix_proc; + u8 vc; + u8 datatype; bool use_pix_proc; };
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> --- drivers/media/platform/ti-vpe/cal.c | 6 ++++-- drivers/media/platform/ti-vpe/cal.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-)