From: Tomasz Figa <tfiga@chromium.org>
To: "Frederic Chen (陳俊元)" <frederic.chen@mediatek.com>
Cc: "Shik Chen" <shik@chromium.org>,
devicetree@vger.kernel.org,
"Sean Cheng (鄭昇弘)" <Sean.Cheng@mediatek.com>,
"Laurent Pinchart" <laurent.pinchart+renesas@ideasonboard.com>,
"Rynn Wu (吳育恩)" <Rynn.Wu@mediatek.com>,
"Christie Yu (游雅惠)" <christie.yu@mediatek.com>,
srv_heupstream <srv_heupstream@mediatek.com>,
"Allan Yang (楊智鈞)" <Allan.Yang@mediatek.com>,
"Holmes Chiou (邱挺)" <holmes.chiou@mediatek.com>,
suleiman@chromium.org,
"Jerry-ch Chen" <Jerry-ch.Chen@mediatek.com>,
"Jungo Lin (林明俊)" <jungo.lin@mediatek.com>,
"Sj Huang" <sj.huang@mediatek.com>,
yuzhao@chromium.org, "Hans Verkuil" <hans.verkuil@cisco.com>,
zwisler@chromium.org, "Matthias Brugger" <matthias.bgg@gmail.com>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@lists.infradead.org>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"list@263.net:IOMMU DRIVERS <iommu@lists.linux-foundation.org>,
Joerg Roedel <joro@8bytes.org>,
" <linux-arm-kernel@lists.infradead.org>,
"Linux Media Mailing List" <linux-media@vger.kernel.org>
Subject: Re: [RFC PATCH V3 4/5] platform: mtk-isp: Add Mediatek DIP driver
Date: Tue, 10 Sep 2019 13:04:50 +0900 [thread overview]
Message-ID: <CAAFQd5DEn_N26M7B4X7fKHVA=XBtWJN=Y4VF7D9B=TkgXf_i+Q@mail.gmail.com> (raw)
In-Reply-To: <20190909192244.9367-5-frederic.chen@mediatek.com>
Hi Frederic,
On Tue, Sep 10, 2019 at 4:23 AM <frederic.chen@mediatek.com> wrote:
>
> From: Frederic Chen <frederic.chen@mediatek.com>
>
> This patch adds the driver of Digital Image Processing (DIP)
> unit in Mediatek ISP system, providing image format
> conversion, resizing, and rotation features.
>
> The mtk-isp directory will contain drivers for multiple IP
> blocks found in Mediatek ISP system. It will include ISP
> Pass 1 driver(CAM), sensor interface driver, DIP driver and
> face detection driver.
>
> Signed-off-by: Frederic Chen <frederic.chen@mediatek.com>
> ---
> drivers/media/platform/mtk-isp/Makefile | 7 +
> .../media/platform/mtk-isp/isp_50/Makefile | 7 +
> .../platform/mtk-isp/isp_50/dip/Makefile | 18 +
> .../platform/mtk-isp/isp_50/dip/mtk_dip-dev.c | 650 +++++
> .../platform/mtk-isp/isp_50/dip/mtk_dip-dev.h | 566 +++++
> .../platform/mtk-isp/isp_50/dip/mtk_dip-hw.h | 156 ++
> .../platform/mtk-isp/isp_50/dip/mtk_dip-sys.c | 521 ++++
> .../mtk-isp/isp_50/dip/mtk_dip-v4l2.c | 2255 +++++++++++++++++
> 8 files changed, 4180 insertions(+)
> create mode 100644 drivers/media/platform/mtk-isp/Makefile
> create mode 100644 drivers/media/platform/mtk-isp/isp_50/Makefile
> create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/Makefile
> create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-dev.c
> create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-dev.h
> create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-hw.h
> create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-sys.c
> create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-v4l2.c
>
Thanks for sending v3!
I'm going to do a full review a bit later, but please check one
comment about power handling below.
Other than that one comment, from a quick look, I think we only have a
number of style issues left. Thanks for the hard work!
[snip]
> +static void dip_runner_func(struct work_struct *work)
> +{
> + struct mtk_dip_request *req = mtk_dip_hw_mdp_work_to_req(work);
> + struct mtk_dip_dev *dip_dev = req->dip_pipe->dip_dev;
> + struct img_config *config_data =
> + (struct img_config *)req->working_buf->config_data.vaddr;
> +
> + /*
> + * Call MDP/GCE API to do HW excecution
> + * Pass the framejob to MDP driver
> + */
> + pm_runtime_get_sync(dip_dev->dev);
> + mdp_cmdq_sendtask(dip_dev->mdp_pdev, config_data,
> + &req->img_fparam.frameparam, NULL, false,
> + dip_mdp_cb_func, req);
> +}
[snip]
> +static void dip_composer_workfunc(struct work_struct *work)
> +{
> + struct mtk_dip_request *req = mtk_dip_hw_fw_work_to_req(work);
> + struct mtk_dip_dev *dip_dev = req->dip_pipe->dip_dev;
> + struct img_ipi_param ipi_param;
> + struct mtk_dip_hw_subframe *buf;
> + int ret;
> +
> + down(&dip_dev->sem);
> +
> + buf = mtk_dip_hw_working_buf_alloc(req->dip_pipe->dip_dev);
> + if (!buf) {
> + dev_err(req->dip_pipe->dip_dev->dev,
> + "%s:%s:req(%p): no free working buffer available\n",
> + __func__, req->dip_pipe->desc->name, req);
> + }
> +
> + req->working_buf = buf;
> + mtk_dip_wbuf_to_ipi_img_addr(&req->img_fparam.frameparam.subfrm_data,
> + &buf->buffer);
> + memset(buf->buffer.vaddr, 0, DIP_SUB_FRM_SZ);
> + mtk_dip_wbuf_to_ipi_img_sw_addr(&req->img_fparam.frameparam.config_data,
> + &buf->config_data);
> + memset(buf->config_data.vaddr, 0, DIP_COMP_SZ);
> +
> + if (!req->img_fparam.frameparam.tuning_data.present) {
> + /*
> + * When user enqueued without tuning buffer,
> + * it would use driver internal buffer.
> + */
> + dev_dbg(dip_dev->dev,
> + "%s: frame_no(%d) has no tuning_data\n",
> + __func__, req->img_fparam.frameparam.frame_no);
> +
> + mtk_dip_wbuf_to_ipi_tuning_addr
> + (&req->img_fparam.frameparam.tuning_data,
> + &buf->tuning_buf);
> + memset(buf->tuning_buf.vaddr, 0, DIP_TUNING_SZ);
> + }
> +
> + mtk_dip_wbuf_to_ipi_img_sw_addr(&req->img_fparam.frameparam.self_data,
> + &buf->frameparam);
> + memcpy(buf->frameparam.vaddr, &req->img_fparam.frameparam,
> + sizeof(req->img_fparam.frameparam));
> + ipi_param.usage = IMG_IPI_FRAME;
> + ipi_param.frm_param.handle = req->id;
> + ipi_param.frm_param.scp_addr = (u32)buf->frameparam.scp_daddr;
> +
> + mutex_lock(&dip_dev->hw_op_lock);
> + atomic_inc(&dip_dev->num_composing);
> + ret = scp_ipi_send(dip_dev->scp_pdev, SCP_IPI_DIP, &ipi_param,
> + sizeof(ipi_param), 0);
We're not holding the pm_runtime enable count here
(pm_runtime_get_sync() wasn't called), so rproc_shutdown() might have
been called. Wouldn't that affect the ability for this IPI to run?
We had a related discussion with Jerry on the FD series and I think
the conclusion is:
a) if there is any state that needs to be preserved between jobs, that
would be cleared by rproc_shutdown() then we need to call
rproc_boot/shutdown() when we start/stop streaming.
b) it there is no such state, we can keep them inside runtime PM
callbacks, but we need to call pm_runtime_get_sync() before sending an
IPI and pm_runtime_mark_last_busy() + pm_runtime_put_autosuspend()
after the SCP signals completion. In this case the runtime PM
autosuspend delay should be set to around 2-3 times the delay needed
for rproc_shutdown() + rproc_boot() to complete.
Best regards,
Tomasz
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-09-10 4:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190909192244.9367-1-frederic.chen@mediatek.com>
2019-09-09 19:22 ` [RFC PATCH V3 1/5] dt-bindings: mt8183: Added DIP dt-bindings frederic.chen
2019-09-13 21:48 ` Rob Herring
2019-10-02 9:22 ` Sakari Ailus
2019-09-09 19:22 ` [RFC PATCH V3 2/5] dts: arm64: mt8183: Add DIP nodes frederic.chen
2019-09-09 19:22 ` [RFC PATCH V3 3/5] media: platform: Add Mediatek DIP driver KConfig frederic.chen
2019-10-02 9:20 ` Sakari Ailus
2019-09-09 19:22 ` [RFC PATCH V3 5/5] media: platform: mtk-mdp3: Add struct tuning_addr and img_sw_buffer frederic.chen
2019-10-02 9:21 ` Sakari Ailus
[not found] ` <20190909192244.9367-5-frederic.chen@mediatek.com>
2019-09-10 4:04 ` Tomasz Figa [this message]
2019-09-11 17:41 ` [RFC PATCH V3 4/5] platform: mtk-isp: Add Mediatek DIP driver Frederic Chen
2019-09-12 5:58 ` Tomasz Figa
2019-09-19 9:41 ` Frederic Chen
2019-09-19 9:44 ` Tomasz Figa
2019-09-23 12:11 ` [RFC PATCH V3 0/5] media: platform: Add support for Digital Image Processing (DIP) on mt8183 SoC Sakari Ailus
2023-08-19 5:43 ` Paul Menzel
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='CAAFQd5DEn_N26M7B4X7fKHVA=XBtWJN=Y4VF7D9B=TkgXf_i+Q@mail.gmail.com' \
--to=tfiga@chromium.org \
--cc=Allan.Yang@mediatek.com \
--cc=Jerry-ch.Chen@mediatek.com \
--cc=Rynn.Wu@mediatek.com \
--cc=Sean.Cheng@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=shik@chromium.org \
--cc=sj.huang@mediatek.com \
--cc=srv_heupstream@mediatek.com \
--cc=suleiman@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).