pq: add pq demo interface [1/1]
authorMingLiang Dong <mingliang.dong@amlogic.com>
Tue, 9 Jul 2019 03:21:03 +0000 (23:21 -0400)
committerTao Zeng <tao.zeng@amlogic.com>
Mon, 5 Aug 2019 08:06:57 +0000 (01:06 -0700)
PD#TV-7491

Problem:
pq demo function

Solution:
add pq demo interface

Verify:
verify on TL1

Change-Id: If53fbba5f59a278394f71420e5cdc9c481abc0f7
Signed-off-by: MingLiang Dong <mingliang.dong@amlogic.com>
drivers/amlogic/media/deinterlace/deinterlace_hw.c
drivers/amlogic/media/deinterlace/nr_drv.c
drivers/amlogic/media/deinterlace/nr_drv.h
drivers/amlogic/media/enhancement/amvecm/amcm.c
drivers/amlogic/media/enhancement/amvecm/amvecm.c
include/linux/amlogic/media/amvecm/amvecm.h

index 0f52277..34483c0 100644 (file)
@@ -33,6 +33,8 @@
 #include "deinterlace.h"
 #include "register.h"
 #include "register_nr4.h"
+#include "nr_drv.h"
+
 #ifdef DET3D
 #include "detect3d.h"
 #endif
@@ -3873,6 +3875,11 @@ void di_load_regs(struct di_pq_parm_s *di_pq_ptr)
                addr = regs_p->addr;
                value = regs_p->val;
                mask = regs_p->mask;
+               if (nr_demo_flag) {
+                       if (addr == NR4_TOP_CTRL)
+                               mask &= ~(0x7 << 6);
+               }
+
                if (pq_load_dbg == 2)
                        pr_info("[%u][0x%x] = [0x%x]&[0x%x]\n",
                                i, addr, value, mask);
index 1d8cc7b..d29ea48 100644 (file)
@@ -46,6 +46,8 @@ module_param_named(nr2_en, nr2_en, uint, 0644);
 
 static bool nr_ctrl_reg;
 
+bool nr_demo_flag;
+
 int global_bs_calc_sw(int *pGbsVldCnt,
                          int *pGbsVldFlg,
                          int *pGbs,
@@ -1173,6 +1175,18 @@ static void nr_all_ctrl(bool enable)
        DI_Wr_reg_bits(DNR_CTRL, value, 16, 1);
 
 }
+
+static void nr_demo_mode(bool enable)
+{
+       if (enable) {
+               DI_Wr_reg_bits(NR4_TOP_CTRL, 0, 6, 3);
+               nr_demo_flag = 1;
+       } else {
+               DI_Wr_reg_bits(NR4_TOP_CTRL, 7, 6, 3);
+               nr_demo_flag = 0;
+       }
+}
+
 static ssize_t nr_dbg_store(struct device *dev,
                                struct device_attribute *attr,
                                const char *buff, size_t count)
