From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Kyrie Wu <kyrie.wu@mediatek.com>,
Tiffany Lin <tiffany.lin@mediatek.com>,
Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
Yunfei Dong <yunfei.dong@mediatek.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Hans Verkuil <hverkuil@xs4all.nl>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Sebastian Fricke <sebastian.fricke@collabora.com>,
Nathan Hebert <nhebert@chromium.org>,
Arnd Bergmann <arnd@arndb.de>,
Irui Wang <irui.wang@mediatek.com>,
George Sun <george.sun@mediatek.com>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
Subject: Re: [PATCH v3 4/6] media: mediatek: encoder: Add a new platform data member
Date: Fri, 14 Nov 2025 16:40:54 -0500 [thread overview]
Message-ID: <e5e4d2af07ae43f6681020db340f6d9f0fb56ba9.camel@collabora.com> (raw)
In-Reply-To: <20250814085642.17343-5-kyrie.wu@mediatek.com>
[-- Attachment #1: Type: text/plain, Size: 5953 bytes --]
Le jeudi 14 août 2025 à 16:56 +0800, Kyrie Wu a écrit :
> From: Irui Wang <irui.wang@mediatek.com>
>
> Add a new platform data member to indicate each encoder IC, so that the
> get chip name function by 'of_device_is_compatible' can be removed.
>
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
I'm very happy of that cleanup,
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
thanks,
Nicolas
> ---
> .../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 23 ++-----------------
> .../vcodec/encoder/mtk_vcodec_enc_drv.c | 6 +++++
> .../vcodec/encoder/mtk_vcodec_enc_drv.h | 2 ++
> 3 files changed, 10 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c
> index 03512bf7a072..1a7be3e57eef 100644
> --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c
> +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c
> @@ -198,34 +198,15 @@ static int vidioc_enum_fmt_vid_out(struct file *file, void *priv,
> pdata->num_output_formats);
> }
>
> -static int mtk_vcodec_enc_get_chip_name(void *priv)
> -{
> - struct mtk_vcodec_enc_ctx *ctx = fh_to_enc_ctx(priv);
> - struct device *dev = &ctx->dev->plat_dev->dev;
> -
> - if (of_device_is_compatible(dev->of_node, "mediatek,mt8173-vcodec-enc"))
> - return 8173;
> - else if (of_device_is_compatible(dev->of_node, "mediatek,mt8183-vcodec-enc"))
> - return 8183;
> - else if (of_device_is_compatible(dev->of_node, "mediatek,mt8192-vcodec-enc"))
> - return 8192;
> - else if (of_device_is_compatible(dev->of_node, "mediatek,mt8195-vcodec-enc"))
> - return 8195;
> - else if (of_device_is_compatible(dev->of_node, "mediatek,mt8188-vcodec-enc"))
> - return 8188;
> - else
> - return 8173;
> -}
> -
> static int vidioc_venc_querycap(struct file *file, void *priv,
> struct v4l2_capability *cap)
> {
> struct mtk_vcodec_enc_ctx *ctx = fh_to_enc_ctx(priv);
> + const struct mtk_vcodec_enc_pdata *pdata = ctx->dev->venc_pdata;
> struct device *dev = &ctx->dev->plat_dev->dev;
> - int platform_name = mtk_vcodec_enc_get_chip_name(priv);
>
> strscpy(cap->driver, dev->driver->name, sizeof(cap->driver));
> - snprintf(cap->card, sizeof(cap->card), "MT%d video encoder", platform_name);
> + snprintf(cap->card, sizeof(cap->card), "MT%d video encoder", pdata->venc_model_num);
>
> return 0;
> }
> diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c
> index bb913dfe5f04..50936949d527 100644
> --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c
> +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c
> @@ -380,6 +380,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
> }
>
> static const struct mtk_vcodec_enc_pdata mt8173_avc_pdata = {
> + .venc_model_num = 8173,
> .capture_formats = mtk_video_formats_capture_h264,
> .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_h264),
> .output_formats = mtk_video_formats_output,
> @@ -390,6 +391,7 @@ static const struct mtk_vcodec_enc_pdata mt8173_avc_pdata = {
> };
>
> static const struct mtk_vcodec_enc_pdata mt8173_vp8_pdata = {
> + .venc_model_num = 8173,
> .capture_formats = mtk_video_formats_capture_vp8,
> .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_vp8),
> .output_formats = mtk_video_formats_output,
> @@ -400,6 +402,7 @@ static const struct mtk_vcodec_enc_pdata mt8173_vp8_pdata = {
> };
>
> static const struct mtk_vcodec_enc_pdata mt8183_pdata = {
> + .venc_model_num = 8183,
> .uses_ext = true,
> .capture_formats = mtk_video_formats_capture_h264,
> .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_h264),
> @@ -411,6 +414,7 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = {
> };
>
> static const struct mtk_vcodec_enc_pdata mt8188_pdata = {
> + .venc_model_num = 8188,
> .uses_ext = true,
> .capture_formats = mtk_video_formats_capture_h264,
> .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_h264),
> @@ -423,6 +427,7 @@ static const struct mtk_vcodec_enc_pdata mt8188_pdata = {
> };
>
> static const struct mtk_vcodec_enc_pdata mt8192_pdata = {
> + .venc_model_num = 8192,
> .uses_ext = true,
> .capture_formats = mtk_video_formats_capture_h264,
> .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_h264),
> @@ -434,6 +439,7 @@ static const struct mtk_vcodec_enc_pdata mt8192_pdata = {
> };
>
> static const struct mtk_vcodec_enc_pdata mt8195_pdata = {
> + .venc_model_num = 8195,
> .uses_ext = true,
> .capture_formats = mtk_video_formats_capture_h264,
> .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_h264),
> diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h
> index 426b1398f815..b3206a7b592d 100644
> --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h
> +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h
> @@ -21,6 +21,7 @@
> /**
> * struct mtk_vcodec_enc_pdata - compatible data for each IC
> *
> + * @venc_model_num: encoder model number
> * @uses_ext: whether the encoder uses the extended firmware messaging format
> * @min_bitrate: minimum supported encoding bitrate
> * @max_bitrate: maximum supported encoding bitrate
> @@ -33,6 +34,7 @@
> * @uses_common_fw_iface: whether the encoder uses common driver interface
> */
> struct mtk_vcodec_enc_pdata {
> + u16 venc_model_num;
> bool uses_ext;
> u64 min_bitrate;
> u64 max_bitrate;
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2025-11-14 21:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 8:56 [PATCH v3 0/6] Add support for MT8196 video encoder Kyrie Wu
2025-08-14 8:56 ` [PATCH v3 1/6] media: mediatek: encoder: Add a new encoder driver interface Kyrie Wu
2025-11-14 21:27 ` Nicolas Dufresne
2025-08-14 8:56 ` [PATCH v3 2/6] media: mediatek: encoder: Add support for common firmware interface Kyrie Wu
2025-11-14 21:31 ` Nicolas Dufresne
2025-08-14 8:56 ` [PATCH v3 3/6] media: mediatek: encoder: Add support for VCP encode process Kyrie Wu
2025-11-14 21:39 ` Nicolas Dufresne
2025-08-14 8:56 ` [PATCH v3 4/6] media: mediatek: encoder: Add a new platform data member Kyrie Wu
2025-11-14 21:40 ` Nicolas Dufresne [this message]
2025-08-14 8:56 ` [PATCH v3 5/6] dt-bindings: media: Add MT8196 mediatek,vcodec-encoder Kyrie Wu
2025-08-15 8:54 ` Krzysztof Kozlowski
2025-08-20 2:55 ` Irui Wang (王瑞)
2025-08-20 5:55 ` Krzysztof Kozlowski
2025-08-20 8:24 ` Irui Wang (王瑞)
2025-08-14 8:56 ` [PATCH v3 6/6] media: mediatek: encoder: Add MT8196 encoder compatible data Kyrie Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e5e4d2af07ae43f6681020db340f6d9f0fb56ba9.camel@collabora.com \
--to=nicolas.dufresne@collabora.com \
--cc=andrew-ct.chen@mediatek.com \
--cc=andrzejtp2010@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=arnd@arndb.de \
--cc=christophe.jaillet@wanadoo.fr \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=george.sun@mediatek.com \
--cc=hverkuil@xs4all.nl \
--cc=irui.wang@mediatek.com \
--cc=krzk+dt@kernel.org \
--cc=kyrie.wu@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=nhebert@chromium.org \
--cc=robh@kernel.org \
--cc=sebastian.fricke@collabora.com \
--cc=tiffany.lin@mediatek.com \
--cc=yunfei.dong@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®