amvecm: add 3x65 bin gamma setting function [1/1]

PD#SWPL-6644

Problem:
add 3x65 bin gamma function

Solution:
add 3x65 bin gamma function

Verify:
tm2

Change-Id: I1f70af4b7ad6b5906004c1912e2b8f5e4366da4e
Signed-off-by: Bencheng Jing <bencheng.jing@amlogic.com>
This commit is contained in:
Bencheng Jing
2019-04-06 18:40:06 +08:00
committed by Tao Zeng
parent 299e2feae1
commit a2ea85a625
4 changed files with 56 additions and 1 deletions

View File

@@ -1666,4 +1666,49 @@ void dump_plut3d_reg_table(void)
}
}
void set_gamma_regs(int en, int sel)
{
int i;
int *gamma_lut = NULL;
static int gamma_lut_default[66] = {
0, 0, 0, 1, 2, 4, 6, 8, 11, 14, 17, 21, 26, 31,
36, 42, 49, 55, 63, 71, 79, 88, 98, 108, 118,
129, 141, 153, 166, 179, 193, 208, 223, 238,
255, 271, 289, 307, 325, 344, 364, 384, 405,
427, 449, 472, 495, 519, 544, 569, 595, 621,
649, 676, 705, 734, 763, 794, 825, 856, 888,
921, 955, 989, 1023, 0};
static int gamma_lut_straight[66] = {
0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160,
176, 192, 208, 224, 240, 256, 272, 288, 304, 320,
336, 352, 368, 384, 400, 416, 432, 448, 464, 480,
496, 512, 528, 544, 560, 576, 592, 608, 624, 640,
656, 672, 688, 704, 720, 736, 752, 768, 784, 800,
816, 832, 848, 864, 880, 896, 912, 928, 944, 960,
976, 992, 1008, 1023, 0};
if (!sel)
gamma_lut = gamma_lut_default;
else
gamma_lut = gamma_lut_straight;
if (en) {
WRITE_VPP_REG(VPP_GAMMA_BIN_ADDR, 0);
for (i = 0; i < 33; i = i + 1)
WRITE_VPP_REG(VPP_GAMMA_BIN_DATA,
(((gamma_lut[i*2+1]<<2)&0xffff)<<16 |
((gamma_lut[i*2]<<2)&0xffff)));
for (i = 0; i < 33; i = i + 1)
WRITE_VPP_REG(VPP_GAMMA_BIN_DATA,
(((gamma_lut[i*2+1]<<2)&0xffff)<<16 |
((gamma_lut[i*2]<<2)&0xffff)));
for (i = 0; i < 33; i = i + 1)
WRITE_VPP_REG(VPP_GAMMA_BIN_DATA,
(((gamma_lut[i*2+1]<<2)&0xffff)<<16 |
((gamma_lut[i*2]<<2)&0xffff)));
WRITE_VPP_REG_BITS(VPP_GAMMA_CTRL, 0x1, 0, 1);
}
}

View File

@@ -168,6 +168,6 @@ extern void dump_plut3d_table(void);
extern void dump_plut3d_reg_table(void);
extern void amvecm_gamma_init(bool en);
extern void set_gamma_regs(int en, int sel);
#endif

View File

@@ -5565,6 +5565,13 @@ static ssize_t amvecm_debug_store(struct class *cla,
overscan_table[i].afd_enable,
overscan_table[i].load_flag);
}
} else if (!strcmp(parm[0], "set_gamma_lut_65")) {
if (!strcmp(parm[1], "default"))
set_gamma_regs(1, 0);
else if (!strcmp(parm[1], "straight"))
set_gamma_regs(1, 1);
else
pr_info("unsupport cmd\n");
} else
pr_info("unsupport cmd\n");

View File

@@ -868,6 +868,9 @@
#define VPP_LUT3D_CBUS2RAM_CTRL 0x39d1
#define VPP_LUT3D_RAM_ADDR 0x39d2
#define VPP_LUT3D_RAM_DATA 0x39d3
#define VPP_GAMMA_CTRL 0x39d4
#define VPP_GAMMA_BIN_ADDR 0x39d5
#define VPP_GAMMA_BIN_DATA 0x39d6
#define ENCL_VIDEO_EN 0x1ca0