Commit a6221d42 authored by Chen-Yu Tsai's avatar Chen-Yu Tsai Committed by Mauro Carvalho Chehab

media: mediatek: vcodec: Make encoder capability fields fit requirements

This partially reverts commit fd9f8050,
and changes things so that the capability string fields of the encoder
conform to their requirements.

The driver name field should contain the actual driver name, not some
otherwise unused string macro from the driver. To make this clear,
copy the name from the driver's name field.

The card name for the video encoder previously held a static platform
name that was fixed to match MT8173. This obviously doesn't make sense
for newer chips. Since commit fd9f8050 ("media: mediatek: vcodec:
Change encoder v4l2 capability value"), this field was changed to hold
the driver's name, or "mtk-vcodec-dec". This doesn't make much sense
either, since this still doesn't reflect what chip this is.

Instead, fill in the card name with "MTxxxx video encoder" with the
proper chip number.

Since commit f2d8b691 ("media: v4l: ioctl: Set bus_info in
v4l_querycap()"), the V4L2 core provides a default value for the
bus_info field for platform and PCI devices. This value will match
the default value for media devices added by commit cef69974
("media: mc: Set bus_info in media_device_init()"). These defaults
are stable and device-specific.

Drop the custom capability bus_info from the mtk-vcodec encoder
driver, and use the defaults.

As this patch removes the last usage of MTK_VCODEC_DRV_NAME, remove
the macro as well.

Fixes: fd9f8050 ("media: mediatek: vcodec: Change encoder v4l2 capability value")
Signed-off-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 620a14e6
......@@ -19,7 +19,6 @@
#include "mtk_vcodec_util.h"
#include "vdec_msg_queue.h"
#define MTK_VCODEC_DRV_NAME "mtk_vcodec_drv"
#define MTK_VCODEC_DEC_NAME "mtk-vcodec-dec"
#define MTK_VCODEC_ENC_NAME "mtk-vcodec-enc"
......
......@@ -232,11 +232,12 @@ static int mtk_vcodec_enc_get_chip_name(void *priv)
static int vidioc_venc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{
struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv);
struct device *dev = &ctx->dev->plat_dev->dev;
int platform_name = mtk_vcodec_enc_get_chip_name(priv);
strscpy(cap->driver, MTK_VCODEC_DRV_NAME, sizeof(cap->driver));
strscpy(cap->card, MTK_VCODEC_ENC_NAME, sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:mt%d-enc", platform_name);
strscpy(cap->driver, dev->driver->name, sizeof(cap->driver));
snprintf(cap->card, sizeof(cap->card), "MT%d video encoder", platform_name);
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