Skip to content

Commit

Permalink
di: driver defect clean up
Browse files Browse the repository at this point in the history
PD#151224: driver defect clean up:

torvalds#227
torvalds#238~239
torvalds#249
torvalds#257~258
torvalds#285~287
torvalds#384
torvalds#466~467
torvalds#472~474
torvalds#585
torvalds#655
torvalds#659~660

Change-Id: I241d863318a8754c0e7c5fa1155247d99a21eb9e
Signed-off-by: KeLe Bai <[email protected]>
  • Loading branch information
KeLe Bai authored and akiernan committed Nov 3, 2022
1 parent b1b5d4c commit 2dfdb54
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
45 changes: 30 additions & 15 deletions drivers/amlogic/media/deinterlace/deinterlace.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,8 @@ show_vframe_status(struct device *dev,
{
int ret = 0;
struct vframe_states states;
struct vframe_provider_s *vfp;

vfp = vf_get_provider(VFM_NAME);
if (vfp && vfp->ops && vfp->ops->vf_states)
ret = vfp->ops->vf_states(&states, vfp->op_arg);
ret = vf_get_states_by_name(VFM_NAME, &states);

if (ret == 0) {
ret += sprintf(buf + ret, "vframe_pool_size=%d\n",
Expand All @@ -768,6 +765,7 @@ show_vframe_status(struct device *dev,
ret += sprintf(buf + ret, "vframe buf_avail_num=%d\n",
states.buf_avail_num);
} else {
ret = 0;
ret += sprintf(buf + ret, "vframe no states\n");
}

Expand Down Expand Up @@ -2181,7 +2179,10 @@ static int di_init_buf(int width, int height, unsigned char prog_flag)
di_post_mem = de_devp->mem_start + di_buf_size*local_buf_num;
di_post_buf_size = width * canvas_height*2;
/* pre buffer must 2 more than post buffer */
di_post_stru.di_post_num = local_buf_num - 2;
if ((local_buf_num - 2) > MAX_POST_BUF_NUM)
di_post_stru.di_post_num = MAX_POST_BUF_NUM;
else
di_post_stru.di_post_num = (local_buf_num - 2);
pr_info("DI: di post buffer size %u byte.\n", di_post_buf_size);
} else {
di_post_stru.di_post_num = MAX_POST_BUF_NUM;
Expand Down Expand Up @@ -3440,9 +3441,14 @@ static void pre_de_done_buf_config(void)
}
}
} else if ((pldn_cmb0 == 6) && (pldn_cmb1 == 6)) {
di_pre_stru.di_post_wr_buf->reg1_s = 60;
di_pre_stru.di_post_wr_buf->reg1_e = 180;
di_pre_stru.di_post_wr_buf->reg1_bmode = 0;
if (!IS_ERR_OR_NULL(
di_pre_stru.di_post_wr_buf)) {
di_pre_stru.di_post_wr_buf->reg1_s = 60;
di_pre_stru.di_post_wr_buf->reg1_e
= 180;
di_pre_stru.di_post_wr_buf->reg1_bmode
= 0;
}
}
}
field_count++;
Expand Down Expand Up @@ -3561,14 +3567,14 @@ static void pre_de_done_buf_config(void)
queue_in(
di_buf_tmp,
QUEUE_PRE_READY);
}
#ifdef DI_BUFFER_DEBUG
di_print(
"%s: dummy %s[%d] => pre_ready_list\n",
__func__,
vframe_type_name[di_buf_tmp->type],
di_buf_tmp->index);
#endif
}
}
}
di_pre_stru.di_wr_buf->seq =
Expand Down Expand Up @@ -3703,6 +3709,8 @@ static struct di_buf_s *get_free_linked_buf(int idx)
queue_out(di_buf_linked);
}
}
if (IS_ERR_OR_NULL(di_buf))
return NULL;
di_buf->di_wr_linked_buf = di_buf_linked;
}
return di_buf;
Expand Down Expand Up @@ -4668,12 +4676,13 @@ static void inc_post_ref_count(struct di_buf_s *di_buf)
{
/* int post_blend_mode; */

if (di_buf == NULL) {
if (IS_ERR_OR_NULL(di_buf)) {
pr_dbg("%s: Error\n", __func__);
if (recovery_flag == 0)
recovery_log_reason = 13;

recovery_flag++;
return;
}

if (di_buf->di_buf_dup_p[1])
Expand All @@ -4688,12 +4697,13 @@ static void inc_post_ref_count(struct di_buf_s *di_buf)

static void dec_post_ref_count(struct di_buf_s *di_buf)
{
if (di_buf == NULL) {
if (IS_ERR_OR_NULL(di_buf)) {
pr_dbg("%s: Error\n", __func__);
if (recovery_flag == 0)
recovery_log_reason = 14;

recovery_flag++;
return;
}
if (di_buf->pulldown_mode == PULL_DOWN_BUF1)
return;
Expand Down Expand Up @@ -4966,7 +4976,7 @@ de_post_process(void *arg, unsigned int zoom_start_x_lines,
unsigned int zoom_end_y_lines, vframe_t *disp_vf)
{
struct di_buf_s *di_buf = (struct di_buf_s *)arg;
struct di_buf_s *di_pldn_buf = di_buf->di_buf_dup_p[pldn_dly];
struct di_buf_s *di_pldn_buf = NULL;
unsigned int di_width, di_height, di_start_x, di_end_x;
unsigned int di_start_y, di_end_y, hold_line = post_hold_line;
unsigned int post_blend_en = 0, post_blend_mode = 0,
Expand All @@ -4986,8 +4996,11 @@ de_post_process(void *arg, unsigned int zoom_start_x_lines,
((force_update_post_reg & 0x10) == 0))
return 0;

if ((di_buf == NULL) || (di_buf->di_buf_dup_p[0] == NULL))
if (IS_ERR_OR_NULL(di_buf))
return 0;
else if (IS_ERR_OR_NULL(di_buf->di_buf_dup_p[0]))
return 0;
di_pldn_buf = di_buf->di_buf_dup_p[pldn_dly];

if (di_post_stru.toggle_flag && di_buf->di_buf_dup_p[1])
top_bot_config(di_buf->di_buf_dup_p[1]);
Expand Down Expand Up @@ -6296,7 +6309,9 @@ static void di_rdma_irq(void *arg)
{
struct di_dev_s *di_devp = (struct di_dev_s *)arg;

if (!di_devp || (di_devp->rdma_handle <= 0)) {
if (IS_ERR_OR_NULL(di_devp))
return;
if (di_devp->rdma_handle <= 0) {
pr_err("%s rdma handle %d error.\n", __func__,
di_devp->rdma_handle);
return;
Expand Down Expand Up @@ -7054,6 +7069,7 @@ static vframe_t *di_vf_get(void *arg)
vframe_ret->early_process_fun = NULL;
vframe_ret->process_fun = NULL;
}
atomic_set(&di_buf->di_cnt, 1);
}
disp_frame_count++;
if (run_flag == DI_RUN_FLAG_STEP)
Expand All @@ -7077,7 +7093,6 @@ static vframe_t *di_vf_get(void *arg)
vframe_ret->early_process_fun(
vframe_ret->private_data, vframe_ret);
}
atomic_set(&di_buf->di_cnt, 1);
return vframe_ret;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/amlogic/media/deinterlace/deinterlace_mtn.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module_param_named(combing_dejaggy_enable, dejaggy_enable, int, 0664);
static uint num_dejaggy_setting = 5;
/* 0:off 1:1-14-1 2:1-6-1 3:3-10-3 4:100% */
/* current setting dejaggy always on when interlace source */
static int combing_dejaggy_setting[5] = {1, 1, 1, 2, 3};
static int combing_dejaggy_setting[6] = {1, 1, 1, 2, 3, 3};
module_param_array(combing_dejaggy_setting, uint,
&num_dejaggy_setting, 0664);
#ifdef CONFIG_AM_ATVDEMOD
Expand Down
6 changes: 2 additions & 4 deletions drivers/amlogic/media/deinterlace/detect3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ DET3D_INTR_EN_BIT, DET3D_INTR_EN_WID);
int read_cbus_reg_signed_bits(unsigned int reg, unsigned int startbit,
unsigned int length)
{
int val;
int tmp = 1;
unsigned int val, tmp = 1;

if (length > 31)
length = 31;
Expand All @@ -145,7 +144,7 @@ int read_cbus_reg_signed_bits(unsigned int reg, unsigned int startbit,
* signed value = %d",length,val,((val >= tmp )?
* (val - (tmp << 1)):val));
*/
return (val >= tmp)?(val - (tmp << 1)):val;
return (int)((val >= tmp)?(val - (tmp << 1)):val);
}

/*
Expand Down Expand Up @@ -413,7 +412,6 @@ chessbd_ver_thrd);
det3d_info.tfw_det3d_fmt = TVIN_TFMT_2D;
} else{
/* keep previous status */
det3d_info.tfw_det3d_fmt = det3d_info.tfw_det3d_fmt;

if ((det3d_info.score_3d_lr > LR_SCORE_LOWER_LIMIT) &&
(det3d_info.score_3d_tb > TB_SCORE_LOWER_LIMIT)) {
Expand Down

0 comments on commit 2dfdb54

Please sign in to comment.