Commit 62596705 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

media: atomisp: return errors from ia_css_dma_configure_from_info()



Now that the pipeline config functions can return errors, change
ia_css_dma_configure_from_info() and callers in order for them
to return errors at pipelines instead of using assert().

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 874da1fd
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -41,13 +41,18 @@ int ia_css_crop_config(struct sh_css_isp_crop_isp_config *to,
		       unsigned int size)
{
	unsigned int elems_a = ISP_VEC_NELEMS;
	int ret;

	ret = ia_css_dma_configure_from_info(&to->port_b, from->info);
	if (ret)
		return ret;

	(void)size;
	ia_css_dma_configure_from_info(&to->port_b, from->info);
	to->width_a_over_b = elems_a / to->port_b.elems;

	/* Assume divisiblity here, may need to generalize to fixed point. */
	assert(elems_a % to->port_b.elems == 0);
	if (elems_a % to->port_b.elems != 0)
		return -EINVAL;

	return 0;
}

+8 −3
Original line number Diff line number Diff line
@@ -56,13 +56,18 @@ int ia_css_fpn_config(struct sh_css_isp_fpn_isp_config *to,
		      unsigned int size)
{
	unsigned int elems_a = ISP_VEC_NELEMS;
	int ret;

	ret = ia_css_dma_configure_from_info(&to->port_b, from->info);
	if (ret)
		return ret;

	(void)size;
	ia_css_dma_configure_from_info(&to->port_b, from->info);
	to->width_a_over_b = elems_a / to->port_b.elems;

	/* Assume divisiblity here, may need to generalize to fixed point. */
	assert(elems_a % to->port_b.elems == 0);
	if (elems_a % to->port_b.elems != 0)
		return -EINVAL;

	return 0;
}

+7 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ int ia_css_bayer_io_config(const struct ia_css_binary *binary,
						ddr_bits_per_element);
	unsigned int size_get = 0, size_put = 0;
	unsigned int offset = 0;
	int ret;

	if (binary->info->mem_offsets.offsets.param) {
		size_get = binary->info->mem_offsets.offsets.param->dmem.get.size;
@@ -51,7 +52,9 @@ int ia_css_bayer_io_config(const struct ia_css_binary *binary,
				    "ia_css_bayer_io_config() get part enter:\n");
#endif

		ia_css_dma_configure_from_info(&config, in_frame_info);
		ret = ia_css_dma_configure_from_info(&config, in_frame_info);
		if (ret)
			return ret;
		// The base_address of the input frame will be set in the ISP
		to->width = in_frame_info->res.width;
		to->height = in_frame_info->res.height;
@@ -77,7 +80,9 @@ int ia_css_bayer_io_config(const struct ia_css_binary *binary,
				    "ia_css_bayer_io_config() put part enter:\n");
#endif

		ia_css_dma_configure_from_info(&config, &out_frames[0]->info);
		ret = ia_css_dma_configure_from_info(&config, &out_frames[0]->info);
		if (ret)
			return ret;
		to->base_address = out_frames[0]->data;
		to->width = out_frames[0]->info.res.width;
		to->height = out_frames[0]->info.res.height;
+9 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ int ia_css_yuv444_io_config(const struct ia_css_binary *binary,
						ddr_bits_per_element);
	unsigned int size_get = 0, size_put = 0;
	unsigned int offset = 0;
	int ret;

	if (binary->info->mem_offsets.offsets.param) {
		size_get = binary->info->mem_offsets.offsets.param->dmem.get.size;
@@ -51,7 +52,10 @@ int ia_css_yuv444_io_config(const struct ia_css_binary *binary,
				    "ia_css_yuv444_io_config() get part enter:\n");
#endif

		ia_css_dma_configure_from_info(&config, in_frame_info);
		ret = ia_css_dma_configure_from_info(&config, in_frame_info);
		if (ret)
			return ret;

		// The base_address of the input frame will be set in the ISP
		to->width = in_frame_info->res.width;
		to->height = in_frame_info->res.height;
@@ -77,7 +81,10 @@ int ia_css_yuv444_io_config(const struct ia_css_binary *binary,
				    "ia_css_yuv444_io_config() put part enter:\n");
#endif

		ia_css_dma_configure_from_info(&config, &out_frames[0]->info);
		ret = ia_css_dma_configure_from_info(&config, &out_frames[0]->info);
		if (ret)
			return ret;

		to->base_address = out_frames[0]->data;
		to->width = out_frames[0]->info.res.width;
		to->height = out_frames[0]->info.res.height;
+8 −3
Original line number Diff line number Diff line
@@ -57,16 +57,21 @@ int ia_css_output_config(struct sh_css_isp_output_isp_config *to,
			 unsigned int size)
{
	unsigned int elems_a = ISP_VEC_NELEMS;
	int ret;

	ret = ia_css_dma_configure_from_info(&to->port_b, from->info);
	if (ret)
		return ret;

	(void)size;
	ia_css_dma_configure_from_info(&to->port_b, from->info);
	to->width_a_over_b = elems_a / to->port_b.elems;
	to->height = from->info ? from->info->res.height : 0;
	to->enable = from->info != NULL;
	ia_css_frame_info_to_frame_sp_info(&to->info, from->info);

	/* Assume divisiblity here, may need to generalize to fixed point. */
	assert(elems_a % to->port_b.elems == 0);
	if (elems_a % to->port_b.elems != 0)
		return -EINVAL;

	return 0;
}

Loading