From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "sumit.semwal@linaro.org" <sumit.semwal@linaro.org>,
"christian.koenig@amd.com" <christian.koenig@amd.com>,
"mchehab@kernel.org" <mchehab@kernel.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"robh@kernel.org" <robh@kernel.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Shu-hsiang Yang (楊舒翔)" <Shu-hsiang.Yang@mediatek.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"yunkec@chromium.org" <yunkec@chromium.org>,
"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"Yaya Chang (張雅清)" <Yaya.Chang@mediatek.com>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"Teddy Chen (陳乾元)" <Teddy.Chen@mediatek.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"hidenorik@chromium.org" <hidenorik@chromium.org>,
"Shun-Yi Wang (王順億)" <Shun-Yi.Wang@mediatek.com>
Subject: Re: [PATCH v1 04/10] media: platform: mediatek: add isp_7x cam-raw unit
Date: Tue, 22 Oct 2024 06:14:34 +0000 [thread overview]
Message-ID: <7f8c4425a0fd3c6bcad281465788b9d947ee987d.camel@mediatek.com> (raw)
In-Reply-To: <20241009111551.27052-5-Shu-hsiang.Yang@mediatek.com>
Hi, Shu-hsiang:
On Wed, 2024-10-09 at 19:15 +0800, Shu-hsiang Yang wrote:
> Introduces the ISP pipeline driver for the MediaTek ISP raw and yuv
> modules. Key functionalities include data processing, V4L2 integration,
> resource management, debug support, and various control operations.
> Additionally, IRQ handling, platform device management, and MediaTek
> ISP DMA format support are also included.
>
> Signed-off-by: Shu-hsiang Yang <Shu-hsiang.Yang@mediatek.com>
> ---
[snip]
> +static bool mtk_cam_raw_resource_calc(struct mtk_cam_device *cam,
> + struct mtk_cam_resource_config *res,
> + s64 pixel_rate, int res_plan,
> + int in_w, int in_h, int *out_w, int *out_h)
> +{
> + int res_step_type = 0;
> + int tgo_pxl_mode = 1;
> + int pixel_mode[MTK_CAMSYS_RES_STEP_NUM] = {0};
> + int bin_temp = 0, frz_temp = 0, hwn_temp = 0;
> + int bin_en = 0, frz_en = 0, twin_en = 0, clk_cur = 0;
> + int idx = 0, clk_res = 0, idx_res = 0;
> + bool res_found = false;
> + int lb_chk_res = -1;
> + int frz_ratio = 100;
> + int p;
> +
> + res->res_plan = res_plan;
> + res->pixel_rate = pixel_rate;
> + /* test pattern */
> + if (res->pixel_rate == 0)
> + res->pixel_rate = 450 * MHz;
> + dev_dbg(cam->dev,
> + "[Res] PR = %lld, w/h=%d/%d HWN(%d)/BIN(%d)/FRZ(%d),Plan:%d\n",
> + res->pixel_rate, in_w, in_h,
> + res->hwn_limit_max, res->bin_limit, res->frz_limit, res->res_plan);
> +
> + memcpy(res->res_strategy, raw_resource_strategy_plan + res->res_plan,
> + MTK_CAMSYS_RES_STEP_NUM * sizeof(int));
> + res->bin_enable = 0;
> + res->raw_num_used = 1;
> + res->frz_enable = 0;
> + res->frz_ratio = frz_ratio;
> + for (idx = 0; idx < MTK_CAMSYS_RES_STEP_NUM ; idx++) {
> + res_step_type = res->res_strategy[idx] & MTK_CAMSYS_RES_IDXMASK;
> + switch (res_step_type) {
> + case MTK_CAMSYS_RES_BIN_TAG:
> + bin_temp = res->res_strategy[idx] - E_RES_BIN_S;
> + if (bin_temp <= res->bin_limit)
> + bin_en = bin_temp;
> + if (bin_en && frz_en)
> + frz_en = 0;
> + break;
> + case MTK_CAMSYS_RES_FRZ_TAG:
> + frz_temp = res->res_strategy[idx] - E_RES_FRZ_S;
> + if (res->frz_limit < 100)
> + frz_en = frz_temp;
> + break;
> + case MTK_CAMSYS_RES_HWN_TAG:
> + hwn_temp = res->res_strategy[idx] - E_RES_HWN_S;
> + if (hwn_temp + 1 <= res->hwn_limit_max)
> + twin_en = hwn_temp;
> + break;
> + case MTK_CAMSYS_RES_CLK_TAG:
> + clk_cur = res->res_strategy[idx] - E_RES_CLK_S;
> + break;
> + default:
> + break;
> + }
> +
> + /* 1 for force bin on */
> + if (res->bin_limit >= 1)
> + bin_en = 1;
> +
> + if (res->hwn_limit_min > 1)
> + twin_en = 1;
> +
> + /* max line buffer check*/
> + lb_chk_res = mtk_raw_linebuf_chk(twin_en, res->bin_limit & BIN_ON,
> + frz_en, res->bin_limit & QBND_ON,
> + is_cbn_en(res->bin_limit),
> + in_w, &frz_ratio);
> + /* frz ratio*/
> + if (res_step_type == MTK_CAMSYS_RES_FRZ_TAG) {
> + res->frz_ratio = res->frz_limit < FRZ_PXLMODE_THRES ?
> + res->frz_limit : FRZ_PXLMODE_THRES;
> + }
> + /*try 1-pixel mode first*/
> + for (p = 1; p <= MTK_CAMSYS_PROC_DEFAULT_PIXELMODE; p++) {
MTK_CAMSYS_PROC_DEFAULT_PIXELMODE is 1, so this for-loop could be dropped.
> + tgo_pxl_mode = mtk_raw_pixelmode_calc(p, twin_en,
> + bin_en, frz_en,
> + res->frz_ratio);
mtk_raw_pixelmode_calc() would always return 1, so mtk_raw_pixelmode_calc() could be dropped.
Regards,
CK
> + /**
> + * isp throughput along resource strategy
> + * (compared with pixel rate)
> + */
> + pixel_mode[idx] = tgo_pxl_mode;
> +
> + /* only support 1-pixel mode */
> + if (p == 1 && lb_chk_res == LB_CHECK_OK) {
> + if (!res_found) {
> + res->bin_enable = bin_en;
> + res->frz_enable = frz_en;
> + res->raw_num_used = twin_en + 1;
> + clk_res = clk_cur;
> + idx_res = idx;
> + res_found = true;
> + break;
> + }
> + }
> + }
> + dev_dbg(cam->dev,
> + "Res-%d B/F/H/C=%d/%d/%d/%d -> %d/%d/%d/%d (%d)(%d)\n",
> + idx, bin_temp, frz_temp, hwn_temp, clk_cur, bin_en,
> + frz_en, twin_en, clk_cur, lb_chk_res, pixel_mode[idx]);
> + }
> +
> + tgo_pxl_mode = pixel_mode[idx_res];
> + switch (tgo_pxl_mode) {
> + case 1:
> + res->tgo_pxl_mode = 0;
> + break;
> + case 2:
> + res->tgo_pxl_mode = 1;
> + break;
> + case 4:
> + res->tgo_pxl_mode = 2;
> + break;
> + case 8:
> + res->tgo_pxl_mode = 3;
> + break;
> + default:
> + break;
> + }
> +
> + mtk_raw_update_debug_param(cam, res, &clk_res);
> +
> + if (res_found) {
> + dev_info(cam->dev,
> + "Res-end:%d BIN/FRZ/HWN/CLK/pxl=%d/%d(%d)/%d/%d/%d, clk:%d\n",
> + idx_res, res->bin_enable, res->frz_enable, res->frz_ratio,
> + res->raw_num_used, clk_res, res->tgo_pxl_mode,
> + res->clk_target);
> + } else {
> + dev_dbg(cam->dev, "[%s] Error resource result\n", __func__);
> + }
> + if (res->bin_enable) {
> + *out_w = in_w >> 1;
> + *out_h = in_h >> 1;
> + } else if (res->frz_enable) {
> + *out_w = in_w * res->frz_ratio / 100;
> + *out_h = in_h * res->frz_ratio / 100;
> + } else {
> + *out_w = in_w;
> + *out_h = in_h;
> + }
> +
> + return res_found;
> +}
> +
next prev parent reply other threads:[~2024-10-22 6:14 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 11:15 [PATCH v1 00/10] Add MediaTek ISP7 camera system driver Shu-hsiang Yang
2024-10-09 11:15 ` [PATCH v1 01/10] dt-bindings: media: mediatek: add camsys device Shu-hsiang Yang
2024-10-09 21:00 ` Rob Herring
2024-10-11 1:29 ` CK Hu (胡俊光)
2024-10-11 3:20 ` CK Hu (胡俊光)
2024-10-22 5:36 ` Krzysztof Kozlowski
2024-11-11 1:37 ` CK Hu (胡俊光)
2024-11-11 2:38 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 02/10] media: platform: mediatek: add seninf controller Shu-hsiang Yang
2024-10-09 12:50 ` AngeloGioacchino Del Regno
2024-10-11 1:36 ` CK Hu (胡俊光)
2024-10-11 2:38 ` CK Hu (胡俊光)
2024-10-22 4:16 ` CK Hu (胡俊光)
2024-10-28 1:55 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 03/10] media: platform: mediatek: add isp_7x seninf unit Shu-hsiang Yang
2024-10-14 9:25 ` CK Hu (胡俊光)
2024-10-18 8:54 ` CK Hu (胡俊光)
2024-10-28 1:27 ` CK Hu (胡俊光)
2024-10-28 1:30 ` CK Hu (胡俊光)
2024-11-06 5:58 ` CK Hu (胡俊光)
2024-11-18 9:23 ` CK Hu (胡俊光)
2024-11-18 9:28 ` CK Hu (胡俊光)
2024-11-19 1:46 ` CK Hu (胡俊光)
2024-11-19 1:50 ` CK Hu (胡俊光)
2024-11-20 6:35 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 04/10] media: platform: mediatek: add isp_7x cam-raw unit Shu-hsiang Yang
2024-10-10 12:49 ` AngeloGioacchino Del Regno
2024-10-11 2:23 ` CK Hu (胡俊光)
2024-10-11 2:55 ` CK Hu (胡俊光)
2024-10-11 5:40 ` CK Hu (胡俊光)
2024-10-11 6:03 ` CK Hu (胡俊光)
2024-10-22 5:43 ` Krzysztof Kozlowski
2024-10-22 6:14 ` CK Hu (胡俊光) [this message]
2024-10-22 6:30 ` CK Hu (胡俊光)
2024-10-23 10:05 ` CK Hu (胡俊光)
2024-10-25 6:30 ` CK Hu (胡俊光)
2024-10-28 6:48 ` CK Hu (胡俊光)
2024-11-04 2:35 ` CK Hu (胡俊光)
2024-11-04 8:04 ` CK Hu (胡俊光)
2024-11-05 3:01 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 05/10] media: platform: mediatek: add isp_7x camsys unit Shu-hsiang Yang
2024-10-14 9:40 ` CK Hu (胡俊光)
2024-10-16 3:43 ` CK Hu (胡俊光)
2024-11-19 5:56 ` CK Hu (胡俊光)
2024-10-22 5:44 ` Krzysztof Kozlowski
2024-10-22 6:48 ` CK Hu (胡俊光)
2024-10-29 2:35 ` CK Hu (胡俊光)
2024-10-29 6:47 ` CK Hu (胡俊光)
2024-10-29 7:03 ` CK Hu (胡俊光)
2024-10-30 3:20 ` CK Hu (胡俊光)
2024-10-30 5:43 ` CK Hu (胡俊光)
2024-11-04 6:08 ` CK Hu (胡俊光)
2024-11-04 13:06 ` [PATCH " Markus Elfring
2024-11-06 7:52 ` [PATCH v1 " CK Hu (胡俊光)
2024-11-13 7:24 ` CK Hu (胡俊光)
2024-11-20 6:10 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 06/10] media: platform: mediatek: add isp_7x utility Shu-hsiang Yang
2024-10-14 5:21 ` CK Hu (胡俊光)
2024-10-22 5:30 ` CK Hu (胡俊光)
2024-10-28 3:46 ` CK Hu (胡俊光)
2024-10-29 5:35 ` CK Hu (胡俊光)
2024-11-04 2:26 ` CK Hu (胡俊光)
2024-11-05 3:33 ` CK Hu (胡俊光)
2024-11-05 8:43 ` CK Hu (胡俊光)
2024-11-05 9:14 ` CK Hu (胡俊光)
2024-11-06 3:35 ` CK Hu (胡俊光)
2024-11-06 3:41 ` CK Hu (胡俊光)
2024-11-06 3:48 ` CK Hu (胡俊光)
2024-11-06 7:01 ` CK Hu (胡俊光)
2024-11-19 8:23 ` CK Hu (胡俊光)
2024-11-19 8:29 ` CK Hu (胡俊光)
2024-11-19 9:41 ` CK Hu (胡俊光)
2024-11-20 2:21 ` CK Hu (胡俊光)
2024-11-20 6:03 ` CK Hu (胡俊光)
2024-11-20 5:21 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 07/10] media: platform: mediatek: add isp_7x video ops Shu-hsiang Yang
2024-11-04 3:24 ` CK Hu (胡俊光)
2024-11-20 1:05 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 08/10] media: platform: mediatek: add isp_7x state ctrl Shu-hsiang Yang
2024-10-16 1:35 ` CK Hu (胡俊光)
2024-10-28 5:20 ` CK Hu (胡俊光)
2024-10-28 5:25 ` CK Hu (胡俊光)
2024-10-28 5:34 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 09/10] media: platform: mediatek: add isp_7x build config Shu-hsiang Yang
2024-10-16 1:56 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 10/10] uapi: linux: add mediatek isp_7x camsys user api Shu-hsiang Yang
2024-10-11 7:47 ` CK Hu (胡俊光)
2024-10-14 5:56 ` CK Hu (胡俊光)
2024-11-06 13:04 ` Laurent Pinchart
2024-11-18 9:58 ` Laurent Pinchart
2024-11-05 5:36 ` CK Hu (胡俊光)
2024-10-15 18:40 ` [PATCH v1 00/10] Add MediaTek ISP7 camera system driver Nicolas Dufresne
2024-11-18 10:00 ` Laurent Pinchart
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=7f8c4425a0fd3c6bcad281465788b9d947ee987d.camel@mediatek.com \
--to=ck.hu@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=Shu-hsiang.Yang@mediatek.com \
--cc=Shun-Yi.Wang@mediatek.com \
--cc=Teddy.Chen@mediatek.com \
--cc=Yaya.Chang@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=christian.koenig@amd.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hidenorik@chromium.org \
--cc=krzk+dt@kernel.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=yunkec@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).