[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <632e61f1fbcfc92f3358ca2165dd0f39fb91d60a.camel@mediatek.com>
Date: Wed, 16 Oct 2024 01:35:02 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: "sumit.semwal@...aro.org" <sumit.semwal@...aro.org>,
"christian.koenig@....com" <christian.koenig@....com>, "mchehab@...nel.org"
<mchehab@...nel.org>, "conor+dt@...nel.org" <conor+dt@...nel.org>,
"robh@...nel.org" <robh@...nel.org>, "matthias.bgg@...il.com"
<matthias.bgg@...il.com>, "krzk+dt@...nel.org" <krzk+dt@...nel.org>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Shu-hsiang Yang (楊舒翔)
<Shu-hsiang.Yang@...iatek.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
"yunkec@...omium.org" <yunkec@...omium.org>, "linaro-mm-sig@...ts.linaro.org"
<linaro-mm-sig@...ts.linaro.org>, "linux-media@...r.kernel.org"
<linux-media@...r.kernel.org>, "devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>, Yaya Chang (張雅清)
<Yaya.Chang@...iatek.com>, Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@...iatek.com>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
Teddy Chen (陳乾元) <Teddy.Chen@...iatek.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "hidenorik@...omium.org"
<hidenorik@...omium.org>, Shun-Yi Wang (王順億)
<Shun-Yi.Wang@...iatek.com>
Subject: Re: [PATCH v1 08/10] media: platform: mediatek: add isp_7x state ctrl
Hi, Shu-hsiang:
On Wed, 2024-10-09 at 19:15 +0800, Shu-hsiang Yang wrote:
> Introduces state management and debugging mechanisms for the MediaTek
> ISP7.x camsys platform. State management establishes control over ISP
> operations and events, defining distinct states for request handling,
> sensor control, and frame synchronization, ensuring event processing.
> The debugging mechanism ensures stable operation and timely data
> collection during anomalies.
>
> Signed-off-by: Shu-hsiang Yang <Shu-hsiang.Yang@...iatek.com>
> ---
[snip]
> +static bool mtk_cam_req_frame_sync_start(struct mtk_cam_request *req)
> +{
> + /* All ctx with sensor is in ready state */
> + struct mtk_cam_device *cam =
> + container_of(req->req.mdev, struct mtk_cam_device, media_dev);
> + struct mtk_cam_ctx *ctx;
> + struct mtk_cam_ctx *sync_ctx[MTKCAM_SUBDEV_MAX];
> + int i;
> + u32 ctx_cnt = 0, synced_cnt = 0;
> + bool ret = false;
> +
> + /* pick out the used ctxs */
> + for (i = 0; i < cam->max_stream_num; i++) {
> + if (!(1 << i & req->ctx_used))
> + continue;
> +
> + sync_ctx[ctx_cnt] = &cam->ctxs[i];
> + ctx_cnt++;
> + }
> +
> + mutex_lock(&req->fs.op_lock);
> + if (ctx_cnt > 1) {
> + /* multi sensor case */
multi sensor is advanced function, so separate multi sensor related code to a multi sensor patch.
Regards,
CK
> + req->fs.on_cnt++;
> + /* not first time */
> + if (req->fs.on_cnt != 1)
> + goto EXIT;
> +
> + for (i = 0; i < ctx_cnt; i++) {
> + ctx = sync_ctx[i];
> + spin_lock(&ctx->streaming_lock);
> + if (!ctx->streaming) {
> + spin_unlock(&ctx->streaming_lock);
> + dev_info(cam->dev,
> + "%s: ctx(%d): is streamed off\n",
> + __func__, ctx->stream_id);
> + continue;
> + }
> + spin_unlock(&ctx->streaming_lock);
> +
> + /* update sensor frame sync */
> + if (ctx->synced)
> + synced_cnt++;
> + }
> +
> + /*
> + * the prepared sensor is no enough, skip
> + * frame sync set failed or stream off
> + */
> + if (synced_cnt < 2) {
> + mtk_cam_fs_reset(&req->fs);
> + dev_info(cam->dev, "%s:%s: sensor is not ready\n",
> + __func__, req->req.debug_str);
> + goto EXIT;
> + }
> +
> + dev_dbg(cam->dev, "%s:%s:fs_sync_frame(1): ctxs: 0x%x\n",
> + __func__, req->req.debug_str, req->ctx_used);
> +
> + ret = true;
> + goto EXIT;
> + }
> + /* single sensor case: unsupported sensor hardware sync */
> +
> +EXIT:
> + dev_dbg(cam->dev, "%s:%s:target/on/off(%d/%d/%d)\n", __func__,
> + req->req.debug_str, req->fs.target, req->fs.on_cnt,
> + req->fs.off_cnt);
> + mutex_unlock(&req->fs.op_lock);
> + return ret;
> +}
> +
Powered by blists - more mailing lists