Commit b51b1503 authored by Yunfei Dong's avatar Yunfei Dong Committed by Mauro Carvalho Chehab

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: default avatarYunfei Dong <yunfei.dong@mediatek.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent a8a7a278
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment