aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYunfei Dong <yunfei.dong@mediatek.com>2022-06-10 02:53:14 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-06-27 08:51:13 +0100
commitb51b15030054f391201ab7bcbf76b5541cef5591 (patch)
treec5daae8e4314bdc9a82d7531b41e7e3e45839233 /drivers
parenta8a7a278c56ad3b4ddd4db9a960e0537d032b0b3 (diff)
media: mediatek: vcodec: Fix encoder v4l2 bus_info not correctly
Fix v4l2 capability bus_info value with correct chip name according to compatible. Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c
index c21367038c34..f22efad761d8 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c
@@ -204,11 +204,30 @@ 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_ctx *ctx = fh_to_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
+ return 8173;
+}
+
static int vidioc_venc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{
+ int platform_name = mtk_vcodec_enc_get_chip_name(priv);
+
strscpy(cap->driver, MTK_VCODEC_ENC_NAME, sizeof(cap->driver));
- strscpy(cap->bus_info, MTK_PLATFORM_STR, sizeof(cap->bus_info));
+ snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:mt%d-enc", platform_name);
strscpy(cap->card, MTK_PLATFORM_STR, sizeof(cap->card));
return 0;

Privacy Policy