return count;
}
+static const char *amvecm_reg_usage_str = {
+ "Usage:\n"
+ "echo rv addr(H) > /sys/class/amvecm/reg;\n"
+ "echo rc addr(H) > /sys/class/amvecm/reg;\n"
+ "echo rh addr(H) > /sys/class/amvecm/reg; read hiu reg\n"
+ "echo wv addr(H) value(H) > /sys/class/amvecm/reg; write vpu reg\n"
+ "echo wc addr(H) value(H) > /sys/class/amvecm/re; write cbus reg\n"
+ "echo wh addr(H) value(H) > /sys/class/amvecm/re; write hiu reg\n"
+ "echo dv|c|h addr(H) num > /sys/class/amvecm/reg; dump reg from addr\n"
+};
+static ssize_t amvecm_reg_show(struct class *cla,
+ struct class_attribute *attr, char *buf)
+{
+ return sprintf(buf, "%s\n", amvecm_reg_usage_str);
+}
+
+static ssize_t amvecm_reg_store(struct class *cla,
+ struct class_attribute *attr,
+ const char *buf, size_t count)
+{
+ char *buf_orig, *parm[8] = {NULL};
+ long val = 0;
+ unsigned int reg_addr, reg_val, i;
+
+ if (!buf)
+ return count;
+ buf_orig = kstrdup(buf, GFP_KERNEL);
+ parse_param_amvecm(buf_orig, (char **)&parm);
+ if (!strcmp(parm[0], "rv")) {
+ if (kstrtoul(parm[1], 16, &val) < 0)
+ return -EINVAL;
+ reg_addr = val;
+ reg_val = READ_VPP_REG(reg_addr);
+ pr_info("VPU[0x%04x]=0x%08x\n", reg_addr, reg_val);
+ } else if (!strcmp(parm[0], "rc")) {
+ if (kstrtoul(parm[1], 16, &val) < 0)
+ return -EINVAL;
+ reg_addr = val;
+ reg_val = aml_read_cbus(reg_addr);
+ pr_info("CBUS[0x%04x]=0x%08x\n", reg_addr, reg_val);
+ } else if (!strcmp(parm[0], "rh")) {
+ if (kstrtoul(parm[1], 16, &val) < 0)
+ return -EINVAL;
+ reg_addr = val;
+ amvecm_hiu_reg_read(reg_addr, ®_val);
+ pr_info("HIU[0x%04x]=0x%08x\n", reg_addr, reg_val);
+ } else if (!strcmp(parm[0], "wv")) {
+ if (kstrtoul(parm[1], 16, &val) < 0)
+ return -EINVAL;
+ reg_addr = val;
+ if (kstrtoul(parm[2], 16, &val) < 0)
+ return -EINVAL;
+ reg_val = val;
+ WRITE_VPP_REG(reg_addr, reg_val);
+ } else if (!strcmp(parm[0], "wc")) {
+ if (kstrtoul(parm[1], 16, &val) < 0)
+ return -EINVAL;
+ reg_addr = val;
+ if (kstrtoul(parm[2], 16, &val) < 0)
+ return -EINVAL;
+ reg_val = val;
+ aml_write_cbus(reg_addr, reg_val);
+ } else if (!strcmp(parm[0], "wh")) {
+ if (kstrtoul(parm[1], 16, &val) < 0)
+ return -EINVAL;
+ reg_addr = val;
+ if (kstrtoul(parm[2], 16, &val) < 0)
+ return -EINVAL;
+ reg_val = val;
+ amvecm_hiu_reg_write(reg_addr, reg_val);
+ } else if (parm[0][0] == 'd') {
+ if (kstrtoul(parm[1], 16, &val) < 0)
+ return -EINVAL;
+ reg_addr = val;
+ if (kstrtoul(parm[2], 16, &val) < 0)
+ return -EINVAL;
+ for (i = 0; i < val; i++) {
+ if (parm[0][1] == 'v')
+ reg_val = READ_VPP_REG(reg_addr+i);
+ else if (parm[0][1] == 'c')
+ reg_val = aml_read_cbus(reg_addr+i);
+ else if (parm[0][1] == 'h')
+ amvecm_hiu_reg_read((reg_addr+i),
+ ®_val);
+ pr_info("REG[0x%04x]=0x%08x\n", (reg_addr+i), reg_val);
+ }
+ } else
+ pr_info("unsupprt cmd!\n");
+
+ return count;
+}
+
/* #if (MESON_CPU_TYPE == MESON_CPU_TYPE_MESONG9TV) */
void init_sharpness(void)
{
amvecm_vpp_demo_show, amvecm_vpp_demo_store),
__ATTR(dv_mode, 0644,
amvecm_dv_mode_show, amvecm_dv_mode_store),
+ __ATTR(reg, 0644,
+ amvecm_reg_show, amvecm_reg_store),
__ATTR_NULL
};
};
static int chroma_filter_table[] = {
- COEF_4POINT_TRIANGLE, /* bicubic */
+ COEF_BICUBIC, /* bicubic */
COEF_3POINT_TRIANGLE,
COEF_4POINT_TRIANGLE,
COEF_4POINT_TRIANGLE, /* bilinear */
MODULE_PARM_DESC(sharpness1_sr2_ctrl_3280, "sharpness1_sr2_ctrl_3280");
module_param(sharpness1_sr2_ctrl_3280, uint, 0664);
+static unsigned int vpp_filter_fix;
+MODULE_PARM_DESC(vpp_filter_fix, "vpp_filter_fix");
+module_param(vpp_filter_fix, uint, 0664);
+
#define MAX_COEFF_LEVEL 5
uint num_coeff_level = MAX_COEFF_LEVEL;
uint vert_coeff_settings[MAX_COEFF_LEVEL] = {
/* this setting is most smooth */
};
-static uint coeff(uint *settings, uint ratio, uint phase, bool interlace)
+static uint coeff(uint *settings, uint ratio, uint phase,
+ bool interlace, int combing_lev)
{
uint coeff_select = 0;
uint coeff_type = 0;
*gxtvbb use dejaggy in SR0 to reduce intelace combing
*other chip no dejaggy, need swtich to more blur filter
*/
- if (interlace && (coeff_select < 3))
+ if (interlace && (coeff_select < 3) && vpp_filter_fix)
coeff_type = COEF_4POINT_BSPLINE;
+ /* use bicubic for static scene */
+ if (combing_lev == 0)
+ coeff_type = COEF_BICUBIC;
}
return coeff_type;
}
module_param(skip_policy, uint, 0664);
MODULE_PARM_DESC(skip_policy, "\n skip_policy\n");
+unsigned int scaler_filter_cnt_limit = 10;
+MODULE_PARM_DESC(scaler_filter_cnt_limit, "scaler_filter_cnt_limit");
+module_param(scaler_filter_cnt_limit, uint, 0664);
+
+static uint last_vert_filter;
+static uint last_horz_filter;
+static uint scaler_filter_cnt;
+
static u32 vpp_wide_mode;
static u32 vpp_zoom_ratio = 100;
static s32 vpp_zoom_center_x, vpp_zoom_center_y;
module_param(vert_scaler_filter, uint, 0664);
MODULE_PARM_DESC(vert_scaler_filter, "vert_scaler_filter");
+static unsigned int vert_chroma_scaler_filter = 0xff;
+module_param(vert_chroma_scaler_filter, uint, 0664);
+MODULE_PARM_DESC(vert_chroma_scaler_filter, "vert_chroma_scaler_filter");
+
static unsigned int horz_scaler_filter = 0xff;
module_param(horz_scaler_filter, uint, 0664);
MODULE_PARM_DESC(horz_scaler_filter, "horz_scaler_filter");
(next_frame_par->vscale_skip_count + 1),
1,
((vf->type_original & VIDTYPE_TYPEMASK)
- != VIDTYPE_PROGRESSIVE));
+ != VIDTYPE_PROGRESSIVE),
+ vf->combing_cur_lev);
filter->vpp_vert_coeff =
filter_table[filter->vpp_vert_filter];
filter->vpp_hf_start_phase_step,
next_frame_par->VPP_hf_ini_phase_,
((vf->type_original & VIDTYPE_TYPEMASK)
- != VIDTYPE_PROGRESSIVE));
+ != VIDTYPE_PROGRESSIVE),
+ vf->combing_cur_lev);
/*for gxl cvbs out index*/
if ((vinfo->mode == VMODE_CVBS) &&
(vinfo->height == 576) &&
(vert_scaler_filter <= COEF_3D_FILTER)) {
filter->vpp_vert_coeff = filter_table[vert_scaler_filter];
filter->vpp_vert_filter = vert_scaler_filter;
- if (vert_chroma_filter_force_en) {
- cur_vert_chroma_filter
- = chroma_filter_table[vert_scaler_filter];
+ }
+ if (vert_chroma_filter_force_en &&
+ (vert_chroma_scaler_filter >= COEF_BICUBIC) &&
+ (vert_chroma_scaler_filter <= COEF_3D_FILTER)) {
+ cur_vert_chroma_filter = vert_chroma_scaler_filter;
filter->vpp_vert_chroma_coeff
= filter_table[cur_vert_chroma_filter];
filter->vpp_vert_chroma_filter_en = true;
- } else {
- cur_vert_chroma_filter = COEF_NULL;
- filter->vpp_vert_chroma_filter_en = false;
- }
+ } else {
+ cur_vert_chroma_filter = COEF_NULL;
+ filter->vpp_vert_chroma_filter_en = false;
}
if ((horz_scaler_filter >= COEF_BICUBIC) &&
filter->vpp_vert_filter = COEF_3D_FILTER;
}
#endif
-
- cur_vert_filter = filter->vpp_vert_filter;
- cur_horz_filter = filter->vpp_horz_filter;
+ if ((last_vert_filter != filter->vpp_vert_filter) ||
+ (last_horz_filter != filter->vpp_horz_filter)) {
+ last_vert_filter = filter->vpp_vert_filter;
+ last_horz_filter = filter->vpp_horz_filter;
+ scaler_filter_cnt = 0;
+ } else {
+ scaler_filter_cnt++;
+ }
+ if ((scaler_filter_cnt >= scaler_filter_cnt_limit) &&
+ ((cur_vert_filter != filter->vpp_vert_filter) ||
+ (cur_horz_filter != filter->vpp_horz_filter))) {
+ video_property_notify(1);
+ cur_vert_filter = filter->vpp_vert_filter;
+ cur_horz_filter = filter->vpp_horz_filter;
+ scaler_filter_cnt = scaler_filter_cnt_limit;
+ }
cur_skip_line = next_frame_par->vscale_skip_count;
#if HAS_VPU_PROT