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

media: atomisp: simplify sh_css_defs.h



There are several unused macros. Simplify the logic there, making
it closer to the Intel Aero driver and the corresponding firmware,
as this is what we have widely available for this device.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent da8fdf49
Loading
Loading
Loading
Loading
+7 −21
Original line number Diff line number Diff line
@@ -3617,19 +3617,11 @@ int atomisp_cp_lsc_table(struct atomisp_sub_device *asd,
	}

	/* Shading table size per color */
	if (!IS_ISP2401) {
		if (st->width > ISP2400_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR ||
		    st->height > ISP2400_SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR) {
			dev_err(asd->isp->dev, "shading table w/h validate failed!");
			return -EINVAL;
		}
	} else {
		if (st->width > ISP2401_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR ||
		    st->height > ISP2401_SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR) {
	if (st->width > SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR ||
	    st->height > SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR) {
		dev_err(asd->isp->dev, "shading table w/h validate failed!");
		return -EINVAL;
	}
	}

	shading_table = atomisp_css_shading_table_alloc(st->width, st->height);
	if (!shading_table)
@@ -6181,15 +6173,9 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd,
	}

	/* Shading table size per color */
	if (!IS_ISP2401) {
		if (user_shading_table->width > ISP2400_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR ||
		    user_shading_table->height > ISP2400_SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR)
	if (user_shading_table->width > SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR ||
	    user_shading_table->height > SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR)
		return -EINVAL;
	} else {
		if (user_shading_table->width > ISP2401_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR ||
		    user_shading_table->height > ISP2401_SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR)
			return -EINVAL;
	}

	shading_table = atomisp_css_shading_table_alloc(
			    user_shading_table->width, user_shading_table->height);
+2 −2
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ struct ia_css_preview_settings {

	/* 2401 only for these two - do we in fact use them for anything real */
	struct ia_css_frame *delay_frames[MAX_NUM_VIDEO_DELAY_FRAMES];
	struct ia_css_frame *tnr_frames[NUM_TNR_FRAMES];
	struct ia_css_frame *tnr_frames[NUM_VIDEO_TNR_FRAMES];

	struct ia_css_pipe *copy_pipe;
	struct ia_css_pipe *capture_pipe;
@@ -81,7 +81,7 @@ struct ia_css_video_settings {
	struct ia_css_binary vf_pp_binary;
	struct ia_css_binary *yuv_scaler_binary;
	struct ia_css_frame *delay_frames[MAX_NUM_VIDEO_DELAY_FRAMES];
	struct ia_css_frame *tnr_frames[NUM_TNR_FRAMES];
	struct ia_css_frame *tnr_frames[NUM_VIDEO_TNR_FRAMES];
	struct ia_css_frame *vf_pp_in_frame;
	struct ia_css_pipe *copy_pipe;
	struct ia_css_pipe *capture_pipe;
+3 −3
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ int ia_css_tnr_config(struct sh_css_isp_tnr_isp_config *to,
		return ret;
	to->width_a_over_b = elems_a / to->port_b.elems;
	to->frame_height = from->tnr_frames[0]->info.res.height;
	for (i = 0; i < NUM_TNR_FRAMES; i++) {
	for (i = 0; i < NUM_VIDEO_TNR_FRAMES; i++) {
		to->tnr_frame_addr[i] = from->tnr_frames[i]->data +
					from->tnr_frames[i]->planes.yuyv.offset;
	}
@@ -102,7 +102,7 @@ int ia_css_tnr_configure(const struct ia_css_binary *binary,
	struct ia_css_tnr_configuration config;
	unsigned int i;

	for (i = 0; i < NUM_TNR_FRAMES; i++)
	for (i = 0; i < NUM_VIDEO_TNR_FRAMES; i++)
		config.tnr_frames[i] = frames[i];

	return ia_css_configure_tnr(binary, &config);
@@ -115,7 +115,7 @@ ia_css_init_tnr_state(
{
	(void)size;

	assert(NUM_TNR_FRAMES >= 2);
	assert(NUM_VIDEO_TNR_FRAMES >= 2);
	assert(sizeof(*state) == size);
	state->tnr_in_buf_idx = 0;
	state->tnr_out_buf_idx = 1;
+2 −2
Original line number Diff line number Diff line
@@ -28,14 +28,14 @@ struct sh_css_isp_tnr_params {
};

struct ia_css_tnr_configuration {
	const struct ia_css_frame *tnr_frames[NUM_TNR_FRAMES];
	const struct ia_css_frame *tnr_frames[NUM_VIDEO_TNR_FRAMES];
};

struct sh_css_isp_tnr_isp_config {
	u32 width_a_over_b;
	u32 frame_height;
	struct dma_port_config port_b;
	ia_css_ptr tnr_frame_addr[NUM_TNR_FRAMES];
	ia_css_ptr tnr_frame_addr[NUM_VIDEO_TNR_FRAMES];
};

#endif /* __IA_CSS_TNR_PARAM_H */
+2 −2
Original line number Diff line number Diff line
@@ -154,9 +154,9 @@ more details.
/* [isp vmem] table size[vectors] per line per color (GR,R,B,GB),
   multiples of NWAY */
#define ISP2400_SCTBL_VECTORS_PER_LINE_PER_COLOR \
	CEIL_DIV(ISP2400_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR, ISP_VEC_NELEMS)
	CEIL_DIV(SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR, ISP_VEC_NELEMS)
#define ISP2401_SCTBL_VECTORS_PER_LINE_PER_COLOR \
	CEIL_DIV(ISP2401_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR, ISP_VEC_NELEMS)
	CEIL_DIV(SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR, ISP_VEC_NELEMS)
/* [isp vmem] table size[vectors] per line for 4colors (GR,R,B,GB),
   multiples of NWAY */
#define SCTBL_VECTORS_PER_LINE \
Loading