mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
amvecm: Local Contrast ioctrl load interface support [1/4]
PD#SWPL-3301 Problem: Local Contrast ioctrl load interface support Solution: add Local Contrast ioctrl load interface Verify: tl1 Change-Id: I1c2ed1f54a1fe85b589f95fe9e49f8c469f3e80d Signed-off-by: Bencheng Jing <bencheng.jing@amlogic.com>
This commit is contained in:
committed by
Jianxin Pan
parent
ff95b81bad
commit
877bdf598d
@@ -36,6 +36,7 @@
|
||||
#include "amve_gamma_table.h"
|
||||
#include <linux/io.h>
|
||||
#include "dnlp_cal.h"
|
||||
#include "local_contrast.h"
|
||||
|
||||
#define pr_amve_dbg(fmt, args...)\
|
||||
do {\
|
||||
@@ -766,6 +767,14 @@ void ve_dnlp_latch_process(void)
|
||||
}
|
||||
}
|
||||
|
||||
void ve_lc_latch_process(void)
|
||||
{
|
||||
if (vecm_latch_flag & FLAG_VE_LC_CURV) {
|
||||
vecm_latch_flag &= ~FLAG_VE_LC_CURV;
|
||||
lc_load_curve(&lc_curve_parm_load);
|
||||
}
|
||||
}
|
||||
|
||||
void ve_lcd_gamma_process(void)
|
||||
{
|
||||
if (vecm_latch_flag & FLAG_GAMMA_TABLE_EN) {
|
||||
@@ -868,6 +877,11 @@ void ve_new_dnlp_param_update(void)
|
||||
vecm_latch_flag |= FLAG_VE_NEW_DNLP;
|
||||
}
|
||||
|
||||
void ve_lc_curve_update(void)
|
||||
{
|
||||
vecm_latch_flag |= FLAG_VE_LC_CURV;
|
||||
}
|
||||
|
||||
static void video_data_limitation(int *val)
|
||||
{
|
||||
if (*val > 1023)
|
||||
|
||||
@@ -110,6 +110,8 @@ extern void ve_lcd_gamma_process(void);
|
||||
extern void lvds_freq_process(void);
|
||||
extern void ve_dnlp_param_update(void);
|
||||
extern void ve_new_dnlp_param_update(void);
|
||||
extern void ve_lc_curve_update(void);
|
||||
extern void ve_lc_latch_process(void);
|
||||
extern void ve_ogo_param_update(void);
|
||||
extern void am_set_regmap(struct am_regs_s *p);
|
||||
extern void sharpness_process(struct vframe_s *vf);
|
||||
|
||||
@@ -1059,7 +1059,8 @@ void amvecm_video_latch(void)
|
||||
}
|
||||
/* #endif */
|
||||
pq_user_latch_process();
|
||||
|
||||
if (cpu_after_eq(MESON_CPU_MAJOR_ID_TL1))
|
||||
ve_lc_latch_process();
|
||||
}
|
||||
|
||||
int amvecm_on_vs(
|
||||
@@ -1676,6 +1677,17 @@ static long amvecm_ioctl(struct file *file,
|
||||
ret = amvecm_set_contrast2(vdj_mode_s.contrast2);
|
||||
}
|
||||
break;
|
||||
case AMVECM_IOC_S_LC_CURVE:
|
||||
if (copy_from_user(&lc_curve_parm_load,
|
||||
(void __user *)arg,
|
||||
sizeof(struct ve_lc_curve_parm_s))) {
|
||||
pr_amvecm_dbg("lc load curve parm fail\n");
|
||||
ret = -EFAULT;
|
||||
} else {
|
||||
ve_lc_curve_update();
|
||||
pr_amvecm_dbg("lc load curve parm success\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
@@ -5612,6 +5624,44 @@ static void lc_wr_reg(int *p, enum lc_reg_lut_e reg_sel)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int lc_saturation_curv[63];
|
||||
unsigned int lc_yminval_lmt_curv[12];
|
||||
unsigned int lc_ypkbv_ymaxval_lmt_curv[12];
|
||||
unsigned int lc_ypkbv_ratio_curv[4];
|
||||
|
||||
void lc_load_curve(struct ve_lc_curve_parm_s *p)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
/*load lc parms*/
|
||||
lc_alg_parm.dbg_parm0 = p->param[lc_dbg_parm0];
|
||||
lc_alg_parm.dbg_parm1 = p->param[lc_dbg_parm1];
|
||||
lc_alg_parm.dbg_parm2 = p->param[lc_dbg_parm2];
|
||||
lc_alg_parm.dbg_parm3 = p->param[lc_dbg_parm3];
|
||||
lc_alg_parm.dbg_parm4 = p->param[lc_dbg_parm4];
|
||||
|
||||
/*load lc curve*/
|
||||
for (i = 0; i < 63; i++)
|
||||
lc_saturation_curv[i] = p->ve_lc_saturation[i];
|
||||
for (i = 0; i < 12; i++) {
|
||||
lc_yminval_lmt_curv[i] =
|
||||
p->ve_lc_yminval_lmt[i];
|
||||
lc_ypkbv_ymaxval_lmt_curv[i] =
|
||||
p->ve_lc_ypkbv_ymaxval_lmt[i];
|
||||
}
|
||||
for (i = 0; i < 4; i++)
|
||||
lc_ypkbv_ratio_curv[i] = p->ve_lc_ypkbv_ratio[i];
|
||||
|
||||
/*load lc_staturation curve*/
|
||||
lc_wr_reg(lc_saturation_curv, 0x1);
|
||||
/*load lc_yminval_lmt*/
|
||||
lc_wr_reg(lc_yminval_lmt_curv, 0x2);
|
||||
/*load lc_ypkbv_ymaxval_lmt*/
|
||||
lc_wr_reg(lc_ypkbv_ymaxval_lmt_curv, 0x4);
|
||||
/*load lc_ypkbV_ratio*/
|
||||
lc_wr_reg(lc_ypkbv_ratio_curv, 0x8);
|
||||
}
|
||||
|
||||
static ssize_t amvecm_lc_show(struct class *cla,
|
||||
struct class_attribute *attr, char *buf)
|
||||
{
|
||||
|
||||
@@ -76,6 +76,9 @@ unsigned int lc_hist_prcnt;
|
||||
unsigned int lc_curve_prcnt;
|
||||
bool lc_curve_fresh = true;
|
||||
|
||||
struct ve_lc_curve_parm_s lc_curve_parm_load;
|
||||
struct lc_alg_param_s lc_alg_parm;
|
||||
|
||||
/*lc saturation gain, low parameters*/
|
||||
static unsigned int lc_satur_gain[63] = {
|
||||
51, 104, 158, 213, 269, 325, 382, 440, 498,
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
#include <linux/amlogic/media/vfm/vframe.h>
|
||||
|
||||
/*V1.0: Local_contrast Basic function, iir algorithm, debug interface for tool*/
|
||||
#define LC_VER "Ref.2019/02/27-V1.0"
|
||||
/*V1.1: add ioctrl load interface supprt*/
|
||||
#define LC_VER "Ref.2019/03/07-V1.1"
|
||||
|
||||
enum lc_mtx_sel_e {
|
||||
INP_MTX = 0x1,
|
||||
@@ -48,6 +49,15 @@ enum lc_reg_lut_e {
|
||||
MAX_REG_LUT
|
||||
};
|
||||
|
||||
struct lc_alg_param_s {
|
||||
unsigned int dbg_parm0;
|
||||
unsigned int dbg_parm1;
|
||||
unsigned int dbg_parm2;
|
||||
unsigned int dbg_parm3;
|
||||
unsigned int dbg_parm4;
|
||||
};
|
||||
|
||||
|
||||
extern int amlc_debug;
|
||||
extern int lc_en;
|
||||
extern int lc_demo_mode;
|
||||
@@ -77,7 +87,8 @@ extern bool lc_curve_fresh;
|
||||
extern int *lc_szcurve;/*12*8*6+4*/
|
||||
extern int *curve_nodes_cur;
|
||||
extern int *lc_hist;/*12*8*17*/
|
||||
|
||||
extern struct ve_lc_curve_parm_s lc_curve_parm_load;
|
||||
extern struct lc_alg_param_s lc_alg_parm;
|
||||
|
||||
extern void lc_init(void);
|
||||
extern void lc_process(struct vframe_s *vf,
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#define FLAG_VADJ1_COLOR (1 << 30)
|
||||
#define FLAG_VE_DNLP (1 << 29)
|
||||
#define FLAG_VE_NEW_DNLP (1 << 28)
|
||||
#define FLAG_RSV27 (1 << 27)
|
||||
#define FLAG_VE_LC_CURV (1 << 27)
|
||||
#define FLAG_RSV26 (1 << 26)
|
||||
#define FLAG_3D_BLACK_DIS (1 << 25)
|
||||
#define FLAG_3D_BLACK_EN (1 << 24)
|
||||
@@ -214,6 +214,10 @@ enum pc_mode_e {
|
||||
#define AMVECM_IOC_G_PIC_MODE _IOR(_VE_CM, 0x59, struct am_vdj_mode_s)
|
||||
#define AMVECM_IOC_S_PIC_MODE _IOW(_VE_CM, 0x60, struct am_vdj_mode_s)
|
||||
|
||||
/*Local contrast command list*/
|
||||
#define AMVECM_IOC_S_LC_CURVE _IOW(_VE_CM, 0x62, struct ve_lc_curve_parm_s)
|
||||
|
||||
|
||||
struct am_vdj_mode_s {
|
||||
int flag;
|
||||
int brightness;
|
||||
@@ -445,11 +449,11 @@ struct hdr_metadata_info_s {
|
||||
extern void vpp_vd_adj1_saturation_hue(signed int sat_val,
|
||||
signed int hue_val, struct vframe_s *vf);
|
||||
extern void amvecm_sharpness_enable(int sel);
|
||||
|
||||
extern int metadata_read_u32(uint32_t *value);
|
||||
extern int metadata_wait(struct vframe_s *vf);
|
||||
extern int metadata_sync(uint32_t frame_id, uint64_t pts);
|
||||
extern void amvecm_wakeup_queue(void);
|
||||
extern void lc_load_curve(struct ve_lc_curve_parm_s *p);
|
||||
|
||||
#ifndef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA
|
||||
#define VSYNC_WR_MPEG_REG(adr, val) WRITE_VPP_REG(adr, val)
|
||||
|
||||
@@ -159,6 +159,24 @@ struct ve_dnlp_s {
|
||||
unsigned char gamma[64];
|
||||
};
|
||||
#endif
|
||||
|
||||
struct ve_lc_curve_parm_s {
|
||||
unsigned int ve_lc_saturation[63];
|
||||
unsigned int ve_lc_yminval_lmt[12];
|
||||
unsigned int ve_lc_ypkbv_ymaxval_lmt[12];
|
||||
unsigned int ve_lc_ypkbv_ratio[4];
|
||||
unsigned int param[100];
|
||||
};
|
||||
|
||||
enum lc_alg_param_e {
|
||||
lc_dbg_parm0 = 0,
|
||||
lc_dbg_parm1,
|
||||
lc_dbg_parm2,
|
||||
lc_dbg_parm3,
|
||||
lc_dbg_parm4,
|
||||
lc_dbg_parm_max,
|
||||
};
|
||||
|
||||
struct ve_hsvs_s {
|
||||
unsigned char en;
|
||||
unsigned char peak_gain_h1;
|
||||
|
||||
Reference in New Issue
Block a user