@@ -1185,6 +1199,15 @@ static ssize_t nr_dbg_store(struct device *dev,
                nr_all_ctrl(false);
        else if (!strcmp(parm[0], "enable"))
                nr_all_ctrl(true);
+       else if (!strcmp(parm[0], "demo")) {
+               if (!strcmp(parm[1], "enable")) {
+                       nr_demo_mode(true);
+                       pr_info("nr demo enable\n");
+               } else if (!strcmp(parm[1], "disable")) {
+                       nr_demo_mode(false);
+                       pr_info("nr demo disable\n");
+               }
+       }
 
        kfree(buf_orig);
        return count;
index 36b98d1..8dcc2dc 100644 (file)
@@ -185,5 +185,6 @@ bool set_nr_ctrl_reg_table(unsigned int addr, unsigned int value);
 
 extern void cue_int(void);
 
+extern bool nr_demo_flag;
 #endif
 
index ada8e14..03fb262 100644 (file)
@@ -253,6 +253,13 @@ void am_set_regmap(struct am_regs_s *p)
                        } else {
                                if (p->am_reg[i].addr == 0x1d26)
                                        break;
+                               if (sr_demo_flag) {
+                                       if ((p->am_reg[i].addr ==
+                                               SHARP0_DEMO_CRTL) ||
+                                               (p->am_reg[i].addr ==
+                                               SHARP1_DEMO_CRTL))
+                                               break;
+                               }
                        /*if the bit 4 of SRSHARP1_LC_TOP_CTRL is 1,
                         *it means that lc is enable in db,
                         *so need to change lc_en to 1;
index 1c8b1e2..0896dbb 100644 (file)
@@ -189,6 +189,8 @@ enum hdr_type_e hdr_source_type = HDRTYPE_NONE;
 #define SR1_OFFSET 0xc80
 unsigned int sr_offset[2] = {0, 0};
 
+unsigned int sr_demo_flag;
+
 static int wb_init_bypass_coef[24] = {
        0, 0, 0, /* pre offset */
        1024,   0,      0,
@@ -4453,6 +4455,28 @@ void amvecm_sharpness_enable(int sel)
        }
 }
 
+void amvecm_sr_demo(int enable)
+{
+       if (enable) {
+               sr_demo_flag = 1;
+               WRITE_VPP_REG_BITS(SHARP0_DEMO_CRTL, 2, 17, 2);
+               WRITE_VPP_REG_BITS(SHARP0_DEMO_CRTL, 1, 16, 1);
+               WRITE_VPP_REG_BITS(SHARP0_DEMO_CRTL, 0x438, 0, 13);
+               WRITE_VPP_REG_BITS(SHARP1_DEMO_CRTL, 2, 17, 2);
+               WRITE_VPP_REG_BITS(SHARP1_DEMO_CRTL, 1, 16, 1);
+               WRITE_VPP_REG_BITS(SHARP1_DEMO_CRTL, 0x438, 0, 13);
+
+       } else {
+               sr_demo_flag = 0;
+               WRITE_VPP_REG_BITS(SHARP0_DEMO_CRTL, 2, 17, 2);
+               WRITE_VPP_REG_BITS(SHARP0_DEMO_CRTL, 0, 16, 1);
+               WRITE_VPP_REG_BITS(SHARP0_DEMO_CRTL, 0x438, 0, 13);
+               WRITE_VPP_REG_BITS(SHARP1_DEMO_CRTL, 2, 17, 2);
+               WRITE_VPP_REG_BITS(SHARP1_DEMO_CRTL, 0, 16, 1);
+               WRITE_VPP_REG_BITS(SHARP1_DEMO_CRTL, 0x438, 0, 13);
+       }
+}
+
 void amvecm_clip_range_limit(bool limit_en)
 {
        /*fix mbox av out flicker black dot*/
@@ -5250,6 +5274,14 @@ static ssize_t amvecm_debug_store(struct class *cla,
                        amvecm_sharpness_enable(11);
                        amvecm_sharpness_enable(13);
                        pr_info("SR disable\n");
+               }  else if (!strncmp(parm[1], "demo", 4)) {
+                       if (!strncmp(parm[2], "enable", 6)) {
+                               amvecm_sr_demo(1);
+                               pr_info("sr demo enable\n");
+                       } else if (!strncmp(parm[2], "disable", 7)) {
+                               amvecm_sr_demo(0);
+                               pr_info("sr demo disable\n");
+                       }
                }
        } else if (!strcmp(parm[0], "cm")) {
                if (!strncmp(parm[1], "enable", 6)) {
index 269f00e..28f7307 100644 (file)
@@ -460,6 +460,7 @@ extern signed int vd1_brightness, vd1_contrast;
 extern bool gamma_en;
 
 extern unsigned int atv_source_flg;
+extern unsigned int sr_demo_flag;
 
 extern enum hdr_type_e hdr_source_type;