[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <42224ac92b95b3fec2c7df429d3f1016b67b38a3.camel@mediatek.com>
Date: Mon, 14 Oct 2024 09:25:47 +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 03/10] media: platform: mediatek: add isp_7x seninf
unit
Hi, Shu-hsiang:
On Wed, 2024-10-09 at 19:15 +0800, Shu-hsiang Yang wrote:
> Introduces the driver of the MediaTek Sensor Interface,
> focusing on integration with the MediaTek ISP CAMSYS. The
> seninf device bridges camera sensors and the ISP system,
> providing management for sensor data routing and processing.
> Key features include V4L2 framework control, and dynamic
> handling of stream configurations and virtual channels.
>
> Signed-off-by: Shu-hsiang Yang <Shu-hsiang.Yang@...iatek.com>
> ---
[snip]
> +static int set_test_model(struct seninf_ctx *ctx, char enable)
> +{
Without test code, this driver still work, so test code is advanced function.
Separate test code to a test patch.
Regards,
CK
> + struct seninf_vc *vc[] = { NULL, NULL, NULL, NULL, NULL };
> + int i = 0, ret = 0, vc_used = 0;
> + struct seninf_mux *mux;
> + int pref_idx[] = { 0, 1, 2, 3, 4 };
> +
> + if (ctx->is_test_model == 1) {
> + vc[vc_used++] = mtk_cam_seninf_get_vc_by_pad(ctx, PAD_SRC_RAW0);
> + } else if (ctx->is_test_model == 2) {
> + vc[vc_used++] = mtk_cam_seninf_get_vc_by_pad(ctx, PAD_SRC_RAW0);
> + vc[vc_used++] = mtk_cam_seninf_get_vc_by_pad(ctx, PAD_SRC_RAW1);
> + vc[vc_used++] = mtk_cam_seninf_get_vc_by_pad(ctx, PAD_SRC_RAW2);
> + } else if (ctx->is_test_model == 3) {
> + vc[vc_used++] = mtk_cam_seninf_get_vc_by_pad(ctx, PAD_SRC_RAW0);
> + vc[vc_used++] = mtk_cam_seninf_get_vc_by_pad(ctx, PAD_SRC_PDAF0);
> + } else {
> + dev_info(ctx->dev, "testmodel%d invalid\n", ctx->is_test_model);
> + return -1;
> + }
> +
> + for (; i < vc_used; ++i) {
> + if (!vc[i]) {
> + dev_info(ctx->dev, "vc not found\n");
> + return -1;
> + }
> + }
> +
> + if (enable) {
> + ret = pm_runtime_resume_and_get(ctx->dev);
> + if (ret < 0) {
> + dev_info(ctx->dev, "failed at pm_runtime_resume_and_get\n");
> + return ret;
> + }
> +
> + if (ctx->core->clk[CLK_TOP_CAMTM])
> + ret = clk_prepare_enable(ctx->core->clk[CLK_TOP_CAMTM]);
> + if (ret)
> + return ret;
> +
> + for (i = 0; i < vc_used; ++i) {
> + mux = mtk_cam_seninf_mux_get_pref(ctx,
> + pref_idx,
> + ARRAY_SIZE(pref_idx));
> + if (!mux)
> + return -EBUSY;
> + vc[i]->mux = mux->idx;
> + vc[i]->cam = ctx->pad2cam[vc[i]->out_pad];
> + vc[i]->enable = 1;
> +
> + dev_info(ctx->dev,
> + "test mode mux %d, cam %d, pixel mode %d\n",
> + vc[i]->mux, vc[i]->cam, vc[i]->pixel_mode);
> +
> + mtk_cam_seninf_set_test_model(ctx, vc[i]->mux,
> + vc[i]->cam,
> + vc[i]->pixel_mode);
> +
> + if (vc[i]->out_pad == PAD_SRC_PDAF0)
> + mdelay(40);
> + else
> + usleep_range(40, 60);
> + }
> + } else {
> + mtk_cam_seninf_set_idle(ctx);
> + mtk_cam_seninf_release_mux(ctx);
> +
> + if (ctx->core->clk[CLK_TOP_CAMTM])
> + clk_disable_unprepare(ctx->core->clk[CLK_TOP_CAMTM]);
> +
> + pm_runtime_put_sync(ctx->dev);
> + }
> +
> + ctx->streaming = enable;
> +
> + return 0;
> +}
> +
Powered by blists - more mailing lists