Message ID | 20210412113457.328012-6-tomi.valkeinen@ideasonboard.com |
---|---|
State | Superseded |
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:34PM +0300, Tomi Valkeinen wrote: > For some reason CAL_CTRL is written at the end of cal_ctx_wr_dma_config. > CAL_CTRL is a global (for CAL) register, so it should be independent of > contexts. > > Move the code to cal_runtime_resume(). > > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> > --- > drivers/media/platform/ti-vpe/cal.c | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) > > diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c > index a5340b583592..b539a9afb3f5 100644 > --- a/drivers/media/platform/ti-vpe/cal.c > +++ b/drivers/media/platform/ti-vpe/cal.c > @@ -403,17 +403,6 @@ static void cal_ctx_wr_dma_config(struct cal_ctx *ctx) > cal_write(ctx->cal, CAL_WR_DMA_XSIZE(ctx->index), val); > ctx_dbg(3, ctx, "CAL_WR_DMA_XSIZE(%d) = 0x%08x\n", ctx->index, > cal_read(ctx->cal, CAL_WR_DMA_XSIZE(ctx->index))); > - > - val = cal_read(ctx->cal, CAL_CTRL); > - cal_set_field(&val, CAL_CTRL_BURSTSIZE_BURST128, > - CAL_CTRL_BURSTSIZE_MASK); > - cal_set_field(&val, 0xF, CAL_CTRL_TAGCNT_MASK); > - cal_set_field(&val, CAL_CTRL_POSTED_WRITES_NONPOSTED, > - CAL_CTRL_POSTED_WRITES_MASK); > - cal_set_field(&val, 0xFF, CAL_CTRL_MFLAGL_MASK); > - cal_set_field(&val, 0xFF, CAL_CTRL_MFLAGH_MASK); > - cal_write(ctx->cal, CAL_CTRL, val); > - ctx_dbg(3, ctx, "CAL_CTRL = 0x%08x\n", cal_read(ctx->cal, CAL_CTRL)); > } > > void cal_ctx_set_dma_addr(struct cal_ctx *ctx, dma_addr_t addr) > @@ -1125,6 +1114,7 @@ static int cal_runtime_resume(struct device *dev) > { > struct cal_dev *cal = dev_get_drvdata(dev); > unsigned int i; > + u32 val; > > if (cal->data->flags & DRA72_CAL_PRE_ES2_LDO_DISABLE) { > /* > @@ -1141,6 +1131,17 @@ static int cal_runtime_resume(struct device *dev) > */ > cal_write(cal, CAL_HL_IRQENABLE_SET(0), CAL_HL_IRQ_OCPO_ERR_MASK); > > + val = cal_read(cal, CAL_CTRL); > + cal_set_field(&val, CAL_CTRL_BURSTSIZE_BURST128, > + CAL_CTRL_BURSTSIZE_MASK); > + cal_set_field(&val, 0xF, CAL_CTRL_TAGCNT_MASK); > + cal_set_field(&val, CAL_CTRL_POSTED_WRITES_NONPOSTED, > + CAL_CTRL_POSTED_WRITES_MASK); > + cal_set_field(&val, 0xFF, CAL_CTRL_MFLAGL_MASK); > + cal_set_field(&val, 0xFF, CAL_CTRL_MFLAGH_MASK); > + cal_write(cal, CAL_CTRL, val); > + cal_dbg(3, cal, "CAL_CTRL = 0x%08x\n", cal_read(cal, CAL_CTRL)); While at it, could you turn the hex values to lower case ? Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > + > return 0; > } > -- Regards, Laurent Pinchart
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c index a5340b583592..b539a9afb3f5 100644 --- a/drivers/media/platform/ti-vpe/cal.c +++ b/drivers/media/platform/ti-vpe/cal.c @@ -403,17 +403,6 @@ static void cal_ctx_wr_dma_config(struct cal_ctx *ctx) cal_write(ctx->cal, CAL_WR_DMA_XSIZE(ctx->index), val); ctx_dbg(3, ctx, "CAL_WR_DMA_XSIZE(%d) = 0x%08x\n", ctx->index, cal_read(ctx->cal, CAL_WR_DMA_XSIZE(ctx->index))); - - val = cal_read(ctx->cal, CAL_CTRL); - cal_set_field(&val, CAL_CTRL_BURSTSIZE_BURST128, - CAL_CTRL_BURSTSIZE_MASK); - cal_set_field(&val, 0xF, CAL_CTRL_TAGCNT_MASK); - cal_set_field(&val, CAL_CTRL_POSTED_WRITES_NONPOSTED, - CAL_CTRL_POSTED_WRITES_MASK); - cal_set_field(&val, 0xFF, CAL_CTRL_MFLAGL_MASK); - cal_set_field(&val, 0xFF, CAL_CTRL_MFLAGH_MASK); - cal_write(ctx->cal, CAL_CTRL, val); - ctx_dbg(3, ctx, "CAL_CTRL = 0x%08x\n", cal_read(ctx->cal, CAL_CTRL)); } void cal_ctx_set_dma_addr(struct cal_ctx *ctx, dma_addr_t addr) @@ -1125,6 +1114,7 @@ static int cal_runtime_resume(struct device *dev) { struct cal_dev *cal = dev_get_drvdata(dev); unsigned int i; + u32 val; if (cal->data->flags & DRA72_CAL_PRE_ES2_LDO_DISABLE) { /* @@ -1141,6 +1131,17 @@ static int cal_runtime_resume(struct device *dev) */ cal_write(cal, CAL_HL_IRQENABLE_SET(0), CAL_HL_IRQ_OCPO_ERR_MASK); + val = cal_read(cal, CAL_CTRL); + cal_set_field(&val, CAL_CTRL_BURSTSIZE_BURST128, + CAL_CTRL_BURSTSIZE_MASK); + cal_set_field(&val, 0xF, CAL_CTRL_TAGCNT_MASK); + cal_set_field(&val, CAL_CTRL_POSTED_WRITES_NONPOSTED, + CAL_CTRL_POSTED_WRITES_MASK); + cal_set_field(&val, 0xFF, CAL_CTRL_MFLAGL_MASK); + cal_set_field(&val, 0xFF, CAL_CTRL_MFLAGH_MASK); + cal_write(cal, CAL_CTRL, val); + cal_dbg(3, cal, "CAL_CTRL = 0x%08x\n", cal_read(cal, CAL_CTRL)); + return 0; }
For some reason CAL_CTRL is written at the end of cal_ctx_wr_dma_config. CAL_CTRL is a global (for CAL) register, so it should be independent of contexts. Move the code to cal_runtime_resume(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> --- drivers/media/platform/ti-vpe/cal.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)