From: Pi-Hsun Shih <pihsun@chromium.org>
To: Bibby Hsieh <bibby.hsieh@mediatek.com>,
hans.verkuil@cisco.com,
laurent.pinchart+renesas@ideasonboard.com, tfiga@chromium.org,
matthias.bgg@gmail.com, mchehab@kernel.org
Cc: yuzhao@chromium.org, zwisler@chromium.org,
linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org, Sean.Cheng@mediatek.com,
sj.huang@mediatek.com, christie.yu@mediatek.com,
holmes.chiou@mediatek.com, frederic.chen@mediatek.com,
Jerry-ch.Chen@mediatek.com, jungo.lin@mediatek.com,
Rynn.Wu@mediatek.com, linux-media@vger.kernel.org,
srv_heupstream@mediatek.com, devicetree@vger.kernel.org,
Daoyuan.Huang@mediatek.com,
Ping-Hsun Wu <ping-hsun.wu@mediatek.com>
Subject: Re: [RFC, v3, 4/4] media: platform: mtk-mdp3: Add Mediatek MDP3 driver
Date: Thu, 7 Nov 2019 11:58:10 +0800 [thread overview]
Message-ID: <d5e5a1e2-3422-8ef6-f58a-981fc5bc2449@chromium.org> (raw)
In-Reply-To: <20190911094013.5892-1-bibby.hsieh@mediatek.com>
Hi,
On 9/11/19 5:40 PM, Bibby Hsieh wrote:
> From: daoyuan huang <daoyuan.huang@mediatek.com>
>
> This patch adds driver for Media Data Path 3 (MDP3).
> Each modules' related operation control is sited in mtk-mdp3-comp.c
> Each modules' register table is defined in file with "mdp_reg_"
> and "mmsys_" prefix
> GCE related API, operation control sited in mtk-mdp3-cmdq.c
> V4L2 m2m device functions are implemented in mtk-mdp3-m2m.c
> Probe, power, suspend/resume, system level functions are defined in
> mtk-mdp3-core.c
>
> Signed-off-by: Ping-Hsun Wu <ping-hsun.wu@mediatek.com>
> Signed-off-by: daoyuan huang <daoyuan.huang@mediatek.com>
> ---
> ...
> diff --git a/drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c b/drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c
> new file mode 100644
> ... > +static int mdp_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct mdp_dev *mdp;
> + phandle rproc_phandle;
> + int ret;
> +
> + mdp = devm_kzalloc(dev, sizeof(*mdp), GFP_KERNEL);
> + if (!mdp)
> + return -ENOMEM;
> +
> + mdp->pdev = pdev;
> + ret = mdp_component_init(mdp);
> + if (ret) {
> + dev_err(dev, "Failed to initialize mdp components\n");
> + goto err_return;
> + }
> +
> + mdp->job_wq = alloc_workqueue(MDP_MODULE_NAME, WQ_FREEZABLE, 0);
> + if (!mdp->job_wq) {
> + dev_err(dev, "Unable to create job workqueue\n");
> + ret = -ENOMEM;
> + goto err_destroy_job_wq;
> + }
> +
> + mdp->clock_wq = alloc_workqueue(MDP_MODULE_NAME "-clock", WQ_FREEZABLE,
> + 0);
> + if (!mdp->clock_wq) {
> + dev_err(dev, "Unable to create clock workqueue\n");
> + ret = -ENOMEM;
> + goto err_destroy_clock_wq;
> + }
> +
> + mdp->vpu_dev = scp_get_pdev(pdev);
> +
> + ret = of_property_read_u32(pdev->dev.of_node, "mediatek,scp",
> + &rproc_phandle);
> + if (ret) {
> + dev_err(&pdev->dev, "Could not get scp device\n");
> + goto err_destroy_clock_wq;
> + }
> +
> + mdp->rproc_handle = rproc_get_by_phandle(rproc_phandle);
> +
> + dev_info(&pdev->dev, "MDP rproc_handle: %llx",
> + (unsigned long long)mdp->rproc_handle);
> +
> + if (!mdp->rproc_handle) {
> + dev_err(&pdev->dev, "Could not get MDP's rproc_handle\n");
"ret" is not set in this error path, ret = -ENODEV?
> + goto err_destroy_clock_wq;
> + }
> +
> + mutex_init(&mdp->vpu_lock);
> + mutex_init(&mdp->m2m_lock);
> +
> + mdp->cmdq_clt = cmdq_mbox_create(dev, 0, 1200);
> + if (IS_ERR(mdp->cmdq_clt))
Same here, ret = PTR_ERR(mdp->cmdq_clt)?
> + goto err_destroy_clock_wq;
> +
> + init_waitqueue_head(&mdp->callback_wq);
> + ida_init(&mdp->mdp_ida);
> + platform_set_drvdata(pdev, mdp);
> +
> + vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
> + pm_runtime_enable(dev);
> +
> + ret = v4l2_device_register(dev, &mdp->v4l2_dev);
> + if (ret) {
> + dev_err(dev, "Failed to register v4l2 device\n");
> + ret = -EINVAL;
> + goto err_mbox_destroy;
> + }
> +
> + ret = mdp_m2m_device_register(mdp);
> + if (ret) {
> + v4l2_err(&mdp->v4l2_dev, "Failed to register m2m device\n");
> + goto err_unregister_device;
> + }
> +
> + dev_dbg(dev, "mdp-%d registered successfully\n", pdev->id);
> + return 0;
> +
> +err_unregister_device:
> + v4l2_device_unregister(&mdp->v4l2_dev);
> +err_mbox_destroy:
> + cmdq_mbox_destroy(mdp->cmdq_clt);
> +err_destroy_clock_wq:
> + destroy_workqueue(mdp->clock_wq);
> +err_destroy_job_wq:
> + destroy_workqueue(mdp->job_wq);
> +err_return:
> + dev_dbg(dev, "Errno %d\n", ret);
> + return ret;
> +}
> ...
>
prev parent reply other threads:[~2019-11-07 3:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-11 9:40 [RFC, v3, 4/4] media: platform: mtk-mdp3: Add Mediatek MDP3 driver Bibby Hsieh
2019-09-23 1:58 ` CK Hu
2019-11-07 3:58 ` Pi-Hsun Shih [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d5e5a1e2-3422-8ef6-f58a-981fc5bc2449@chromium.org \
--to=pihsun@chromium.org \
--cc=Daoyuan.Huang@mediatek.com \
--cc=Jerry-ch.Chen@mediatek.com \
--cc=Rynn.Wu@mediatek.com \
--cc=Sean.Cheng@mediatek.com \
--cc=bibby.hsieh@mediatek.com \
--cc=christie.yu@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=frederic.chen@mediatek.com \
--cc=hans.verkuil@cisco.com \
--cc=holmes.chiou@mediatek.com \
--cc=jungo.lin@mediatek.com \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
--cc=ping-hsun.wu@mediatek.com \
--cc=sj.huang@mediatek.com \
--cc=srv_heupstream@mediatek.com \
--cc=tfiga@chromium.org \
--cc=yuzhao@chromium.org \
--cc=zwisler@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).