media: mtk-vcodec: add support for MT8183 encoder
authorYunfei Dong <yunfei.dong@mediatek.com>
Fri, 21 Aug 2020 10:36:01 +0000 (12:36 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sat, 26 Sep 2020 08:07:05 +0000 (10:07 +0200)
Now that all the supporting blocks are present, enable encoder for
MT8183.

[acourbot: refactor, cleanup and split]

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Co-developed-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Acked-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c

index ba4045d..3dd010c 100644 (file)
@@ -302,6 +302,7 @@ struct mtk_vcodec_ctx {
 
 enum mtk_chip {
        MTK_MT8173,
+       MTK_MT8183,
 };
 
 /**
index 1b44897..265643e 100644 (file)
@@ -62,6 +62,14 @@ static const struct mtk_video_fmt mtk_video_formats_capture_mt8173[] =  {
        },
 };
 
+static const struct mtk_video_fmt mtk_video_formats_capture_mt8183[] =  {
+       {
+               .fourcc = V4L2_PIX_FMT_H264,
+               .type = MTK_FMT_ENC,
+               .num_planes = 1,
+       },
+};
+
 /* Wake up context wait_queue */
 static void wake_up_ctx(struct mtk_vcodec_ctx *ctx, unsigned int reason)
 {
@@ -439,8 +447,22 @@ static const struct mtk_vcodec_enc_pdata mt8173_pdata = {
        .max_bitrate = 4000000,
 };
 
+static const struct mtk_vcodec_enc_pdata mt8183_pdata = {
+       .chip = MTK_MT8183,
+       .has_lt_irq = false,
+       .uses_ext = true,
+       .capture_formats = mtk_video_formats_capture_mt8183,
+       .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183),
+       /* MT8183 supports the same output formats as MT8173 */
+       .output_formats = mtk_video_formats_output_mt8173,
+       .num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173),
+       .min_bitrate = 64,
+       .max_bitrate = 40000000,
+};
+
 static const struct of_device_id mtk_vcodec_enc_match[] = {
        {.compatible = "mediatek,mt8173-vcodec-enc", .data = &mt8173_pdata},
+       {.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
        {},
 };
 MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);