Commit cd0dacc2 authored by Benoit Parrot's avatar Benoit Parrot Committed by Mauro Carvalho Chehab

media: ti-vpe: cal: Fix pixel processing parameters

The pixel processing unit was hard coded to only handle 8 bits per pixel
from input to output.

We now add handling for 10, 12 and 16 bits per pixel at the source and
setting the in-memory size (i.e. container size) to 16 bits for these 3
cases.
Signed-off-by: default avatarBenoit Parrot <bparrot@ti.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 5f9f2fb7
......@@ -800,13 +800,48 @@ static void csi2_ctx_config(struct cal_ctx *ctx)
static void pix_proc_config(struct cal_ctx *ctx)
{
u32 val;
u32 val, extract, pack;
switch (ctx->fmt->bpp) {
case 8:
extract = CAL_PIX_PROC_EXTRACT_B8;
pack = CAL_PIX_PROC_PACK_B8;
break;
case 10:
extract = CAL_PIX_PROC_EXTRACT_B10_MIPI;
pack = CAL_PIX_PROC_PACK_B16;
break;
case 12:
extract = CAL_PIX_PROC_EXTRACT_B12_MIPI;
pack = CAL_PIX_PROC_PACK_B16;
break;
case 16:
extract = CAL_PIX_PROC_EXTRACT_B16_LE;
pack = CAL_PIX_PROC_PACK_B16;
break;
default:
/*
* If you see this warning then it means that you added
* some new entry in the cal_formats[] array with a different
* bit per pixel values then the one supported below.
* Either add support for the new bpp value below or adjust
* the new entry to use one of the value below.
*
* Instead of failing here just use 8 bpp as a default.
*/
dev_warn_once(&ctx->dev->pdev->dev,
"%s:%d:%s: bpp:%d unsupported! Overwritten with 8.\n",
__FILE__, __LINE__, __func__, ctx->fmt->bpp);
extract = CAL_PIX_PROC_EXTRACT_B8;
pack = CAL_PIX_PROC_PACK_B8;
break;
}
val = reg_read(ctx->dev, CAL_PIX_PROC(ctx->csi2_port));
set_field(&val, CAL_PIX_PROC_EXTRACT_B8, CAL_PIX_PROC_EXTRACT_MASK);
set_field(&val, extract, CAL_PIX_PROC_EXTRACT_MASK);
set_field(&val, CAL_PIX_PROC_DPCMD_BYPASS, CAL_PIX_PROC_DPCMD_MASK);
set_field(&val, CAL_PIX_PROC_DPCME_BYPASS, CAL_PIX_PROC_DPCME_MASK);
set_field(&val, CAL_PIX_PROC_PACK_B8, CAL_PIX_PROC_PACK_MASK);
set_field(&val, pack, CAL_PIX_PROC_PACK_MASK);
set_field(&val, ctx->csi2_port, CAL_PIX_PROC_CPORT_MASK);
set_field(&val, CAL_GEN_ENABLE, CAL_PIX_PROC_EN_MASK);
reg_write(ctx->dev, CAL_PIX_PROC(ctx->csi2_port), val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment