amvecm: add option for applying gamma [1/1]

PD#SWPL-11288

Problem:
we'd better provide the flexibility
for gamma applying protection

Solution:
add option to let user to choose
if the applying protection is needed
or not

Verify:
tl1

Change-Id: I3f215545c7921134a282571d7f734bb8b42d553e
Signed-off-by: Xihai Zhu <xihai.zhu@amlogic.com>
This commit is contained in:
Xihai Zhu
2019-07-03 07:47:12 -04:00
committed by Tao Zeng
parent 5c40910fae
commit 4d246f70dd
3 changed files with 19 additions and 2 deletions

View File

@@ -47,6 +47,7 @@
/* printk(KERN_##(KERN_INFO) "AMVECM: " fmt, ## args) */
#define GAMMA_RETRY 1000
unsigned int gamma_loadprotect_en = 1;
/* 0: Invalid */
/* 1: Valid */
@@ -292,6 +293,9 @@ void vpp_set_lcd_gamma_table(u16 *data, u32 rgb_mask)
spin_lock_irqsave(&vpp_lcd_gamma_lock, flags);
if (gamma_loadprotect_en)
WRITE_VPP_REG_BITS(L_GAMMA_CNTL_PORT, 0, GAMMA_EN, 1);
while (!(READ_VPP_REG(L_GAMMA_CNTL_PORT) & (0x1 << ADR_RDY))) {
udelay(10);
if (cnt++ > GAMMA_RETRY)
@@ -319,6 +323,10 @@ void vpp_set_lcd_gamma_table(u16 *data, u32 rgb_mask)
(0x1 << rgb_mask) |
(0x23 << HADR));
if (gamma_loadprotect_en)
VSYNC_WR_MPEG_REG_BITS(L_GAMMA_CNTL_PORT,
gamma_en, GAMMA_EN, 1);
spin_unlock_irqrestore(&vpp_lcd_gamma_lock, flags);
}

View File

@@ -57,6 +57,7 @@ struct ve_regs_s {
unsigned int rsv:5;
};
extern unsigned int gamma_loadprotect_en;
extern struct ve_hist_s video_ve_hist;
extern void ve_hist_gamma_reset(void);
extern unsigned int ve_size;

View File

@@ -5101,8 +5101,10 @@ static const char *amvecm_debug_usage_str = {
"echo vpp_size > /sys/class/amvecm/debug; get vpp size config\n"
"echo wb enable > /sys/class/amvecm/debug\n"
"echo wb disable > /sys/class/amvecm/debug\n"
"echo gama enable > /sys/class/amvecm/debug\n"
"echo gama disable > /sys/class/amvecm/debug\n"
"echo gamma enable > /sys/class/amvecm/debug\n"
"echo gamma disable > /sys/class/amvecm/debug\n"
"echo gamma load_protect_en > /sys/class/amvecm/debug\n"
"echo gamma load_protect_dis > /sys/class/amvecm/debug\n"
"echo sr peaking_en > /sys/class/amvecm/debug\n"
"echo sr peaking_dis > /sys/class/amvecm/debug\n"
"echo sr lcti_en > /sys/class/amvecm/debug\n"
@@ -5180,6 +5182,12 @@ static ssize_t amvecm_debug_store(struct class *cla,
} else if (!strncmp(parm[1], "disable", 7)) {
vecm_latch_flag |= FLAG_GAMMA_TABLE_DIS;/* gamma off */
pr_info("disable gamma\n");
} else if (!strncmp(parm[1], "load_protect_en", 15)) {
gamma_loadprotect_en = 1;
pr_info("disable gamma before loading new gamma\n");
} else if (!strncmp(parm[1], "load_protect_dis", 16)) {
gamma_loadprotect_en = 0;
pr_info("loading new gamma without pretect");
}
} else if (!strncmp(parm[0], "sr", 2)) {
if (!strncmp(parm[1], "peaking_en", 10)) {