tvafe: fix av pal flash issue on some devices [1/1]
authorNian Jing <nian.jing@amlogic.com>
Wed, 19 Dec 2018 12:45:46 +0000 (20:45 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Wed, 26 Dec 2018 02:00:00 +0000 (18:00 -0800)
PD#SWPL-2636

Problem:
Picture flash when av connect some dvd or mbox

Solution:
Modify the vafe ctrl config

Verify:
verified by x301

Change-Id: Ie6ae659f3f59d7daba680e2bb32112031232c956
Signed-off-by: Nian Jing <nian.jing@amlogic.com>
drivers/amlogic/media/vin/tvin/tvafe/tvafe_debug.c
drivers/amlogic/media/vin/tvin/tvafe/tvafe_general.c
drivers/amlogic/media/vin/tvin/tvafe/tvafe_vbi.c

index 44993fd..0518189 100644 (file)
@@ -450,10 +450,9 @@ static ssize_t tvafereg_store(struct device *dev,
                struct device_attribute *attr, const char *buff, size_t count)
 {
        struct tvafe_dev_s *devp;
-       unsigned int argn = 0, addr = 0, value = 0, end = 0;
+       unsigned int argn = 0, addr = 0, value = 0, end = 0, tmp = 0;
        char *p, *para, *buf_work, cmd = 0;
        char *argv[3];
-       long tmp = 0;
 
        devp = dev_get_drvdata(dev);
 
@@ -485,7 +484,7 @@ static ssize_t tvafereg_store(struct device *dev,
                        if (argn < 2) {
                                tvafe_pr_err("syntax error.\n");
                        } else{
-                               if (kstrtol(argv[1], 16, &tmp) == 0)
+                               if (kstrtouint(argv[1], 16, &tmp) == 0)
                                        addr = tmp;
                                else
                                        break;
@@ -499,11 +498,11 @@ static ssize_t tvafereg_store(struct device *dev,
                        if (argn < 3) {
                                tvafe_pr_err("syntax error.\n");
                        } else{
-                               if (kstrtol(argv[1], 16, &tmp) == 0)
+                               if (kstrtouint(argv[1], 16, &tmp) == 0)
                                        value = tmp;
                                else
                                        break;
-                               if (kstrtol(argv[2], 16, &tmp) == 0)
+                               if (kstrtouint(argv[2], 16, &tmp) == 0)
                                        addr = tmp;
                                else
                                        break;
@@ -517,11 +516,11 @@ static ssize_t tvafereg_store(struct device *dev,
                        if (argn < 3) {
                                tvafe_pr_err("syntax error.\n");
                        } else{
-                               if (kstrtol(argv[1], 16, &tmp) == 0)
+                               if (kstrtouint(argv[1], 16, &tmp) == 0)
                                        addr = tmp;
                                else
                                        break;
-                               if (kstrtol(argv[2], 16, &tmp) == 0)
+                               if (kstrtouint(argv[2], 16, &tmp) == 0)
                                        end = tmp;
                                else
                                        break;
index 70c8faa..0f2cf0d 100644 (file)
@@ -254,14 +254,16 @@ static enum tvafe_adc_ch_e tvafe_adc_pin_muxing(
 
                        W_APB_BIT(TVFE_VAFE_CTRL1, 1,
                                VAFE_IN_SEL_BIT, VAFE_IN_SEL_WID);
-                       W_APB_BIT(TVFE_VAFE_CTRL2, 3, 4, 3);
+                       if (tvafe_cpu_type() != CPU_TYPE_TL1)
+                               W_APB_BIT(TVFE_VAFE_CTRL2, 3, 4, 3);
                        ret = TVAFE_ADC_CH_0;
 
                } else if (pin == TVAFE_CVBS_IN1) {
 
                        W_APB_BIT(TVFE_VAFE_CTRL1, 2,
                                VAFE_IN_SEL_BIT, VAFE_IN_SEL_WID);
-                       W_APB_BIT(TVFE_VAFE_CTRL2, 5, 4, 3);
+                       if (tvafe_cpu_type() != CPU_TYPE_TL1)
+                               W_APB_BIT(TVFE_VAFE_CTRL2, 5, 4, 3);
                        ret = TVAFE_ADC_CH_1;
 
                } else if (pin == TVAFE_CVBS_IN2) {
@@ -450,7 +452,7 @@ static void tvafe_set_cvbs_default(struct tvafe_cvd2_s *cvd2,
                                        (port == TVIN_PORT_CVBS2)) {
                                W_APB_REG(TVFE_VAFE_CTRL0, 0x00490710);
                                W_APB_REG(TVFE_VAFE_CTRL1, 0x0000110e);
-                               W_APB_REG(TVFE_VAFE_CTRL2, 0x1fe09fd3);
+                               W_APB_REG(TVFE_VAFE_CTRL2, 0x1fe09f83);
                        }
                } else {
                        W_APB_REG(TVFE_VAFE_CTRL0, 0x00090b00);
@@ -706,19 +708,19 @@ int adc_set_pll_cntl(bool on, unsigned int module_sel, void *pDtvPara)
                                adc_pll_lock_cnt++;
                        } while (!R_HIU_BIT(HHI_ADC_PLL_CNTL0_TL1, 31, 1) &&
                                (adc_pll_lock_cnt < 10));
-                       tvafe_pr_info("b0=0x%x",
+                       tvafe_pr_info("b0=0x%x\n",
                                R_HIU_REG(HHI_ADC_PLL_CNTL0_TL1));
-                       tvafe_pr_info("b1=0x%x",
+                       tvafe_pr_info("b1=0x%x\n",
                                R_HIU_REG(HHI_ADC_PLL_CNTL1_TL1));
-                       tvafe_pr_info("b2=0x%x",
+                       tvafe_pr_info("b2=0x%x\n",
                                R_HIU_REG(HHI_ADC_PLL_CNTL2_TL1));
-                       tvafe_pr_info("b3=0x%x",
+                       tvafe_pr_info("b3=0x%x\n",
                                R_HIU_REG(HHI_ADC_PLL_CNTL3_TL1));
-                       tvafe_pr_info("b4=0x%x",
+                       tvafe_pr_info("b4=0x%x\n",
                                R_HIU_REG(HHI_ADC_PLL_CNTL4_TL1));
-                       tvafe_pr_info("b5=0x%x",
+                       tvafe_pr_info("b5=0x%x\n",
                                R_HIU_REG(HHI_ADC_PLL_CNTL5_TL1));
-                       tvafe_pr_info("b6=0x%x",
+                       tvafe_pr_info("b6=0x%x\n",
                                R_HIU_REG(HHI_ADC_PLL_CNTL6_TL1));
 
                } else {
index 21a3ee5..2857d8e 100644 (file)
@@ -1378,7 +1378,7 @@ static ssize_t vbi_store(struct device *dev,
        struct vbi_dev_s *devp = dev_get_drvdata(dev);
        struct vbi_slicer_s *vbi_slicer;
        struct vbi_ringbuffer_s *vbi_buffer;
-       long val;
+       unsigned int val;
        int ret = 0;
 
        if (!buff || !devp)
@@ -1420,13 +1420,13 @@ static ssize_t vbi_store(struct device *dev,
                tvafe_pr_info("dump satus done!!\n");
        } else if (!strncmp(parm[0], "enable_tasklet",
                strlen("enable_tasklet"))) {
-               if (kstrtol(parm[1], 10, &val) < 0)
+               if (kstrtouint(parm[1], 10, &val) < 0)
                        return -EINVAL;
                devp->tasklet_enable = val;
                tvafe_pr_info("tasklet_enable:%d\n", devp->tasklet_enable);
        } else if (!strncmp(parm[0], "data_wmode",
                strlen("data_wmode"))) {
-               if (kstrtol(parm[1], 10, &val) < 0)
+               if (kstrtouint(parm[1], 10, &val) < 0)
                        return -EINVAL;
                vbi_buffer->data_wmode = val;
                tvafe_pr_info("data_wmode:%d\n", vbi_buffer->data_wmode);
@@ -1450,13 +1450,13 @@ static ssize_t vbi_store(struct device *dev,
                tvafe_pr_info(" disable vbi function\n");
                tvafe_pr_info("stop done!!!\n");
        } else if (!strncmp(parm[0], "set_size", strlen("set_size"))) {
-               if (kstrtol(parm[1], 10, &val) < 0)
+               if (kstrtouint(parm[1], 10, &val) < 0)
                        return -EINVAL;
-               vbi_set_buffer_size(devp, (unsigned int)val);
+               vbi_set_buffer_size(devp, val);
                tvafe_pr_info(" set buf size to %d\n",
                        vbi_slicer->buffer.size);
        } else if (!strncmp(parm[0], "set_type", strlen("set_type"))) {
-               if (kstrtol(parm[1], 16, &val) < 0)
+               if (kstrtouint(parm[1], 16, &val) < 0)
                        return -EINVAL;
                vbi_slicer->type = val;
                vbi_slicer_set(devp, vbi_slicer);