summaryrefslogtreecommitdiff
authorqiang.liu <qiang.liu@amlogic.com>2019-12-20 09:55:58 (GMT)
committer Shen Liu <shen.liu@amlogic.com>2020-05-27 06:06:39 (GMT)
commit52f85f097210274b43056b25f92329797d86d2ba (patch)
tree3fbe4a541b705ce50be4b2de1f39ea720ad6a992
parent6f878ef98ec345419a10d7a165fd13c2b317616c (diff)
downloadcommon-52f85f097210274b43056b25f92329797d86d2ba.zip
common-52f85f097210274b43056b25f92329797d86d2ba.tar.gz
common-52f85f097210274b43056b25f92329797d86d2ba.tar.bz2
cvbsout: add NTSC performance support [2/2]
PD#SWPL-17248 Problem: don't support NTSC performance Solution: 1.add NTSC performance support 2.fix cvbsout set mode mistake for viu_mux Verify: u212 Change-Id: I18432050a4124f9c00830a1d4c82563ea43505bc Signed-off-by: qiang.liu <qiang.liu@amlogic.com>
Diffstat
-rw-r--r--arch/arm/boot/dts/amlogic/g12a_s905x2_u212.dts11
-rw-r--r--arch/arm64/boot/dts/amlogic/g12a_s905x2_u212.dts11
-rw-r--r--drivers/amlogic/media/vout/cvbs/cvbs_out.c718
-rw-r--r--drivers/amlogic/media/vout/cvbs/cvbs_out.h13
-rw-r--r--drivers/amlogic/media/vout/vout_serve/vout_func.c21
5 files changed, 417 insertions, 357 deletions
diff --git a/arch/arm/boot/dts/amlogic/g12a_s905x2_u212.dts b/arch/arm/boot/dts/amlogic/g12a_s905x2_u212.dts
index 58073e2..75c00c6 100644
--- a/arch/arm/boot/dts/amlogic/g12a_s905x2_u212.dts
+++ b/arch/arm/boot/dts/amlogic/g12a_s905x2_u212.dts
@@ -209,12 +209,21 @@
/* performance: reg_address, reg_value */
/* g12a */
- performance = <0x1bf0 0x9
+ performance_pal = <0x1bf0 0x9
0x1b56 0x333
0x1b12 0x8080
0x1b05 0xfd
0x1c59 0xf850
0xffff 0x0>; /* ending flag */
+ performance_ntsc = <0x1bf0 0x9
+ 0x1b56 0x333
+ 0x1b12 0x9c00
+ 0x1b03 0x1
+ 0x1b04 0x5
+ 0x1b05 0xfc
+ 0x1b06 0x8
+ 0x1c59 0xfc48
+ 0xffff 0x0>; /* ending flag */
performance_sarft = <0x1bf0 0x9
0x1b56 0x333
0x1b12 0x0
diff --git a/arch/arm64/boot/dts/amlogic/g12a_s905x2_u212.dts b/arch/arm64/boot/dts/amlogic/g12a_s905x2_u212.dts
index 83da45b..dd64416 100644
--- a/arch/arm64/boot/dts/amlogic/g12a_s905x2_u212.dts
+++ b/arch/arm64/boot/dts/amlogic/g12a_s905x2_u212.dts
@@ -209,12 +209,21 @@
/* performance: reg_address, reg_value */
/* g12a */
- performance = <0x1bf0 0x9
+ performance_pal = <0x1bf0 0x9
0x1b56 0x333
0x1b12 0x8080
0x1b05 0xfd
0x1c59 0xf850
0xffff 0x0>; /* ending flag */
+ performance_ntsc = <0x1bf0 0x9
+ 0x1b56 0x333
+ 0x1b12 0x9c00
+ 0x1b03 0x1
+ 0x1b04 0x5
+ 0x1b05 0xfc
+ 0x1b06 0x8
+ 0x1c59 0xfc48
+ 0xffff 0x0>; /* ending flag */
performance_sarft = <0x1bf0 0x9
0x1b56 0x333
0x1b12 0x0
diff --git a/drivers/amlogic/media/vout/cvbs/cvbs_out.c b/drivers/amlogic/media/vout/cvbs/cvbs_out.c
index 44c3001..068a170 100644
--- a/drivers/amlogic/media/vout/cvbs/cvbs_out.c
+++ b/drivers/amlogic/media/vout/cvbs/cvbs_out.c
@@ -136,8 +136,7 @@ static struct vinfo_s cvbs_info[] = {
/*bit[1]: 0=vid2_clk, 1=vid1_clk*/
unsigned int cvbs_clk_path;
-static struct disp_module_info_s disp_module_info;
-static struct disp_module_info_s *info;
+static struct cvbs_drv_s *cvbs_drv;
static enum cvbs_mode_e local_cvbs_mode;
static unsigned int vdac_cfg_valid;
static unsigned int vdac_cfg_value;
@@ -156,28 +155,7 @@ struct class_attribute class_CVBS_attr_wss = __ATTR(wss, 0644,
aml_CVBS_attr_wss_show, aml_CVBS_attr_wss_store);
#endif /*CONFIG_AMLOGIC_WSS*/
-static void cvbs_config_vdac(unsigned int flag, unsigned int cfg);
-static void cvbs_cntl_output(unsigned int open);
-static void cvbs_performance_config(unsigned int index);
-#ifdef CONFIG_CVBS_PERFORMANCE_COMPATIBILITY_SUPPORT
-static void cvbs_performance_enhancement(enum cvbs_mode_e mode);
-#endif
-
-#if 0
-static int get_vdac_power_level(void)
-{
- return cvbs_vdac_power_level;
-}
-
-static int check_cpu_type(unsigned int cpu_type)
-{
- int ret = 0;
-
- ret = (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MAJOR) == cpu_type);
-
- return ret;
-}
-#endif
+static void cvbs_bist_test(unsigned int bist);
/* static int get_cpu_minor(void)
* {
@@ -187,7 +165,7 @@ static int check_cpu_type(unsigned int cpu_type)
int cvbs_cpu_type(void)
{
- return info->cvbs_data->cpu_id;
+ return cvbs_drv->cvbs_data->cpu_id;
}
EXPORT_SYMBOL(cvbs_cpu_type);
@@ -233,46 +211,51 @@ static void cvbs_cntl_output(unsigned int open)
/* must enable adc bandgap, the adc ref signal for demod */
vdac_enable(0, VDAC_MODULE_CVBS_OUT);
} else if (open == 1) { /* open */
-
- cntl0 = info->cvbs_data->cntl0_val;
+ cntl0 = cvbs_drv->cvbs_data->cntl0_val;
cntl1 = (vdac_cfg_valid == 0) ? 0 : vdac_cfg_value;
- cvbs_log_info("vdac open.%d = 0x%x, 0x%x\n",
- vdac_cfg_valid, cntl0, cntl1);
- vdac_set_ctrl0_ctrl1(cntl0, cntl1);
+ vdac_set_ctrl0_ctrl1(cntl0, cntl1);
/*vdac ctrl for cvbsout/rf signal,adc bandgap*/
vdac_enable(1, VDAC_MODULE_CVBS_OUT);
}
-}
-
-/* 0xff for none config from uboot */
-static unsigned int cvbs_performance_index = 0xff;
-static void cvbs_performance_config(unsigned int index)
-{
- cvbs_performance_index = index;
+ cvbs_log_info("%s: %d: 0x%x, 0x%x\n", __func__, open, cntl0, cntl1);
}
#ifdef CONFIG_CVBS_PERFORMANCE_COMPATIBILITY_SUPPORT
static void cvbs_performance_enhancement(enum cvbs_mode_e mode)
{
+ struct performance_config_s *perfconf = NULL;
const struct reg_s *s = NULL;
int i = 0;
- if (mode != MODE_576CVBS)
+ switch (mode) {
+ case MODE_576CVBS:
+ perfconf = &cvbs_drv->perf_conf_pal;
+ break;
+ case MODE_480CVBS:
+ perfconf = &cvbs_drv->perf_conf_ntsc;
+ break;
+ default:
+ break;
+ }
+ if (!perfconf)
return;
- s = info->cvbs_conf.performance_reg_table;
- if (s == NULL) {
- cvbs_log_err("error: can't find performance table!\n");
+ if (!perfconf->reg_table) {
+ cvbs_log_info("no performance table\n");
return;
}
- while (i < info->cvbs_conf.performance_reg_cnt) {
+ i = 0;
+ s = perfconf->reg_table;
+ while (i < perfconf->reg_cnt) {
cvbs_out_reg_write(s->reg, s->val);
+ cvbs_log_info("%s: vcbus reg 0x%04x = 0x%08x\n",
+ __func__, s->reg, s->val);
s++;
i++;
}
- cvbs_log_info("%s\n", __func__);
+ /*cvbs_log_info("%s\n", __func__);*/
}
#endif/* end of CVBS_PERFORMANCE_COMPATIBILITY_SUPPORT */
@@ -304,11 +287,11 @@ static void cvbs_out_disable_clk(void)
static void cvbs_out_vpu_power_ctrl(int status)
{
- if (info->vinfo == NULL)
+ if (!cvbs_drv->vinfo)
return;
if (status) {
#ifdef CONFIG_AMLOGIC_VPU
- request_vpu_clk_vmod(info->vinfo->video_clk, VPU_VENCI);
+ request_vpu_clk_vmod(cvbs_drv->vinfo->video_clk, VPU_VENCI);
switch_vpu_mem_pd_vmod(VPU_VENCI, VPU_MEM_POWER_ON);
#endif
} else {
@@ -321,42 +304,42 @@ static void cvbs_out_vpu_power_ctrl(int status)
static void cvbs_out_clk_gate_ctrl(int status)
{
- if (info->vinfo == NULL)
+ if (!cvbs_drv->vinfo)
return;
if (status) {
- if (info->clk_gate_state) {
+ if (cvbs_drv->clk_gate_state) {
cvbs_log_info("clk_gate is already on\n");
return;
}
- if (IS_ERR(info->venci_top_gate))
+ if (IS_ERR(cvbs_drv->venci_top_gate))
cvbs_log_err("error: %s: venci_top_gate\n", __func__);
else
- clk_prepare_enable(info->venci_top_gate);
+ clk_prepare_enable(cvbs_drv->venci_top_gate);
- if (IS_ERR(info->venci_0_gate))
+ if (IS_ERR(cvbs_drv->venci_0_gate))
cvbs_log_err("error: %s: venci_0_gate\n", __func__);
else
- clk_prepare_enable(info->venci_0_gate);
+ clk_prepare_enable(cvbs_drv->venci_0_gate);
- if (IS_ERR(info->venci_1_gate))
+ if (IS_ERR(cvbs_drv->venci_1_gate))
cvbs_log_err("error: %s: venci_1_gate\n", __func__);
else
- clk_prepare_enable(info->venci_1_gate);
+ clk_prepare_enable(cvbs_drv->venci_1_gate);
- if (IS_ERR(info->vdac_clk_gate))
+ if (IS_ERR(cvbs_drv->vdac_clk_gate))
cvbs_log_err("error: %s: vdac_clk_gate\n", __func__);
else
- clk_prepare_enable(info->vdac_clk_gate);
+ clk_prepare_enable(cvbs_drv->vdac_clk_gate);
#ifdef CONFIG_AMLOGIC_VPU
switch_vpu_clk_gate_vmod(VPU_VENCI, VPU_CLK_GATE_ON);
#endif
- info->clk_gate_state = 1;
+ cvbs_drv->clk_gate_state = 1;
} else {
- if (info->clk_gate_state == 0) {
+ if (cvbs_drv->clk_gate_state == 0) {
cvbs_log_info("clk_gate is already off\n");
return;
}
@@ -364,33 +347,33 @@ static void cvbs_out_clk_gate_ctrl(int status)
#ifdef CONFIG_AMLOGIC_VPU
switch_vpu_clk_gate_vmod(VPU_VENCI, VPU_CLK_GATE_OFF);
#endif
- if (IS_ERR(info->vdac_clk_gate))
+ if (IS_ERR(cvbs_drv->vdac_clk_gate))
cvbs_log_err("error: %s: vdac_clk_gate\n", __func__);
else
- clk_disable_unprepare(info->vdac_clk_gate);
+ clk_disable_unprepare(cvbs_drv->vdac_clk_gate);
- if (IS_ERR(info->venci_0_gate))
+ if (IS_ERR(cvbs_drv->venci_0_gate))
cvbs_log_err("error: %s: venci_0_gate\n", __func__);
else
- clk_disable_unprepare(info->venci_0_gate);
+ clk_disable_unprepare(cvbs_drv->venci_0_gate);
- if (IS_ERR(info->venci_1_gate))
+ if (IS_ERR(cvbs_drv->venci_1_gate))
cvbs_log_err("error: %s: venci_1_gate\n", __func__);
else
- clk_disable_unprepare(info->venci_1_gate);
+ clk_disable_unprepare(cvbs_drv->venci_1_gate);
- if (IS_ERR(info->venci_top_gate))
+ if (IS_ERR(cvbs_drv->venci_top_gate))
cvbs_log_err("error: %s: venci_top_gate\n", __func__);
else
- clk_disable_unprepare(info->venci_top_gate);
+ clk_disable_unprepare(cvbs_drv->venci_top_gate);
- info->clk_gate_state = 0;
+ cvbs_drv->clk_gate_state = 0;
}
}
static void cvbs_dv_dwork(struct work_struct *work)
{
- if (!info->dwork_flag)
+ if (!cvbs_drv->dwork_flag)
return;
cvbs_cntl_output(1);
}
@@ -439,18 +422,18 @@ int cvbs_out_setmode(void)
#ifdef CONFIG_CVBS_PERFORMANCE_COMPATIBILITY_SUPPORT
cvbs_performance_enhancement(local_cvbs_mode);
#endif
- info->dwork_flag = 1;
- schedule_delayed_work(&info->dv_dwork, msecs_to_jiffies(1000));
+ cvbs_drv->dwork_flag = 1;
+ schedule_delayed_work(&cvbs_drv->dv_dwork, msecs_to_jiffies(1000));
mutex_unlock(&setmode_mutex);
return 0;
}
static int cvbs_open(struct inode *inode, struct file *file)
{
- struct disp_module_info_s *dinfo;
+ struct cvbs_drv_s *cdrv;
/* Get the per-device structure that contains this cdev */
- dinfo = container_of(&inode->i_cdev, struct disp_module_info_s, cdev);
- file->private_data = dinfo;
+ cdrv = container_of(&inode->i_cdev, struct cvbs_drv_s, cdev);
+ file->private_data = cdrv;
return 0;
}
@@ -556,17 +539,19 @@ static const struct vinfo_s *get_valid_vinfo(char *mode)
}
}
}
- if (vinfo)
+ if (vinfo) {
strncpy(vinfo->ext_name, mode,
- (strlen(mode) < 32) ? strlen(mode) : 31);
- else
+ (strlen(mode) < 32) ? strlen(mode) : 31);
+ cvbs_drv->vinfo = vinfo;
+ } else {
local_cvbs_mode = MODE_MAX;
+ }
return vinfo;
}
static struct vinfo_s *cvbs_get_current_info(void)
{
- return info->vinfo;
+ return cvbs_drv->vinfo;
}
enum cvbs_mode_e get_local_cvbs_mode(void)
@@ -586,11 +571,10 @@ static int cvbs_set_current_vmode(enum vmode_e mode)
cvbs_log_info("local_cvbs_mode err:%d!\n", local_cvbs_mode);
return 1;
}
- info->vinfo = &cvbs_info[local_cvbs_mode];
cvbs_log_info("mode is %d,sync_duration_den=%d,sync_duration_num=%d\n",
- tvmode, info->vinfo->sync_duration_den,
- info->vinfo->sync_duration_num);
+ tvmode, cvbs_drv->vinfo->sync_duration_den,
+ cvbs_drv->vinfo->sync_duration_num);
/*set limit range for enci*/
amvecm_clip_range_limit(1);
@@ -616,14 +600,13 @@ static enum vmode_e cvbs_validate_vmode(char *mode)
}
static int cvbs_vmode_is_supported(enum vmode_e mode)
{
- mode &= VMODE_MODE_BIT_MASK;
- if (mode == VMODE_CVBS)
+ if ((mode & VMODE_MODE_BIT_MASK) == VMODE_CVBS)
return true;
return false;
}
static int cvbs_module_disable(enum vmode_e cur_vmod)
{
- info->dwork_flag = 0;
+ cvbs_drv->dwork_flag = 0;
cvbs_cntl_output(0);
/*restore full range for encp/encl*/
@@ -653,6 +636,90 @@ static int cvbs_vout_get_state(void)
return cvbs_vout_state;
}
+#ifdef CONFIG_PM
+static int cvbs_suspend(void)
+{
+ /* TODO */
+ /* video_dac_disable(); */
+ cvbs_drv->dwork_flag = 0;
+ cvbs_cntl_output(0);
+ return 0;
+}
+
+static int cvbs_resume(void)
+{
+ /* TODO */
+ /* video_dac_enable(0xff); */
+ cvbs_set_current_vmode(cvbs_drv->vinfo->mode);
+ return 0;
+}
+#endif
+
+static struct vout_server_s cvbs_vout_server = {
+ .name = "cvbs_vout_server",
+ .op = {
+ .get_vinfo = cvbs_get_current_info,
+ .set_vmode = cvbs_set_current_vmode,
+ .validate_vmode = cvbs_validate_vmode,
+ .vmode_is_supported = cvbs_vmode_is_supported,
+ .disable = cvbs_module_disable,
+ .set_state = cvbs_vout_set_state,
+ .clr_state = cvbs_vout_clr_state,
+ .get_state = cvbs_vout_get_state,
+ .set_vframe_rate_hint = NULL,
+ .set_vframe_rate_end_hint = NULL,
+ .set_vframe_rate_policy = NULL,
+ .get_vframe_rate_policy = NULL,
+ .set_bist = cvbs_bist_test,
+#ifdef CONFIG_PM
+ .vout_suspend = cvbs_suspend,
+ .vout_resume = cvbs_resume,
+#endif
+ },
+};
+
+#ifdef CONFIG_AMLOGIC_VOUT2_SERVE
+static struct vout_server_s cvbs_vout2_server = {
+ .name = "cvbs_vout2_server",
+ .op = {
+ .get_vinfo = cvbs_get_current_info,
+ .set_vmode = cvbs_set_current_vmode,
+ .validate_vmode = cvbs_validate_vmode,
+ .vmode_is_supported = cvbs_vmode_is_supported,
+ .disable = cvbs_module_disable,
+ .set_state = cvbs_vout_set_state,
+ .clr_state = cvbs_vout_clr_state,
+ .get_state = cvbs_vout_get_state,
+ .set_vframe_rate_hint = NULL,
+ .set_vframe_rate_end_hint = NULL,
+ .set_vframe_rate_policy = NULL,
+ .get_vframe_rate_policy = NULL,
+ .set_bist = cvbs_bist_test,
+#ifdef CONFIG_PM
+ .vout_suspend = cvbs_suspend,
+ .vout_resume = cvbs_resume,
+#endif
+ },
+};
+#endif
+
+static void cvbs_init_vout(void)
+{
+ if (!cvbs_drv->vinfo)
+ cvbs_drv->vinfo = &cvbs_info[MODE_480CVBS];
+
+ if (vout_register_server(&cvbs_vout_server))
+ cvbs_log_err("register cvbs module server fail\n");
+ else
+ cvbs_log_info("register cvbs module server ok\n");
+#ifdef CONFIG_AMLOGIC_VOUT2_SERVE
+ if (vout2_register_server(&cvbs_vout2_server))
+ cvbs_log_err("register cvbs module vout2 server fail\n");
+ else
+ cvbs_log_info("register cvbs module vout2 server ok\n");
+#endif
+}
+
static char *cvbs_out_bist_str[] = {
"OFF", /* 0 */
"Color Bar", /* 1 */
@@ -749,90 +816,6 @@ static void cvbs_bist_test(unsigned int bist)
}
}
-#ifdef CONFIG_PM
-static int cvbs_suspend(void)
-{
- /* TODO */
- /* video_dac_disable(); */
- info->dwork_flag = 0;
- cvbs_cntl_output(0);
- return 0;
-}
-
-static int cvbs_resume(void)
-{
- /* TODO */
- /* video_dac_enable(0xff); */
- cvbs_set_current_vmode(info->vinfo->mode);
- return 0;
-}
-#endif
-
-static struct vout_server_s cvbs_vout_server = {
- .name = "cvbs_vout_server",
- .op = {
- .get_vinfo = cvbs_get_current_info,
- .set_vmode = cvbs_set_current_vmode,
- .validate_vmode = cvbs_validate_vmode,
- .vmode_is_supported = cvbs_vmode_is_supported,
- .disable = cvbs_module_disable,
- .set_state = cvbs_vout_set_state,
- .clr_state = cvbs_vout_clr_state,
- .get_state = cvbs_vout_get_state,
- .set_vframe_rate_hint = NULL,
- .set_vframe_rate_end_hint = NULL,
- .set_vframe_rate_policy = NULL,
- .get_vframe_rate_policy = NULL,
- .set_bist = cvbs_bist_test,
-#ifdef CONFIG_PM
- .vout_suspend = cvbs_suspend,
- .vout_resume = cvbs_resume,
-#endif
- },
-};
-
-#ifdef CONFIG_AMLOGIC_VOUT2_SERVE
-static struct vout_server_s cvbs_vout2_server = {
- .name = "cvbs_vout2_server",
- .op = {
- .get_vinfo = cvbs_get_current_info,
- .set_vmode = cvbs_set_current_vmode,
- .validate_vmode = cvbs_validate_vmode,
- .vmode_is_supported = cvbs_vmode_is_supported,
- .disable = cvbs_module_disable,
- .set_state = cvbs_vout_set_state,
- .clr_state = cvbs_vout_clr_state,
- .get_state = cvbs_vout_get_state,
- .set_vframe_rate_hint = NULL,
- .set_vframe_rate_end_hint = NULL,
- .set_vframe_rate_policy = NULL,
- .get_vframe_rate_policy = NULL,
- .set_bist = cvbs_bist_test,
-#ifdef CONFIG_PM
- .vout_suspend = cvbs_suspend,
- .vout_resume = cvbs_resume,
-#endif
- },
-};
-#endif
-
-static void cvbs_init_vout(void)
-{
- if (info->vinfo == NULL)
- info->vinfo = &cvbs_info[MODE_480CVBS];
-
- if (vout_register_server(&cvbs_vout_server))
- cvbs_log_err("register cvbs module server fail\n");
- else
- cvbs_log_info("register cvbs module server ok\n");
-#ifdef CONFIG_AMLOGIC_VOUT2_SERVE
- if (vout2_register_server(&cvbs_vout2_server))
- cvbs_log_err("register cvbs module vout2 server fail\n");
- else
- cvbs_log_info("register cvbs module vout2 server ok\n");
-#endif
-}
-
static void vdac_power_level_store(char *para)
{
unsigned long level = 0;
@@ -887,14 +870,7 @@ static void cvbs_performance_regs_dump(void)
VENC_VDAC_DAC0_FILT_CTRL0,
VENC_VDAC_DAC0_FILT_CTRL1
};
- unsigned int performance_regs_vdac[] = {
- HHI_VDAC_CNTL0,
- HHI_VDAC_CNTL1
- };
- unsigned int performance_regs_vdac_g12a[] = {
- HHI_VDAC_CNTL0_G12A,
- HHI_VDAC_CNTL1_G12A
- };
+ unsigned int vdac_reg0, vdac_reg1;
int i, size;
size = sizeof(performance_regs_enci)/sizeof(unsigned int);
@@ -903,11 +879,6 @@ static void cvbs_performance_regs_dump(void)
pr_info("vcbus [0x%x] = 0x%x\n", performance_regs_enci[i],
cvbs_out_reg_read(performance_regs_enci[i]));
}
- if (cvbs_cpu_type() == CVBS_CPU_TYPE_G12A ||
- cvbs_cpu_type() == CVBS_CPU_TYPE_G12B)
- size = sizeof(performance_regs_vdac_g12a)/sizeof(unsigned int);
- else
- size = sizeof(performance_regs_vdac)/sizeof(unsigned int);
pr_info("------------------------\n");
vdac_reg0 = vdac_get_reg_addr(0);
vdac_reg1 = vdac_get_reg_addr(1);
@@ -922,22 +893,46 @@ static void cvbs_performance_regs_dump(void)
static void cvbs_performance_config_dump(void)
{
+ struct performance_config_s *perfconf = NULL;
const struct reg_s *s = NULL;
int i = 0;
- s = info->cvbs_conf.performance_reg_table;
- if (s == NULL) {
- pr_info("can't find performance table!\n");
- return;
+ perfconf = &cvbs_drv->perf_conf_pal;
+ if (!perfconf->reg_table) {
+ pr_info("no performance_pal table!\n");
+ } else {
+ pr_info("------------------------\n");
+ pr_info("performance_pal config:\n");
+ s = perfconf->reg_table;
+ while (i < perfconf->reg_cnt) {
+ if (s->reg > 0x1000)
+ pr_info("0x%04x = 0x%x\n", s->reg, s->val);
+ else
+ pr_info("0x%02x = 0x%x\n", s->reg, s->val);
+ s++;
+ i++;
+ }
+ pr_info("------------------------\n");
}
- pr_info("------------------------\n");
- while (i < info->cvbs_conf.performance_reg_cnt) {
- pr_info("0x%04x = 0x%x\n", s->reg, s->val);
- s++;
- i++;
+ i = 0;
+ perfconf = &cvbs_drv->perf_conf_ntsc;
+ if (!perfconf->reg_table) {
+ pr_info("no performance_ntsc table!\n");
+ } else {
+ pr_info("------------------------\n");
+ pr_info("performance_ntsc config:\n");
+ s = perfconf->reg_table;
+ while (i < perfconf->reg_cnt) {
+ if (s->reg > 0x1000)
+ pr_info("0x%04x = 0x%x\n", s->reg, s->val);
+ else
+ pr_info("0x%02x = 0x%x\n", s->reg, s->val);
+ s++;
+ i++;
+ }
+ pr_info("------------------------\n");
}
- pr_info("------------------------\n");
}
enum {
@@ -1036,22 +1031,23 @@ static void cvbs_debug_store(char *buf)
cmd = CMD_VP_GET;
else if (!strncmp(argv[0], "vpconf", strlen("vpconf")))
cmd = CMD_VP_CONFIG_DUMP;
- else if (!strncmp(argv[0], "set_clkpath", strlen("set_clkpath")))
+ else if ((!strncmp(argv[0], "set_clkpath", strlen("set_clkpath"))) ||
+ (!strncmp(argv[0], "clkpath", strlen("clkpath"))))
cmd = CMD_VP_SET_PLLPATH;
else if (!strncmp(argv[0], "help", strlen("help")))
cmd = CMD_HELP;
else if (!strncmp(argv[0], "cvbs_ver", strlen("cvbs_ver"))) {
- print_info("cvbsout version : %s\n", CVBSOUT_VER);
+ pr_info("cvbsout version : %s\n", CVBSOUT_VER);
goto DEBUG_END;
} else {
- print_info("[%s] invalid cmd = %s!\n", __func__, argv[0]);
+ pr_info("[%s] invalid cmd = %s!\n", __func__, argv[0]);
goto DEBUG_END;
}
switch (cmd) {
case CMD_REG_READ:
if (argc != 3) {
- print_info("[%s] cmd_reg_read format: r c/h/v address_hex\n",
+ pr_info("[%s] cmd_reg_read format: r c/h/v address_hex\n",
__func__);
goto DEBUG_END;
}
@@ -1061,14 +1057,14 @@ static void cvbs_debug_store(char *buf)
goto DEBUG_END;
ret = kstrtoul(argv[2], 16, &addr);
- print_info("read %s[0x%x] = 0x%x\n",
+ pr_info("read %s[0x%x] = 0x%x\n",
str_type, (unsigned int)addr, func_read(addr));
break;
case CMD_REG_READ_BITS:
if (argc != 5) {
- print_info("[%s] cmd_reg_read_bits format:\n"
+ pr_info("[%s] cmd_reg_read_bits format:\n"
"\trb c/h/v address_hex start_dec length_dec\n",
__func__);
goto DEBUG_END;
@@ -1081,23 +1077,24 @@ static void cvbs_debug_store(char *buf)
ret = kstrtoul(argv[3], 10, &start);
ret = kstrtoul(argv[4], 10, &length);
- if (length == 1)
- print_info("read_bits %s[0x%x] = 0x%x, bit[%d] = 0x%x\n",
- str_type, (unsigned int)addr,
- func_read(addr), (unsigned int)start,
- func_getb(addr, start, length));
- else
- print_info("read_bits %s[0x%x] = 0x%x, bit[%d-%d] = 0x%x\n",
- str_type, (unsigned int)addr,
- func_read(addr),
- (unsigned int)start+(unsigned int)length-1,
- (unsigned int)start,
- func_getb(addr, start, length));
+ if (length == 1) {
+ pr_info("read_bits %s[0x%x] = 0x%x, bit[%d] = 0x%x\n",
+ str_type, (unsigned int)addr,
+ func_read(addr), (unsigned int)start,
+ func_getb(addr, start, length));
+ } else {
+ pr_info("read_bits %s[0x%x] = 0x%x, bit[%d-%d] = 0x%x\n",
+ str_type, (unsigned int)addr,
+ func_read(addr),
+ (unsigned int)start + (unsigned int)length - 1,
+ (unsigned int)start,
+ func_getb(addr, start, length));
+ }
break;
case CMD_REG_DUMP:
if (argc != 4) {
- print_info("[%s] cmd_reg_dump format: dump c/h/v start_dec end_dec\n",
+ pr_info("[%s] cmd_reg_dump format: dump c/h/v start_dec end_dec\n",
__func__);
goto DEBUG_END;
}
@@ -1109,14 +1106,14 @@ static void cvbs_debug_store(char *buf)
ret = kstrtoul(argv[3], 16, &end);
for (i = start; i <= end; i++)
- print_info("%s[0x%x] = 0x%x\n",
+ pr_info("%s[0x%x] = 0x%x\n",
str_type, i, func_read(i));
break;
case CMD_REG_WRITE:
if (argc != 4) {
- print_info("[%s] cmd_reg_write format: w value_hex c/h/v address_hex\n",
+ pr_info("[%s] cmd_reg_write format: w value_hex c/h/v address_hex\n",
__func__);
goto DEBUG_END;
}
@@ -1128,13 +1125,13 @@ static void cvbs_debug_store(char *buf)
ret = kstrtoul(argv[3], 16, &addr);
func_write(addr, value);
- print_info("write %s[0x%x] = 0x%x\n", str_type,
+ pr_info("write %s[0x%x] = 0x%x\n", str_type,
(unsigned int)addr, (unsigned int)value);
break;
case CMD_REG_WRITE_BITS:
if (argc != 6) {
- print_info("[%s] cmd_reg_wrute_bits format:\n"
+ pr_info("[%s] cmd_reg_wrute_bits format:\n"
"\twb value_hex c/h/v address_hex start_dec length_dec\n",
__func__);
goto DEBUG_END;
@@ -1150,7 +1147,7 @@ static void cvbs_debug_store(char *buf)
old = func_read(addr);
func_setb(addr, value, start, length);
- print_info("write_bits %s[0x%x] old = 0x%x, new = 0x%x\n",
+ pr_info("write_bits %s[0x%x] old = 0x%x, new = 0x%x\n",
str_type, (unsigned int)addr,
(unsigned int)old, func_read(addr));
break;
@@ -1161,18 +1158,18 @@ static void cvbs_debug_store(char *buf)
case CMD_CLK_MSR:
/* todo */
- print_info("cvbs: debug_store: clk_msr todo!\n");
+ pr_info("cvbs: debug_store: clk_msr todo!\n");
break;
case CMD_BIST:
if (argc != 2) {
- print_info("[%s] cmd_bist format:\n"
+ pr_info("[%s] cmd_bist format:\n"
"\tbist 1/2/3/4/5/6/7/8/0\n", __func__);
goto DEBUG_END;
}
ret = kstrtouint(argv[1], 10, &bist);
if (ret) {
- print_info("cvbs: invalid bist\n");
+ pr_info("cvbs: invalid bist\n");
goto DEBUG_END;
}
cvbs_bist_test(bist);
@@ -1180,60 +1177,43 @@ static void cvbs_debug_store(char *buf)
break;
case CMD_VP_SET:
- if (argc != 2) {
- print_info("[%s] cmd_vp_set format:\n"
- "\tvpset 0/1/2\n", __func__);
- goto DEBUG_END;
- }
- if (info->vinfo->mode != VMODE_CVBS) {
- print_info("NOT VMODE_CVBS,Return\n");
+ if (cvbs_drv->vinfo->mode != VMODE_CVBS) {
+ pr_info("NOT VMODE_CVBS,Return\n");
return;
}
- ret = kstrtoul(argv[1], 16, &value);
- cvbs_performance_index = (value > 2) ? 0 : value;
cvbs_performance_enhancement(local_cvbs_mode);
- cvbs_performance_regs_dump();
break;
case CMD_VP_GET:
- print_info("current performance index: %d\n",
- cvbs_performance_index);
cvbs_performance_regs_dump();
break;
case CMD_VP_CONFIG_DUMP:
- print_info("performance config in dts:\n");
+ pr_info("performance config in dts:\n");
cvbs_performance_config_dump();
break;
case CMD_VP_SET_PLLPATH:
- if (cvbs_cpu_type() != CVBS_CPU_TYPE_G12A &&
- cvbs_cpu_type() != CVBS_CPU_TYPE_G12B) {
- print_info("ERR:Only g12a/b chip supported\n");
+ if (cvbs_cpu_type() < CVBS_CPU_TYPE_G12A) {
+ pr_info("ERR:Only after g12a/b chip supported\n");
break;
}
if (argc != 2) {
- print_info("[%s] set_clkpath 0/1/2/3\n",
- __func__);
+ pr_info("[%s] set clkpath 0x0~0x3\n", __func__);
goto DEBUG_END;
}
ret = kstrtoul(argv[1], 10, &value);
- if (value == 1 || value == 2 ||
- value == 3 || value == 0) {
- cvbs_clk_path = value;
- print_info("path 0:vid_pll vid2_clk\n");
- print_info("path 1:gp0_pll vid2_clk\n");
- print_info("path 2:vid_pll vid1_clk\n");
- print_info("path 3:gp0_pll vid1_clk\n");
- print_info("you select path %d\n", cvbs_clk_path);
+ if (value > 0x3) {
+ pr_info("invalid clkpath, only support 0x0~0x3\n");
} else {
- print_info("invalid value, only 0/1/2/3\n");
- print_info("bit[0]: 0=vid_pll, 1=gp0_pll\n");
- print_info("bit[1]: 0=vid2_clk, 1=vid1_clk\n");
+ cvbs_clk_path = value;
+ pr_info("set clkpath 0x%x\n", cvbs_clk_path);
}
+ pr_info("bit[0]: 0=vid_pll, 1=gp0_pll\n");
+ pr_info("bit[1]: 0=vid2_clk, 1=vid1_clk\n");
break;
case CMD_HELP:
- print_info("command format:\n"
+ pr_info("command format:\n"
"\tr c/h/v address_hex\n"
"\trb c/h/v address_hex start_dec length_dec\n"
"\tdump c/h/v start_dec end_dec\n"
@@ -1241,7 +1221,7 @@ static void cvbs_debug_store(char *buf)
"\twb value_hex c/h/v address_hex start_dec length_dec\n"
"\tbist 0/1/2/3/off\n"
"\tclkdump\n"
- "\tset_clkpath 0/1/2/3\n"
+ "\tclkpath 0/1/2/3\n"
"\tcvbs_ver\n");
break;
}
@@ -1258,33 +1238,33 @@ static struct class_attribute *cvbs_attr[] = {
#endif
};
-static int create_cvbs_attr(struct disp_module_info_s *info)
+static int create_cvbs_attr(struct cvbs_drv_s *cdrv)
{
/* create base class for display */
int i;
int ret = 0;
- info->base_class = class_create(THIS_MODULE, CVBS_CLASS_NAME);
- if (IS_ERR(info->base_class)) {
- ret = PTR_ERR(info->base_class);
+ cdrv->base_class = class_create(THIS_MODULE, CVBS_CLASS_NAME);
+ if (IS_ERR(cdrv->base_class)) {
+ ret = PTR_ERR(cdrv->base_class);
goto fail_create_class;
}
/* create class attr */
for (i = 0; i < ARRAY_SIZE(cvbs_attr); i++) {
- if (class_create_file(info->base_class, cvbs_attr[i]) < 0)
+ if (class_create_file(cdrv->base_class, cvbs_attr[i]) < 0)
goto fail_class_create_file;
}
- /*cdev_init(info->cdev, &am_cvbs_fops);*/
- info->cdev = cdev_alloc();
- info->cdev->ops = &am_cvbs_fops;
- info->cdev->owner = THIS_MODULE;
- ret = cdev_add(info->cdev, info->devno, 1);
+ /*cdev_init(cdrv->cdev, &am_cvbs_fops);*/
+ cdrv->cdev = cdev_alloc();
+ cdrv->cdev->ops = &am_cvbs_fops;
+ cdrv->cdev->owner = THIS_MODULE;
+ ret = cdev_add(cdrv->cdev, cdrv->devno, 1);
if (ret)
goto fail_add_cdev;
- info->dev = device_create(info->base_class, NULL, info->devno,
- NULL, CVBS_NAME);
- if (IS_ERR(info->dev)) {
- ret = PTR_ERR(info->dev);
+ cdrv->dev = device_create(cdrv->base_class, NULL, cdrv->devno,
+ NULL, CVBS_NAME);
+ if (IS_ERR(cdrv->dev)) {
+ ret = PTR_ERR(cdrv->dev);
goto fail_create_device;
} else {
cvbs_log_info("create cdev %s\n", CVBS_NAME);
@@ -1293,37 +1273,45 @@ static int create_cvbs_attr(struct disp_module_info_s *info)
fail_create_device:
cvbs_log_info("[cvbs.] : cvbs device create error.\n");
- cdev_del(info->cdev);
+ cdev_del(cdrv->cdev);
fail_add_cdev:
cvbs_log_info("[cvbs.] : cvbs add device error.\n");
fail_class_create_file:
cvbs_log_info("[cvbs.] : cvbs class create file error.\n");
for (i = 0; i < ARRAY_SIZE(cvbs_attr); i++)
- class_remove_file(info->base_class, cvbs_attr[i]);
- class_destroy(info->base_class);
+ class_remove_file(cdrv->base_class, cvbs_attr[i]);
+ class_destroy(cdrv->base_class);
fail_create_class:
cvbs_log_info("[cvbs.] : cvbs class create error.\n");
- unregister_chrdev_region(info->devno, 1);
+ unregister_chrdev_region(cdrv->devno, 1);
return ret;
}
/* **************************************************** */
+static char *cvbsout_performance_str[] = {
+ "performance", /* default for pal */
+ "performance_pal",
+ "performance_ntsc",
+};
static void cvbsout_get_config(struct device *dev)
{
int ret = 0;
unsigned int val, cnt, i, j;
struct reg_s *s = NULL;
+ const char *str;
- /* performance */
- info->cvbs_conf.performance_reg_cnt = 0;
- info->cvbs_conf.performance_reg_table = NULL;
+ /* performance: PAL */
+ cvbs_drv->perf_conf_pal.reg_cnt = 0;
+ cvbs_drv->perf_conf_pal.reg_table = NULL;
+ str = cvbsout_performance_str[1];
+ ret = of_property_read_u32_index(dev->of_node, str, 0, &val);
+ if (ret)
+ str = cvbsout_performance_str[0];
cnt = 0;
while (cnt < CVBS_PERFORMANCE_CNT_MAX) {
j = 2 * cnt;
- ret = of_property_read_u32_index(dev->of_node, "performance",
- j, &val);
+ ret = of_property_read_u32_index(dev->of_node, str, j, &val);
if (ret) {
- cvbs_log_err("error: failed to get performance\n");
cnt = 0;
break;
}
@@ -1331,29 +1319,76 @@ static void cvbsout_get_config(struct device *dev)
break;
cnt++;
}
+ if (cnt >= CVBS_PERFORMANCE_CNT_MAX)
+ cnt = 0;
+ if (cnt > 0) {
+ cvbs_log_info("find performance_pal config\n");
+ cvbs_drv->perf_conf_pal.reg_table =
+ kzalloc(sizeof(struct reg_s) * cnt, GFP_KERNEL);
+ if (!cvbs_drv->perf_conf_pal.reg_table) {
+ cvbs_log_err("error: failed to alloc %s table\n", str);
+ cnt = 0;
+ }
+ cvbs_drv->perf_conf_pal.reg_cnt = cnt;
+
+ i = 0;
+ s = cvbs_drv->perf_conf_pal.reg_table;
+ while (i < cvbs_drv->perf_conf_pal.reg_cnt) {
+ j = 2 * i;
+ ret = of_property_read_u32_index(dev->of_node,
+ str, j, &val);
+ s->reg = val;
+ j = 2 * i + 1;
+ ret = of_property_read_u32_index(dev->of_node,
+ str, j, &val);
+ s->val = val;
+ /*pr_info("%p: 0x%04x = 0x%x\n", s, s->reg, s->val);*/
+
+ s++;
+ i++;
+ }
+ }
+ /* performance: NTSC */
+ cvbs_drv->perf_conf_ntsc.reg_cnt = 0;
+ cvbs_drv->perf_conf_ntsc.reg_table = NULL;
+ cnt = 0;
+ str = cvbsout_performance_str[2];
+ while (cnt < CVBS_PERFORMANCE_CNT_MAX) {
+ j = 2 * cnt;
+ ret = of_property_read_u32_index(dev->of_node, str, j, &val);
+ if (ret) {
+ cnt = 0;
+ break;
+ }
+ if (val == MREG_END_MARKER) /* ending */
+ break;
+ cnt++;
+ }
+ if (cnt >= CVBS_PERFORMANCE_CNT_MAX)
+ cnt = 0;
if (cnt > 0) {
- info->cvbs_conf.performance_reg_table =
+ cvbs_log_info("find performance_ntsc config\n");
+ cvbs_drv->perf_conf_ntsc.reg_table =
kzalloc(sizeof(struct reg_s) * cnt, GFP_KERNEL);
- if (info->cvbs_conf.performance_reg_table == NULL) {
- cvbs_log_err(
- "error: failed to alloc performance table\n");
+ if (!cvbs_drv->perf_conf_ntsc.reg_table) {
+ cvbs_log_err("error: failed to alloc %s table\n", str);
cnt = 0;
}
- info->cvbs_conf.performance_reg_cnt = cnt;
+ cvbs_drv->perf_conf_ntsc.reg_cnt = cnt;
i = 0;
- s = info->cvbs_conf.performance_reg_table;
- while (i < info->cvbs_conf.performance_reg_cnt) {
+ s = cvbs_drv->perf_conf_ntsc.reg_table;
+ while (i < cvbs_drv->perf_conf_ntsc.reg_cnt) {
j = 2 * i;
ret = of_property_read_u32_index(dev->of_node,
- "performance", j, &val);
+ str, j, &val);
s->reg = val;
j = 2 * i + 1;
ret = of_property_read_u32_index(dev->of_node,
- "performance", j, &val);
+ str, j, &val);
s->val = val;
- /* pr_info("%p: 0x%04x = 0x%x\n", s, s->reg, s->val); */
+ /*pr_info("%p: 0x%04x = 0x%x\n", s, s->reg, s->val);*/
s++;
i++;
@@ -1361,59 +1396,57 @@ static void cvbsout_get_config(struct device *dev)
}
/*clk path*/
- /*0:vid_pll vid2_clk*/
- /*1:gp0_pll vid2_clk*/
- /*2:vid_pll vid1_clk*/
- /*3:gp0_pll vid1_clk*/
+ /*bit[0]: 0=vid_pll, 1=gp0_pll*/
+ /*bit[1]: 0=vid2_clk, 1=vid_clk*/
ret = of_property_read_u32(dev->of_node, "clk_path", &val);
- if (ret)
- cvbs_log_info("clk_path config null\n");
- else if (val > 3)
- cvbs_log_err("error: invalid clk_path\n");
- else {
- cvbs_clk_path = val;
- cvbs_log_info("clk path:%d\n", cvbs_clk_path);
+ if (!ret) {
+ if (val > 0x3) {
+ cvbs_log_err("error: invalid clk_path\n");
+ } else {
+ cvbs_clk_path = val;
+ cvbs_log_info("clk path:0x%x\n", cvbs_clk_path);
+ }
}
/* vdac config */
ret = of_property_read_u32(dev->of_node, "vdac_config", &val);
- if (ret)
- cvbs_log_err("error: failed to get vdac_config\n");
- else
+ if (!ret) {
cvbs_config_vdac((val & 0xff00) >> 8, val & 0xff);
+ cvbs_log_info("find vdac_config: 0x%x\n", val);
+ }
}
static void cvbsout_clktree_probe(struct device *dev)
{
- info->clk_gate_state = 0;
- info->venci_top_gate = devm_clk_get(dev, "venci_top_gate");
- if (IS_ERR(info->venci_top_gate))
+ cvbs_drv->clk_gate_state = 0;
+ cvbs_drv->venci_top_gate = devm_clk_get(dev, "venci_top_gate");
+ if (IS_ERR(cvbs_drv->venci_top_gate))
cvbs_log_err("error: %s: clk venci_top_gate\n", __func__);
- info->venci_0_gate = devm_clk_get(dev, "venci_0_gate");
- if (IS_ERR(info->venci_0_gate))
+ cvbs_drv->venci_0_gate = devm_clk_get(dev, "venci_0_gate");
+ if (IS_ERR(cvbs_drv->venci_0_gate))
cvbs_log_err("error: %s: clk venci_0_gate\n", __func__);
- info->venci_1_gate = devm_clk_get(dev, "venci_1_gate");
- if (IS_ERR(info->venci_1_gate))
+ cvbs_drv->venci_1_gate = devm_clk_get(dev, "venci_1_gate");
+ if (IS_ERR(cvbs_drv->venci_1_gate))
cvbs_log_err("error: %s: clk venci_1_gate\n", __func__);
- info->vdac_clk_gate = devm_clk_get(dev, "vdac_clk_gate");
- if (IS_ERR(info->vdac_clk_gate))
+ cvbs_drv->vdac_clk_gate = devm_clk_get(dev, "vdac_clk_gate");
+ if (IS_ERR(cvbs_drv->vdac_clk_gate))
cvbs_log_err("error: %s: clk vdac_clk_gate\n", __func__);
}
static void cvbsout_clktree_remove(struct device *dev)
{
- if (!IS_ERR(info->venci_top_gate))
- devm_clk_put(dev, info->venci_top_gate);
- if (!IS_ERR(info->venci_0_gate))
- devm_clk_put(dev, info->venci_0_gate);
- if (!IS_ERR(info->venci_1_gate))
- devm_clk_put(dev, info->venci_1_gate);
- if (!IS_ERR(info->vdac_clk_gate))
- devm_clk_put(dev, info->vdac_clk_gate);
+ if (!IS_ERR(cvbs_drv->venci_top_gate))
+ devm_clk_put(dev, cvbs_drv->venci_top_gate);
+ if (!IS_ERR(cvbs_drv->venci_0_gate))
+ devm_clk_put(dev, cvbs_drv->venci_0_gate);
+ if (!IS_ERR(cvbs_drv->venci_1_gate))
+ devm_clk_put(dev, cvbs_drv->venci_1_gate);
+ if (!IS_ERR(cvbs_drv->vdac_clk_gate))
+ devm_clk_put(dev, cvbs_drv->vdac_clk_gate);
}
#ifdef CONFIG_OF
@@ -1474,36 +1507,45 @@ static int cvbsout_probe(struct platform_device *pdev)
const struct of_device_id *match;
cvbs_clk_path = 0;
-
local_cvbs_mode = MODE_MAX;
- info = &disp_module_info;
+
+ cvbs_drv = kmalloc(sizeof(*cvbs_drv), GFP_KERNEL);
+ if (!cvbs_drv)
+ return -ENOMEM;
+
match = of_match_device(meson_cvbsout_dt_match, &pdev->dev);
if (match == NULL) {
- cvbs_log_err("%s,no matched table\n", __func__);
- return -1;
+ cvbs_log_err("%s, no matched table\n", __func__);
+ goto cvbsout_probe_err;
}
- info->cvbs_data = (struct meson_cvbsout_data *)match->data;
+ cvbs_drv->cvbs_data = (struct meson_cvbsout_data *)match->data;
cvbs_log_info("%s, cpu_id:%d,name:%s\n", __func__,
- info->cvbs_data->cpu_id, info->cvbs_data->name);
+ cvbs_drv->cvbs_data->cpu_id, cvbs_drv->cvbs_data->name);
- cvbsout_get_config(&pdev->dev);
cvbsout_clktree_probe(&pdev->dev);
+ cvbsout_get_config(&pdev->dev);
cvbs_init_vout();
- ret = alloc_chrdev_region(&info->devno, 0, 1, CVBS_NAME);
+ ret = alloc_chrdev_region(&cvbs_drv->devno, 0, 1, CVBS_NAME);
if (ret < 0) {
cvbs_log_err("alloc_chrdev_region error\n");
- return ret;
+ goto cvbsout_probe_err;
}
- cvbs_log_err("chrdev devno %d for disp\n", info->devno);
- ret = create_cvbs_attr(info);
+ cvbs_log_err("chrdev devno %d for disp\n", cvbs_drv->devno);
+ ret = create_cvbs_attr(cvbs_drv);
if (ret < 0) {
cvbs_log_err("create_cvbs_attr error\n");
- return -1;
+ goto cvbsout_probe_err;
}
- INIT_DELAYED_WORK(&info->dv_dwork, cvbs_dv_dwork);
+
+ INIT_DELAYED_WORK(&cvbs_drv->dv_dwork, cvbs_dv_dwork);
cvbs_log_info("%s OK\n", __func__);
return 0;
+
+cvbsout_probe_err:
+ kfree(cvbs_drv);
+ cvbs_drv = NULL;
+ return -1;
}
static int cvbsout_remove(struct platform_device *pdev)
@@ -1512,14 +1554,14 @@ static int cvbsout_remove(struct platform_device *pdev)
cvbsout_clktree_remove(&pdev->dev);
- if (info->base_class) {
+ if (cvbs_drv->base_class) {
for (i = 0; i < ARRAY_SIZE(cvbs_attr); i++)
- class_remove_file(info->base_class, cvbs_attr[i]);
- class_destroy(info->base_class);
+ class_remove_file(cvbs_drv->base_class, cvbs_attr[i]);
+ class_destroy(cvbs_drv->base_class);
}
- if (info) {
- cdev_del(info->cdev);
- kfree(info);
+ if (cvbs_drv) {
+ cdev_del(cvbs_drv->cdev);
+ kfree(cvbs_drv);
}
vout_unregister_server(&cvbs_vout_server);
#ifdef CONFIG_AMLOGIC_VOUT2_SERVE
@@ -1531,7 +1573,7 @@ static int cvbsout_remove(struct platform_device *pdev)
static void cvbsout_shutdown(struct platform_device *pdev)
{
- info->dwork_flag = 0;
+ cvbs_drv->dwork_flag = 0;
cvbs_out_reg_write(ENCI_VIDEO_EN, 0);
cvbs_out_disable_clk();
@@ -1581,18 +1623,6 @@ static int __init vdac_config_bootargs_setup(char *line)
__setup("vdaccfg=", vdac_config_bootargs_setup);
-static int __init cvbs_performance_setup(char *line)
-{
- unsigned long cfg = 0x0;
- int ret = 0;
-
- cvbs_log_info("cvbs performance line = %s\n", line);
- ret = kstrtoul(line, 10, (unsigned long *)&cfg);
- cvbs_performance_config(cfg);
- return 0;
-}
-__setup("cvbsdrv=", cvbs_performance_setup);
-
arch_initcall(cvbs_init_module);
module_exit(cvbs_exit_module);
diff --git a/drivers/amlogic/media/vout/cvbs/cvbs_out.h b/drivers/amlogic/media/vout/cvbs/cvbs_out.h
index 79f803c..d62179e 100644
--- a/drivers/amlogic/media/vout/cvbs/cvbs_out.h
+++ b/drivers/amlogic/media/vout/cvbs/cvbs_out.h
@@ -37,8 +37,6 @@
#define VOUT_IOC_CC_CLOSE _IO(_TM_V, 0x02)
#define VOUT_IOC_CC_DATA _IOW(_TM_V, 0x03, struct vout_CCparm_s)
-#define print_info(fmt, args...) pr_info(fmt, ##args)
-
struct reg_s {
unsigned int reg;
unsigned int val;
@@ -60,19 +58,20 @@ struct meson_cvbsout_data {
};
#define CVBS_PERFORMANCE_CNT_MAX 20
-struct cvbs_config_s {
- unsigned int performance_reg_cnt;
- struct reg_s *performance_reg_table;
+struct performance_config_s {
+ unsigned int reg_cnt;
+ struct reg_s *reg_table;
};
-struct disp_module_info_s {
+struct cvbs_drv_s {
struct vinfo_s *vinfo;
struct cdev *cdev;
dev_t devno;
struct class *base_class;
struct device *dev;
struct meson_cvbsout_data *cvbs_data;
- struct cvbs_config_s cvbs_conf;
+ struct performance_config_s perf_conf_pal;
+ struct performance_config_s perf_conf_ntsc;
struct delayed_work dv_dwork;
bool dwork_flag;
diff --git a/drivers/amlogic/media/vout/vout_serve/vout_func.c b/drivers/amlogic/media/vout/vout_serve/vout_func.c
index c8661b3..6c32aed 100644
--- a/drivers/amlogic/media/vout/vout_serve/vout_func.c
+++ b/drivers/amlogic/media/vout/vout_serve/vout_func.c
@@ -216,6 +216,14 @@ void vout_func_update_viu(int index)
}
p_server = p_module->curr_vout_server;
+/*
+ * VOUTPR("%s: before: 0x%04x=0x%08x, 0x%04x=0x%08x\n",
+ * __func__, VPU_VIU_VENC_MUX_CTRL,
+ * vout_vcbus_read(VPU_VIU_VENC_MUX_CTRL),
+ * VPU_VENCX_CLK_CTRL,
+ * vout_vcbus_read(VPU_VENCX_CLK_CTRL));
+ */
+
if (p_server) {
if (p_server->op.get_vinfo)
vinfo = p_server->op.get_vinfo();
@@ -245,10 +253,15 @@ void vout_func_update_viu(int index)
if (clk_bit < 0xff)
vout_func_vcbus_setb(VPU_VENCX_CLK_CTRL, clk_sel, clk_bit, 1);
-#if 0
- VOUTPR("%s: %d, mux_sel=%d, clk_sel=%d\n",
- __func__, index, mux_sel, clk_sel);
-#endif
+/*
+ * VOUTPR("%s: %d, mux_sel=%d, mux_bit=%d, clk_sel=%d clk_bit=%d\n",
+ * __func__, index, mux_sel, mux_bit, clk_sel, clk_bit);
+ * VOUTPR("%s: after: 0x%04x=0x%08x, 0x%04x=0x%08x\n",
+ * __func__, VPU_VIU_VENC_MUX_CTRL,
+ * vout_vcbus_read(VPU_VIU_VENC_MUX_CTRL),
+ * VPU_VENCX_CLK_CTRL,
+ * vout_vcbus_read(VPU_VENCX_CLK_CTRL));
+ */
mutex_unlock(&vout_mutex);
}
EXPORT_SYMBOL(vout_func_update_viu);