[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00dc6bff-d87a-0d80-fe20-ae70e5ad0c4f@collabora.com>
Date: Mon, 18 Jul 2022 12:22:17 +0200
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: Irui Wang <irui.wang@...iatek.com>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Tzung-Bi Shih <tzungbi@...omium.org>,
nicolas.dufresne@...labora.com, wenst@...omium.org,
kyrie wu <kyrie.wu@...iatek.com>
Cc: Project_Global_Chrome_Upstream_Group@...iatek.com,
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,
Tomasz Figa <tfiga@...omium.org>, xia.jiang@...iatek.com,
maoguang.meng@...iatek.com, srv_heupstream@...iatek.com
Subject: Re: [V5,3/8] media: mtk-jpegdec: manage jpegdec multi-hardware
Il 16/07/22 11:34, Irui Wang ha scritto:
> From: kyrie wu <kyrie.wu@...iatek.com>
>
> manage each hardware information, including irq/clk/power.
> the hardware includes HW0/HW1/HW2.
>
> Signed-off-by: kyrie wu <kyrie.wu@...iatek.com>
> Signed-off-by: irui wang <irui.wang@...iatek.com>
>
> ---
> drivers/media/platform/mediatek/jpeg/Makefile | 5 +-
> .../platform/mediatek/jpeg/mtk_jpeg_core.c | 23 +++
> .../platform/mediatek/jpeg/mtk_jpeg_core.h | 37 ++++
> .../platform/mediatek/jpeg/mtk_jpeg_dec_hw.c | 172 ++++++++++++++++++
> 4 files changed, 235 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/mediatek/jpeg/Makefile b/drivers/media/platform/mediatek/jpeg/Makefile
> index 69703db4b0a5..26e84852523e 100644
> --- a/drivers/media/platform/mediatek/jpeg/Makefile
> +++ b/drivers/media/platform/mediatek/jpeg/Makefile
> @@ -1,9 +1,10 @@
> # SPDX-License-Identifier: GPL-2.0-only
> obj-$(CONFIG_VIDEO_MEDIATEK_JPEG) += mtk_jpeg.o \
> - mtk-jpeg-enc-hw.o
> + mtk-jpeg-enc-hw.o \
> + mtk-jpeg-dec-hw.o
>
> mtk_jpeg-y := mtk_jpeg_core.o \
> - mtk_jpeg_dec_hw.o \
> mtk_jpeg_dec_parse.o
>
> mtk-jpeg-enc-hw-y := mtk_jpeg_enc_hw.o
> +mtk-jpeg-dec-hw-y := mtk_jpeg_dec_hw.o
> diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> index 386d48cc4f59..a9e8be976bb0 100644
> --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> @@ -1100,6 +1100,10 @@ static void mtk_jpeg_multicore_enc_device_run(void *priv)
> queue_work(jpeg->workqueue, &ctx->jpeg_work);
> }
>
> +static void mtk_jpeg_multicore_dec_device_run(void *priv)
> +{
.... why is this function empty?!
> +}
> +
> static void mtk_jpeg_dec_device_run(void *priv)
> {
> struct mtk_jpeg_ctx *ctx = priv;
> @@ -1166,6 +1170,10 @@ static const struct v4l2_m2m_ops mtk_jpeg_multicore_enc_m2m_ops = {
> .device_run = mtk_jpeg_multicore_enc_device_run,
> };
>
> +static const struct v4l2_m2m_ops mtk_jpeg_multicore_dec_m2m_ops = {
> + .device_run = mtk_jpeg_multicore_dec_device_run,
> +};
> +
> static const struct v4l2_m2m_ops mtk_jpeg_dec_m2m_ops = {
> .device_run = mtk_jpeg_dec_device_run,
> .job_ready = mtk_jpeg_dec_job_ready,
> @@ -1680,6 +1688,17 @@ static struct mtk_jpeg_variant mtk8195_jpegenc_drvdata = {
> .cap_q_default_fourcc = V4L2_PIX_FMT_JPEG,
> };
>
> +static const struct mtk_jpeg_variant mtk8195_jpegdec_drvdata = {
> + .formats = mtk_jpeg_dec_formats,
> + .num_formats = MTK_JPEG_DEC_NUM_FORMATS,
> + .qops = &mtk_jpeg_dec_qops,
> + .m2m_ops = &mtk_jpeg_multicore_dec_m2m_ops,
> + .dev_name = "mtk-jpeg-dec",
> + .ioctl_ops = &mtk_jpeg_dec_ioctl_ops,
> + .out_q_default_fourcc = V4L2_PIX_FMT_JPEG,
> + .cap_q_default_fourcc = V4L2_PIX_FMT_YUV420M,
> +};
> +
> #if defined(CONFIG_OF)
> static const struct of_device_id mtk_jpeg_match[] = {
> {
> @@ -1698,6 +1717,10 @@ static const struct of_device_id mtk_jpeg_match[] = {
> .compatible = "mediatek,mt8195-jpgenc",
> .data = &mtk8195_jpegenc_drvdata,
> },
> + {
> + .compatible = "mediatek,mt8195-jpgdec",
> + .data = &mtk8195_jpegdec_drvdata,
> + },
> {},
> };
>
..snip..
> diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c
> index d2f25f43e852..232e81165dd3 100644
> --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c
> +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c
..snip..
> +
> +static int mtk_jpegdec_hw_probe(struct platform_device *pdev)
> +{
> + struct mtk_jpegdec_clk *jpegdec_clk;
> + struct mtk_jpeg_dev *master_dev;
> + struct mtk_jpegdec_comp_dev *dev;
> + int ret, i;
> +
> + struct device *decs = &pdev->dev;
> +
> + if (!decs->parent)
> + return -EPROBE_DEFER;
> +
> + master_dev = dev_get_drvdata(decs->parent);
> + if (!master_dev)
> + return -EPROBE_DEFER;
> +
> + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
> + if (!dev)
> + return -ENOMEM;
> +
> + dev->plat_dev = pdev;
> + dev->dev = &pdev->dev;
> +
> + if (!master_dev->is_jpgdec_multihw) {
> + master_dev->is_jpgdec_multihw = true;
> + for (i = 0; i < MTK_JPEGDEC_HW_MAX; i++)
> + master_dev->dec_hw_dev[i] = NULL;
> + }
> +
> + jpegdec_clk = &dev->jdec_clk;
> +
> + jpegdec_clk->clk_num = devm_clk_bulk_get_all(&pdev->dev,
> + &jpegdec_clk->clks);
> + if (jpegdec_clk->clk_num < 0)
> + return dev_err_probe(&pdev->dev,
> + jpegdec_clk->clk_num,
> + "Failed to get jpegdec clock count.\n");
> +
> + dev->reg_base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(dev->reg_base))
> + return PTR_ERR(dev->reg_base);
> +
> + ret = mtk_jpegdec_hw_init_irq(dev);
> + if (ret)
> + return dev_err_probe(&pdev->dev,
> + ret,
> + "Failed to register JPEGDEC irq handler.\n");
Fix:
return dev_err_probe(&pdev->dev, ret,
"Failed to register JPEGDEC irq handler.\n");
Regards,
Angelo
Powered by blists - more mailing lists