[PATCH v1 04/10] media: platform: mediatek: add isp_7x cam-raw unit

CK Hu (胡俊光) ck.hu at mediatek.com
Wed Oct 23 03:05:06 PDT 2024


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 at mediatek.com>
> ---

[snip]

> +static int mtk_cam_raw_try_res_ctrl(struct mtk_raw_pipeline *pipeline,
> +				    struct mtk_cam_resource *res_user,
> +				    struct mtk_cam_resource_config *res_cfg,
> +				    struct v4l2_mbus_framefmt *sink_fmt)
> +{
> +	s64 prate = 0;
> +	int width, height;
> +	struct device *dev = pipeline->raw->devs[pipeline->id];
> +
> +	res_cfg->bin_limit = res_user->raw_res.bin; /* 1: force bin on */
> +	res_cfg->frz_limit = 0;
> +	res_cfg->hwn_limit_max = res_user->raw_res.raw_max;
> +	res_cfg->hwn_limit_min = res_user->raw_res.raw_min;
> +	res_cfg->hblank = res_user->sensor_res.hblank;
> +	res_cfg->vblank = res_user->sensor_res.vblank;
> +	res_cfg->sensor_pixel_rate = res_user->sensor_res.pixel_rate;
> +	res_cfg->res_plan = res_user->raw_res.strategy;
> +	res_cfg->raw_feature = res_user->raw_res.feature;
> +	res_cfg->raw_path = res_user->raw_res.path_sel;
> +
> +	if (res_user->sensor_res.cust_pixel_rate)
> +		prate = res_user->sensor_res.cust_pixel_rate;
> +	else if (mtk_cam_feature_is_pure_m2m(res_cfg->raw_feature))
> +		prate = mtk_cam_calc_pure_m2m_pixelrate(sink_fmt->width,
> +							sink_fmt->height,
> +							&res_cfg->interval);
> +	else
> +		prate = mtk_cam_seninf_calc_pixelrate(pipeline->raw->cam_dev,
> +						      sink_fmt->width,
> +						      sink_fmt->height,
> +						      res_user->sensor_res.hblank,
> +						      res_user->sensor_res.vblank,
> +						      res_user->sensor_res.interval.denominator,
> +						      res_user->sensor_res.interval.numerator,
> +						      res_user->sensor_res.pixel_rate);
> +
> +	mtk_cam_raw_resource_calc(dev_get_drvdata(pipeline->raw->cam_dev),
> +				  res_cfg, prate, res_cfg->res_plan,
> +				  sink_fmt->width, sink_fmt->height,
> +				  &width, &height);

If the basic function support only imgo unprocessed, does the unprocessed path imply the resource could be fixed?
I mean it's not necessary to calculate resource when imgo unprocessed path.
If so, remove resource calculation related code in this basic patch and add it back in advance function patch.

Regards,
CK

> +
> +	if (res_user->raw_res.bin && !res_cfg->bin_enable) {
> +		dev_err(dev,
> +			"%s:pipe(%d): res calc failed on fource bin: user(%d)/bin_enable(%d)\n",
> +			__func__, pipeline->id,	res_user->raw_res.bin,
> +			res_cfg->bin_enable);
> +		return -EINVAL;
> +	}
> +
> +	if (res_cfg->raw_num_used > res_user->raw_res.raw_max ||
> +	    res_cfg->raw_num_used < res_user->raw_res.raw_min) {
> +		dev_err(dev,
> +			"%s:pipe(%d): res calc failed on raw used: user(%d/%d)/raw_num_used(%d)\n",
> +			__func__, pipeline->id, res_user->raw_res.raw_max,
> +			res_user->raw_res.raw_min, res_cfg->raw_num_used);
> +	}
> +
> +	res_user->raw_res.pixel_mode = res_cfg->tgo_pxl_mode;
> +	res_user->raw_res.raw_used = res_cfg->raw_num_used;
> +	if (res_cfg->bin_limit == BIN_AUTO)
> +		res_user->raw_res.bin = res_cfg->bin_enable;
> +	else
> +		res_user->raw_res.bin = res_cfg->bin_limit;
> +
> +	dev_info(dev,
> +		 "%s:pipe(%d): res calc result: raw_used(%d)/bin(%d)/pixelmode(%d)/strategy(%d)\n",
> +		 __func__, pipeline->id, res_user->raw_res.raw_used,
> +		 res_user->raw_res.bin, res_user->raw_res.pixel_mode,
> +		 res_user->raw_res.strategy);
> +
> +	/**
> +	 * Other output not reveal to user:
> +	 * res_cfg->res_strategy[MTK_CAMSYS_RES_STEP_NUM];
> +	 * res_cfg->clk_target;
> +	 * res_cfg->frz_enable;
> +	 * res_cfg->frz_ratio;
> +	 * res_cfg->tgo_pxl_mode;
> +	 */
> +	if (width != sink_fmt->width || height != sink_fmt->height) {
> +		dev_info(dev,
> +			 "%s:pipe(%d): size adjust info: raw: sink(%d,%d) res:(%d,%d)\n",
> +			__func__, pipeline->id, sink_fmt->width,
> +			sink_fmt->height, width, height);
> +	}
> +
> +	return 0;
> +}
> +



More information about the Linux-mediatek mailing list