[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b1b4ff47306af5fc0aecf8d2041ffca4c30717b2.camel@mediatek.com>
Date: Fri, 10 Jun 2022 09:43:51 +0800
From: "yunfei.dong@...iatek.com" <yunfei.dong@...iatek.com>
To: Hans Verkuil <hverkuil-cisco@...all.nl>,
Alexandre Courbot <acourbot@...omium.org>,
Nicolas Dufresne <nicolas@...fresne.ca>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Benjamin Gaignard <benjamin.gaignard@...labora.com>,
Tiffany Lin <tiffany.lin@...iatek.com>,
Andrew-CT Chen <andrew-ct.chen@...iatek.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Tomasz Figa <tfiga@...gle.com>
CC: George Sun <george.sun@...iatek.com>,
Xiaoyong Lu <xiaoyong.lu@...iatek.com>,
Hsin-Yi Wang <hsinyi@...omium.org>,
"Fritz Koenig" <frkoenig@...omium.org>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Irui Wang <irui.wang@...iatek.com>,
"Steve Cho" <stevecho@...omium.org>, <linux-media@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
<Project_Global_Chrome_Upstream_Group@...iatek.com>
Subject: Re: [PATCH 1/4] media: mediatek: vcodec: Fix decoder v4l2 bus_info
not correctly
Dear Hans,
Thanks for your suggestion.
I will fix bus_info in patch v2:
decoder: "platform:mt%d" to "platform:mt%d-dec"
encoder: "platform:mt%d" to "platform:mt%d-enc"
Best Regards,
Yunfei Dong
On Thu, 2022-06-09 at 12:08 +0200, Hans Verkuil wrote:
> Hi Yunfei Dong,
>
> On 5/26/22 11:57, Yunfei Dong wrote:
> > Fix v4l2 capability bus_info value with correct chip name according
> > to compatible.
> >
> > Signed-off-by: Yunfei Dong <yunfei.dong@...iatek.com>
> > ---
> > .../platform/mediatek/vcodec/mtk_vcodec_dec.c | 23
> > ++++++++++++++++++-
> > 1 file changed, 22 insertions(+), 1 deletion(-)
> >
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
> > b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
> > index 52e5d36aa912..ccfa426a34ab 100644
> > --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
> > +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
> > @@ -185,11 +185,32 @@ static int vidioc_vdec_dqbuf(struct file
> > *file, void *priv,
> > return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf);
> > }
> >
> > +static int mtk_vcodec_dec_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-dec"))
> > + return 8173;
> > + else if (of_device_is_compatible(dev->of_node,
> > "mediatek,mt8183-vcodec-dec"))
> > + return 8183;
> > + else if (of_device_is_compatible(dev->of_node,
> > "mediatek,mt8192-vcodec-dec"))
> > + return 8192;
> > + else if (of_device_is_compatible(dev->of_node,
> > "mediatek,mt8195-vcodec-dec"))
> > + return 8195;
> > + else if (of_device_is_compatible(dev->of_node,
> > "mediatek,mt8186-vcodec-dec"))
> > + return 8186;
> > + else
> > + return 8173;
> > +}
>
> Nice, but...
>
> > +
> > static int vidioc_vdec_querycap(struct file *file, void *priv,
> > struct v4l2_capability *cap)
> > {
> > + int platform_name = mtk_vcodec_dec_get_chip_name(priv);
> > +
> > strscpy(cap->driver, MTK_VCODEC_DEC_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",
> > platform_name);
>
> ...this will result in identical bus_info values for the decoder and
> encoder
> video devices. The bus_info field is supposed to be unique, and
> that's now
> no longer the case.
>
> I suggest changing this to:
>
> snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:mt%d-
> dec", platform_name);
>
> (and '-enc' for the encoder patch).
>
> Regards,
>
> Hans
>
> > strscpy(cap->card, MTK_PLATFORM_STR, sizeof(cap->card));
> >
> > return 0;
Powered by blists - more mailing lists