From: Bencheng Jing Date: Sat, 6 Apr 2019 10:40:06 +0000 (+0800) Subject: amvecm: add 3x65 bin gamma setting function [1/1] X-Git-Tag: hardkernel-4.9.236-104~865 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2ea85a625a85b5f80cd8ea435cfdcd592ba2077;p=platform%2Fkernel%2Flinux-amlogic.git 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 --- diff --git a/drivers/amlogic/media/enhancement/amvecm/amve.c b/drivers/amlogic/media/enhancement/amvecm/amve.c index fe01997..48bfd1d 100644 --- a/drivers/amlogic/media/enhancement/amvecm/amve.c +++ b/drivers/amlogic/media/enhancement/amvecm/amve.c @@ -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); + } +} diff --git a/drivers/amlogic/media/enhancement/amvecm/amve.h b/drivers/amlogic/media/enhancement/amvecm/amve.h index 6963dfe..d9f047e 100644 --- a/drivers/amlogic/media/enhancement/amvecm/amve.h +++ b/drivers/amlogic/media/enhancement/amvecm/amve.h @@ -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 diff --git a/drivers/amlogic/media/enhancement/amvecm/amvecm.c b/drivers/amlogic/media/enhancement/amvecm/amvecm.c index 8b6c2d5..5f7c6c46 100644 --- a/drivers/amlogic/media/enhancement/amvecm/amvecm.c +++ b/drivers/amlogic/media/enhancement/amvecm/amvecm.c @@ -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"); diff --git a/drivers/amlogic/media/enhancement/amvecm/arch/vpp_regs.h b/drivers/amlogic/media/enhancement/amvecm/arch/vpp_regs.h index d9b5448..93c941c 100644 --- a/drivers/amlogic/media/enhancement/amvecm/arch/vpp_regs.h +++ b/drivers/amlogic/media/enhancement/amvecm/arch/vpp_regs.h @@ -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