media: mtk-vcodec: add support for MT8183 encoder

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>
This commit is contained in:
Yunfei Dong 2020-08-21 12:36:01 +02:00 committed by Mauro Carvalho Chehab
parent f466afdffa
commit c9082c9d39
2 changed files with 23 additions and 0 deletions

View File

@ -302,6 +302,7 @@ struct mtk_vcodec_ctx {
enum mtk_chip {
MTK_MT8173,
MTK_MT8183,
};
/**

View 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);