Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "robh@kernel.org" <robh@kernel.org>,
	"mchehab@kernel.org" <mchehab@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"Bo Kong (孔波)" <Bo.Kong@mediatek.com>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>
Subject: Re: [PATCH v3 3/4] media: mediatek: add MT8188 AIE driver
Date: Mon, 30 Dec 2024 07:39:29 +0000	[thread overview]
Message-ID: <22a0b72681f290eac5364c43160c339b4b3c53b9.camel@mediatek.com> (raw)
In-Reply-To: <20241225090113.17027-4-bo.kong@mediatek.com>

On Wed, 2024-12-25 at 17:00 +0800, bo.kong wrote:
> From: Bo Kong <Bo.Kong@mediatek.com>
> 
> Add a V4L2 sub-device driver for MT8188 AIE.
> 
> Signed-off-by: Bo Kong <Bo.Kong@mediatek.com>
> ---

[snip]

> +static int mtk_aie_ctrl_type_op_validate(const struct v4l2_ctrl *ctrl,
> +					 union v4l2_ctrl_ptr ptr)
> +{
> +	struct mtk_aie_ctx *ctx = ctrl_to_ctx(ctrl);
> +	struct mtk_aie_dev *fd;
> +	struct v4l2_ctrl_aie_init *p_aie_init;
> +	struct v4l2_ctrl_aie_param *p_aie_param;
> +
> +	if (!ctx)
> +		return -EINVAL;
> +
> +	fd = ctx->fd_dev;
> +
> +	switch (ctrl->id) {
> +	case V4L2_CID_MTK_AIE_PARAM:
> +		p_aie_param = ptr.p;
> +
> +		switch (p_aie_param->fd_mode) {
> +		case FDMODE:
> +		case ATTRIBUTEMODE:
> +		case FLDMODE:
> +			break;
> +		default:
> +			dev_err(ctx->dev, "AIE err:  mode: %d\n", p_aie_param->fd_mode);
> +				return -EINVAL;
> +		}
> +
> +		switch (p_aie_param->src_img_fmt) {
> +		case FMT_YUV_2P:
> +		case FMT_YVU_2P:
> +		case FMT_YUYV:
> +		case FMT_YVYU:
> +		case FMT_UYVY:
> +		case FMT_VYUY:
> +		case FMT_MONO:
> +		case FMT_YUV420_2P:
> +		case FMT_YUV420_1P:
> +			break;
> +		default:
> +			dev_err(ctx->dev, "AIE err:  fmt: %d\n", p_aie_param->src_img_fmt);
> +			return -EINVAL;
> +		}
> +
> +		if (p_aie_param->src_img_width >
> +				fd->base_para->max_img_width ||
> +			p_aie_param->src_img_height >
> +				fd->base_para->max_img_height ||
> +			p_aie_param->src_img_width == 0 ||
> +			p_aie_param->src_img_height == 0) {

Why max_img_width and max_img_height is passed from user space?
I think it's the hardware limitation and should be defined in driver.

Regards,
CK

> +			dev_err(fd->dev, "AIE err: Src_WD: %d Src_HT: %d\n",
> +				p_aie_param->src_img_width,
> +				p_aie_param->src_img_height);
> +
> +			dev_err(fd->dev,
> +				"AIE err: MAX_Src_WD: %d MAX_Src_HT: %d\n",
> +				fd->base_para->max_img_width,
> +				fd->base_para->max_img_height);
> +
> +			return -EINVAL;
> +		}
> +
> +		if (p_aie_param->pyramid_base_width
> +				> fd->base_para->max_pyramid_width ||
> +			p_aie_param->pyramid_base_height
> +				> fd->base_para->max_pyramid_height ||
> +			p_aie_param->number_of_pyramid > 3 ||
> +			p_aie_param->number_of_pyramid <= 0) {
> +			dev_err(fd->dev, "AIE err: base w: %d h: %d num: %d\n",
> +				p_aie_param->pyramid_base_width,
> +				p_aie_param->pyramid_base_height,
> +				p_aie_param->number_of_pyramid);
> +
> +			dev_err(fd->dev, "AIE err: max w: %d h: %d\n",
> +				fd->base_para->max_pyramid_width,
> +				fd->base_para->max_pyramid_height);
> +
> +			return -EINVAL;
> +		}
> +
> +		break;
> +
> +	case V4L2_CID_MTK_AIE_INIT:
> +		p_aie_init = ptr.p;
> +		if (!p_aie_init->max_img_width || !p_aie_init->max_img_height ||
> +		    !p_aie_init->pyramid_width || !p_aie_init->pyramid_height) {
> +			dev_err(fd->dev,
> +				"AIE INIT err: max_w: %d max_h: %d, p_w: %d p_h: %d\n",
> +				p_aie_init->max_img_width, p_aie_init->max_img_height,
> +				p_aie_init->pyramid_width, p_aie_init->pyramid_height);
> +
> +			return -EINVAL;
> +		}
> +
> +		break;
> +
> +	default:
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +


  parent reply	other threads:[~2024-12-30  7:39 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-25  9:00 [PATCH v3 0/4] Add AIE Driver bo.kong
2024-12-25  9:00 ` [PATCH v3 1/4] arm64: dts: mt8188: add aie node bo.kong
2024-12-25  9:00 ` [PATCH v3 2/4] media: dt-bindings: add MT8188 AIE bo.kong
2024-12-25 10:29   ` Rob Herring (Arm)
2024-12-25 11:28   ` Krzysztof Kozlowski
2024-12-26  3:41   ` CK Hu (胡俊光)
2024-12-25  9:00 ` [PATCH v3 3/4] media: mediatek: add MT8188 AIE driver bo.kong
2024-12-25 11:35   ` Krzysztof Kozlowski
2024-12-26  3:53   ` CK Hu (胡俊光)
2024-12-26  5:20   ` CK Hu (胡俊光)
2024-12-26  5:36   ` CK Hu (胡俊光)
2024-12-26  6:09   ` CK Hu (胡俊光)
2024-12-26  6:50   ` CK Hu (胡俊光)
2024-12-26  7:38   ` CK Hu (胡俊光)
2024-12-27  3:23   ` CK Hu (胡俊光)
2024-12-27  3:54   ` CK Hu (胡俊光)
2024-12-27  5:56   ` CK Hu (胡俊光)
2024-12-27  6:05   ` CK Hu (胡俊光)
2024-12-31  7:45     ` Krzysztof Kozlowski
2024-12-31  7:57       ` CK Hu (胡俊光)
2024-12-31  8:07         ` Krzysztof Kozlowski
2024-12-31  8:13           ` CK Hu (胡俊光)
2024-12-30  7:39   ` CK Hu (胡俊光) [this message]
2025-01-07 15:32   ` AngeloGioacchino Del Regno
2024-12-25  9:00 ` [PATCH v3 4/4] uapi: linux: add MT8188 AIE bo.kong
2024-12-26  6:36   ` CK Hu (胡俊光)
2024-12-31  6:55   ` CK Hu (胡俊光)

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=22a0b72681f290eac5364c43160c339b4b3c53b9.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=Bo.Kong@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.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 \
    /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