amvecm: add color primary get ioctrl [1/1]
authorMingLiang Dong <mingliang.dong@amlogic.com>
Tue, 11 Dec 2018 09:16:24 +0000 (04:16 -0500)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 13 Dec 2018 16:22:40 +0000 (08:22 -0800)
PD#TV-1463

Problem:
new interface

Solution:
add color primary get ioctrl

Verify:
verify on TL1

Change-Id: I0d4880b6a224be153e80b3eeb11bb5a0352f9ed5
Signed-off-by: MingLiang Dong <mingliang.dong@amlogic.com>
drivers/amlogic/media/enhancement/amvecm/amcsc.c
drivers/amlogic/media/enhancement/amvecm/amcsc.h
drivers/amlogic/media/enhancement/amvecm/amvecm.c
include/linux/amlogic/media/amvecm/amvecm.h

index 08953cc..1b690ff 100644 (file)
@@ -3736,6 +3736,21 @@ void get_hdr_source_type(void)
                hdr_source_type = SDR_SOURCE;
 }
 
+enum color_primary_e get_color_primary(void)
+{
+       enum color_primary_e color_pri;
+
+       if (signal_color_primaries == 1)
+               color_pri = VPP_COLOR_PRI_BT709;
+       else if (signal_color_primaries == 3)
+               color_pri = VPP_COLOR_PRI_BT601;
+       else if (signal_color_primaries == 9)
+               color_pri = VPP_COLOR_PRI_BT2020;
+       else
+               color_pri = VPP_COLOR_PRI_NULL;
+       return color_pri;
+}
+
 static void cal_out_curve(uint panel_luma)
 {
        int index;
index 1657bb1..b0ccbc0 100644 (file)
@@ -106,7 +106,7 @@ extern int amvecm_hdr_dbg(u32 sel);
 
 extern u32 get_video_enabled(void);
 extern void get_hdr_source_type(void);
-
+extern enum color_primary_e get_color_primary(void);
 /*hdr*/
 /*#define DBG_BUF_SIZE (1024)*/
 
index a0125ab..496579e 100644 (file)
@@ -1305,6 +1305,7 @@ static long amvecm_ioctl(struct file *file,
        struct ve_pq_load_s vpp_pq_load;
        struct ve_pq_table_s *vpp_pq_load_table = NULL;
        int i = 0;
+       enum color_primary_e color_pri;
 
        if (debug_amvecm & 2)
                pr_info("[amvecm..] %s: cmd_nr = 0x%x\n",
@@ -1555,6 +1556,13 @@ static long amvecm_ioctl(struct file *file,
                                &cur_csc_type, sizeof(enum vpp_matrix_csc_e)))
                        ret = -EFAULT;
                break;
+       case AMVECM_IOC_G_COLOR_PRI:
+               argp = (void __user *)arg;
+               color_pri = get_color_primary();
+               if (copy_to_user(argp,
+                               &color_pri, sizeof(enum color_primary_e)))
+                       ret = -EFAULT;
+               break;
        case AMVECM_IOC_S_CSCTYPE:
                if (copy_from_user(&cur_csc_type,
                                (void __user *)arg,
index 59e88fe..ec6cd64 100644 (file)
@@ -146,12 +146,12 @@ enum pq_table_name_e {
 #define AMVECM_IOC_VE_NEW_DNLP  _IOW(_VE_CM, 0x25, struct ve_dnlp_curve_param_s)
 #define AMVECM_IOC_G_HIST_BIN   _IOW(_VE_CM, 0x26, struct vpp_hist_param_s)
 #define AMVECM_IOC_G_HDR_METADATA _IOW(_VE_CM, 0x27, struct hdr_metadata_info_s)
-
+/*vpp get color primary*/
+#define AMVECM_IOC_G_COLOR_PRI _IOR(_VE_CM, 0x28, enum color_primary_e)
 
 /* VPP.CM IOCTL command list */
 #define AMVECM_IOC_LOAD_REG  _IOW(_VE_CM, 0x30, struct am_regs_s)
 
-
 /* VPP.GAMMA IOCTL command list */
 #define AMVECM_IOC_GAMMA_TABLE_EN  _IO(_VE_CM, 0x40)
 #define AMVECM_IOC_GAMMA_TABLE_DIS _IO(_VE_CM, 0x41)
@@ -224,6 +224,14 @@ struct am_vdj_mode_s {
        int contrast2;
 };
 
+enum color_primary_e {
+       VPP_COLOR_PRI_NULL = 0,
+       VPP_COLOR_PRI_BT601,
+       VPP_COLOR_PRI_BT709,
+       VPP_COLOR_PRI_BT2020,
+       VPP_COLOR_PRI_MAX,
+};
+
 enum vpp_matrix_csc_e {
        VPP_MATRIX_NULL = 0,
        VPP_MATRIX_RGB_YUV601 = 0x1,
@@ -354,7 +362,6 @@ struct am_pq_parm_s {
 /* READ_CBUS_REG_BITS(x,start,length) */
 /* #endif */
 
-
 static inline void WRITE_VPP_REG(uint32_t reg,
                const uint32_t value)
 {