summaryrefslogtreecommitdiff
path: root/drivers/staging/media/tegra-video
diff options
context:
space:
mode:
authorSowjanya Komatineni <skomatineni@nvidia.com>2020-12-11 20:02:31 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-01-04 14:54:55 +0300
commitc1bcc54728253a83dd61b27b9da553116ae433be (patch)
tree1b04931df0a7f5146abb507d5f9aa2ff3a7e55b5 /drivers/staging/media/tegra-video
parent56f64b82356b7494ca58d31652317c2f009d8ca1 (diff)
downloadlinux-c1bcc54728253a83dd61b27b9da553116ae433be.tar.xz
media: tegra-video: Enable VI pixel transform for YUV and RGB formats
VI Pixel transforms converts source pixel data to selected destination pixel formats in memory and aligns properly. YUV and RGB formats need this pixel transform to be enabled. RAW formats use T_R16_I destination pixel format in memory and does not need pixel transform as they support direct write to memory. So, this patch enables pixel transform for YUV and RGB and keeps it bypass for RAW formats. Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/staging/media/tegra-video')
-rw-r--r--drivers/staging/media/tegra-video/tegra210.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/staging/media/tegra-video/tegra210.c b/drivers/staging/media/tegra-video/tegra210.c
index ac066c030a4f..6b23aa799fbe 100644
--- a/drivers/staging/media/tegra-video/tegra210.c
+++ b/drivers/staging/media/tegra-video/tegra210.c
@@ -178,10 +178,23 @@ static int tegra_channel_capture_setup(struct tegra_vi_channel *chan)
u32 format = chan->fmtinfo->img_fmt;
u32 data_type = chan->fmtinfo->img_dt;
u32 word_count = (width * chan->fmtinfo->bit_width) / 8;
+ u32 bypass_pixel_transform = BIT(BYPASS_PXL_TRANSFORM_OFFSET);
+
+ /*
+ * VI Pixel transformation unit converts source pixels data format
+ * into selected destination pixel format and aligns properly while
+ * interfacing with memory packer.
+ * This pixel transformation should be enabled for YUV and RGB
+ * formats and should be bypassed for RAW formats as RAW formats
+ * only support direct to memory.
+ */
+ if (chan->pg_mode || data_type == TEGRA_IMAGE_DT_YUV422_8 ||
+ data_type == TEGRA_IMAGE_DT_RGB888)
+ bypass_pixel_transform = 0;
vi_csi_write(chan, TEGRA_VI_CSI_ERROR_STATUS, 0xffffffff);
vi_csi_write(chan, TEGRA_VI_CSI_IMAGE_DEF,
- ((chan->pg_mode ? 0 : 1) << BYPASS_PXL_TRANSFORM_OFFSET) |
+ bypass_pixel_transform |
(format << IMAGE_DEF_FORMAT_OFFSET) |
IMAGE_DEF_DEST_MEM);
vi_csi_write(chan, TEGRA_VI_CSI_IMAGE_DT, data_type);