Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp140226pxv; Wed, 30 Jun 2021 01:56:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYoMsoGxsNEx7f2IDwWgcu6xHu9xqRe8GwBWmQLhlA08oanliW792AFKMIEFfJUiMp6dXM X-Received: by 2002:a5e:9602:: with SMTP id a2mr7281643ioq.146.1625043361216; Wed, 30 Jun 2021 01:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625043361; cv=none; d=google.com; s=arc-20160816; b=BwgTfizUPt1j2N/20ouxb26AHK4/qcE3rWKkGdOXL1tqzMk1fvlKBOEaP8I9is4obo gewnX5UtzuGpArttxQ0EHvFE1gSHC/sUoPQSIXISws4ilkaH2fjGLucAiWsGPY6kzCWl Fu2xewkRIARHck0F4iNjc5jv6hQNBYN3kPRiSvJEKHUvMW9o4TjNNLBU5EdplaAH6ISh zyS/gxXxSXFazQWdtLYcM4V4QvXR6ixfnrJh0o8Rc6qJ87Ie3jChBVZQ3CmcHpRxkpz1 xtaEkPC6lNUeUdXXy7wm3mwixRdvxRfFzGKzi/maFJUb727vQ3/7eoyXIFn9zKaXE43D GRcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=TfT5nJ8lELd2piTvN82aHbyv5eqIAwekhYefxPmQOww=; b=lX1IR2gsZQBXWCYcjHIpAyWLERHTHvqn8oX2mu6da8tWsgG+m8a246JXu4hJkdjYrf 2vkQfgEW1jj3TrEJj/7ULeV5OiBIYf9GfCuZf/S0GTCtlzIWbLqHZYnwT0OIXl9rlsOP 3/nC/INUwrD+akp84jBDRw52nfw24rjDBNDsVJF4xkv5hkpw+Tzw5kDRc7tcbWv5Rkvi RruKMltw8RQU01Tvo78J/kG3IWXYBle4qq/jpum/L4Bkwv6fst+1B6w3zENRaFyJIpeJ mEUOJ4fFc9iXGA3yF9zUR8berXhubhmtR4Zw6sYYpPNC+nIdJeVbuD/deLsRAqiB1Ofq WzHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si24576668jae.125.2021.06.30.01.55.49; Wed, 30 Jun 2021 01:56:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233698AbhF3I5i (ORCPT + 99 others); Wed, 30 Jun 2021 04:57:38 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:55081 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S233442AbhF3I5h (ORCPT ); Wed, 30 Jun 2021 04:57:37 -0400 X-UUID: ff3354f5fc0b4bc3829834d708b10193-20210630 X-UUID: ff3354f5fc0b4bc3829834d708b10193-20210630 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1218654307; Wed, 30 Jun 2021 16:52:55 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Jun 2021 16:52:53 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 30 Jun 2021 16:52:52 +0800 From: Irui Wang To: Hans Verkuil , Tzung-Bi Shih , Alexandre Courbot , Tiffany Lin , Andrew-CT Chen , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Tomasz Figa CC: Hsin-Yi Wang , Maoguang Meng , Longfei Wang , Yunfei Dong , Fritz Koenig , Irui Wang , , , , , , , Subject: [PATCH 1/3] media: mtk-vcodec: Clean redundant encoder format definition Date: Wed, 30 Jun 2021 16:52:45 +0800 Message-ID: <20210630085247.27554-2-irui.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210630085247.27554-1-irui.wang@mediatek.com> References: <20210630085247.27554-1-irui.wang@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The supported capture/output formats don't depend on models, clean redundant definitions and nameing with type instead. Signed-off-by: Irui Wang --- .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 50 ++++++++----------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c index 45d1870c83dd..4489a9744cd7 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -26,7 +26,7 @@ module_param(mtk_v4l2_dbg_level, int, S_IRUGO | S_IWUSR); module_param(mtk_vcodec_dbg, bool, S_IRUGO | S_IWUSR); -static const struct mtk_video_fmt mtk_video_formats_output_mt8173[] = { +static const struct mtk_video_fmt mtk_video_formats_output[] = { { .fourcc = V4L2_PIX_FMT_NV12M, .type = MTK_FMT_FRAME, @@ -49,7 +49,7 @@ static const struct mtk_video_fmt mtk_video_formats_output_mt8173[] = { }, }; -static const struct mtk_video_fmt mtk_video_formats_capture_mt8173_avc[] = { +static const struct mtk_video_fmt mtk_video_formats_capture_h264[] = { { .fourcc = V4L2_PIX_FMT_H264, .type = MTK_FMT_ENC, @@ -57,7 +57,7 @@ static const struct mtk_video_fmt mtk_video_formats_capture_mt8173_avc[] = { }, }; -static const struct mtk_video_fmt mtk_video_formats_capture_mt8173_vp8[] = { +static const struct mtk_video_fmt mtk_video_formats_capture_vp8[] = { { .fourcc = V4L2_PIX_FMT_VP8, .type = MTK_FMT_ENC, @@ -65,14 +65,6 @@ static const struct mtk_video_fmt mtk_video_formats_capture_mt8173_vp8[] = { }, }; -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) { @@ -392,10 +384,10 @@ static int mtk_vcodec_probe(struct platform_device *pdev) static const struct mtk_vcodec_enc_pdata mt8173_avc_pdata = { .chip = MTK_MT8173, - .capture_formats = mtk_video_formats_capture_mt8173_avc, - .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8173_avc), - .output_formats = mtk_video_formats_output_mt8173, - .num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173), + .capture_formats = mtk_video_formats_capture_h264, + .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_h264), + .output_formats = mtk_video_formats_output, + .num_output_formats = ARRAY_SIZE(mtk_video_formats_output), .min_bitrate = 1, .max_bitrate = 4000000, .core_id = VENC_SYS, @@ -403,10 +395,10 @@ static const struct mtk_vcodec_enc_pdata mt8173_avc_pdata = { static const struct mtk_vcodec_enc_pdata mt8173_vp8_pdata = { .chip = MTK_MT8173, - .capture_formats = mtk_video_formats_capture_mt8173_vp8, - .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8173_vp8), - .output_formats = mtk_video_formats_output_mt8173, - .num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173), + .capture_formats = mtk_video_formats_capture_vp8, + .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_vp8), + .output_formats = mtk_video_formats_output, + .num_output_formats = ARRAY_SIZE(mtk_video_formats_output), .min_bitrate = 64, .max_bitrate = 4000000, .core_id = VENC_LT_SYS, @@ -415,11 +407,10 @@ static const struct mtk_vcodec_enc_pdata mt8173_vp8_pdata = { static const struct mtk_vcodec_enc_pdata mt8183_pdata = { .chip = MTK_MT8183, .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), + .capture_formats = mtk_video_formats_capture_h264, + .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_h264), + .output_formats = mtk_video_formats_output, + .num_output_formats = ARRAY_SIZE(mtk_video_formats_output), .min_bitrate = 64, .max_bitrate = 40000000, .core_id = VENC_SYS, @@ -428,16 +419,15 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = { static const struct mtk_vcodec_enc_pdata mt8192_pdata = { .chip = MTK_MT8192, .uses_ext = true, - /* MT8192 supports the same capture formats as MT8183 */ - .capture_formats = mtk_video_formats_capture_mt8183, - .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183), - /* MT8192 supports the same output formats as MT8173 */ - .output_formats = mtk_video_formats_output_mt8173, - .num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173), + .capture_formats = mtk_video_formats_capture_h264, + .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_h264), + .output_formats = mtk_video_formats_output, + .num_output_formats = ARRAY_SIZE(mtk_video_formats_output), .min_bitrate = 64, .max_bitrate = 100000000, .core_id = VENC_SYS, }; + static const struct of_device_id mtk_vcodec_enc_match[] = { {.compatible = "mediatek,mt8173-vcodec-enc", .data = &mt8173_avc_pdata}, -- 2.18.0