/**
 * @file ProjectConfig.h
 * @brief Header file of Project.
 *
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 *
 *
 @ endverbatim
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-08-26
 */

#ifndef __DEVICE_HIVIEW_HT7315_PRODUCT_QHD_DDR2_PROJECT_H__
#define __DEVICE_HIVIEW_HT7315_PRODUCT_QHD_DDR2_PROJECT_H__

#define HV_CONFIG_ON                            1
#define HV_CONFIG_OFF                           0

/*************************************************
   Platform definiton
*************************************************/
#define HV_PROJECT_CONFIG_MANUFACT_OUI                       0x24DD1B
#define HV_PROJECT_CONFIG_DEV_STRING0                        0x00
#define HV_PROJECT_CONFIG_DEV_STRING1                        0x00000000
#define HV_PROJECT_CONFIG_DEV_STRING2                        0x00
#define HV_PROJECT_CONFIG_HW_MAJOR_REV                       0x00
#define HV_PROJECT_CONFIG_HW_MINOR_REV                       0x00
#define HV_PROJECT_CONFIG_FW_MAJOR_REV                       0x00
#define HV_PROJECT_CONFIG_FW_MINOR_REV                       0x00

#define HV_PROJECT_CONFIG_GUID0                              0x00000000
#define HV_PROJECT_CONFIG_GUID1                              0x00000000
#define HV_PROJECT_CONFIG_GUID2                              0x00000000
#define HV_PROJECT_CONFIG_GUID3                              0x00000000

/*特殊分辨率panel 自定义分辨率，给OSD/OD等宏使用*/
#ifdef  CONFIG_USER_PANEL_RESOLUTION_TYPE_CUSTOMIZE
#define HV_PROJECT_CONFIG_PANEL_H_ACTIVE_CUSTOMIZE          3440
#define HV_PROJECT_CONFIG_PANEL_V_ACTIVE_CUSTOMIZE          1440
#endif

/*************************************************
   Product function definiton
*************************************************/

#define HV_PROJECT_CONFIG_DARK_STABILIZER                    HV_CONFIG_ON
#define HV_PROJECT_CONFIG_MPRT                               HV_CONFIG_ON
#define HV_PROJECT_CONFIG_FREESYNC                           HV_CONFIG_ON
#define HV_PROJECT_CONFIG_ADAPTIVESYNC                       HV_CONFIG_ON
#define HV_PROJECT_CONFIG_GSYNC                              HV_CONFIG_ON
#define HV_PROJECT_CONFIG_LDR                                HV_CONFIG_ON
#define HV_PROJECT_CONFIG_DCR                                HV_CONFIG_ON
#define HV_PROJECT_CONFIG_EYESHIELD                          HV_CONFIG_ON
#define HV_PROJECT_CONFIG_CROSSHAIR                          HV_CONFIG_ON
#define HV_PROJECT_CONFIG_REFRESH_RATE                       HV_CONFIG_ON
#define HV_PROJECT_CONFIG_HDR                                HV_CONFIG_ON
#define HV_PROJECT_CONFIG_CUSTOM_KEY                         HV_CONFIG_ON
#define HV_PROJECT_CONFIG_LIGHT_EFFECT                       HV_CONFIG_ON
#define HV_PROJECT_CONFIG_VARIABLEBACKLIGHT                  HV_CONFIG_ON
#define HV_PROJECT_CONFIG_CM                                 HV_CONFIG_ON
#define HV_PROJECT_CONFIG_AUDIO_SETTING                      HV_CONFIG_ON
#define HV_PROJECT_CONFIG_MAIN_MONTAGE                       HV_CONFIG_OFF
#ifdef CONFIG_USER_DOUBLE_CHANNEL_ON
#define HV_PROJECT_CONFIG_MAGNIFY                            HV_CONFIG_ON
#define HV_PROJECT_CONFIG_PXP                                HV_CONFIG_OFF
#else
#define HV_PROJECT_CONFIG_MAGNIFY                            HV_CONFIG_OFF
#define HV_PROJECT_CONFIG_PXP                                HV_CONFIG_OFF
#endif

/*************************************************
   INPUTPORT Option
*************************************************/
#define HV_PROJECT_CONFIG_HDCP_KEY_ONROM                     HV_CONFIG_OFF        /* 1: HDCP Key saved in ROM */
#define HV_PROJECT_CONFIG_HDCP_KEY_CLEAR_TEXT                HV_CONFIG_OFF       /* 0: cipher Text(����); 1: clear Text(����) */
#define HV_PROJECT_CONFIG_EDID_EXTER_EEPROM                  HV_CONFIG_OFF       /* 1: USE Extern EEPROM to save EDID */
#define HV_PROJECT_CONFIG_EDID_UP_FCTWEEK                    HV_CONFIG_ON        /* 1: Update the Factory Week */
#define HV_PROJECT_CONFIG_EDID_UP_FCTYEAR                    HV_CONFIG_ON        /* 1: EDID Update the Factory Year */
#define HV_PROJECT_CONFIG_EDID_UP_SN_VENDOR                  HV_CONFIG_OFF        /* 1: EDID Update the Factory SN on Vendor Info */
#define HV_PROJECT_CONFIG_EDID_UP_DESC_SN                    HV_CONFIG_OFF        /* 1: EDID Update the Factory SN on Desc Info */
#define HV_PROJECT_CONFIG_ESEGMENT                           HV_CONFIG_ON        /* 1: Support E-Segment */
#define HV_PROJECT_CONFIG_ESEGMENT_PM51                      HV_CONFIG_OFF       /* 1: Support E-Segment on 51 */
#define HV_PROJECT_CONFIG_FRL                                HV_CONFIG_ON        /* 1: Support HDMI FRL */
#define HV_PROJECT_CONFIG_CTS                                HV_CONFIG_OFF        /* 1: CTS specific handle */
#define HV_PROJECT_CONFIG_DEFAULT_EDID                       HV_CONFIG_ON         /* 1: Default EDID exist*/
#define HV_PROJECT_CONFIG_DP_NOSTAND_CABLE_ENABLE            HV_CONFIG_ON        /* enable when cable plug-in/plug-out event not available */

/*************************************************
   DPU Option
*************************************************/
/*是否允许SUB通道和辅助通道公用相同的port*/
#define HV_PROJECT_CONFIG_CHANNEL_USE_SAME_PORT             1
/*是否开启完整LocalDimming*/
#define HV_PROJECT_CONFIG_FULL_LOCALDIMMING                 HV_CONFIG_OFF
/*是否开启LocalDimming 2D PixelGain*/
#define HV_PROJECT_CONFIG_LDC_2D_PIXELGAIN                  HV_CONFIG_OFF
/* 开启ldc需要配置kspi通道 */
#if (HV_PROJECT_CONFIG_FULL_LOCALDIMMING == HV_CONFIG_ON)
#define HV_PROJECT_CONFIG_KSPI_CHANNEL_NUM                  0x1
#endif
/*是否使用bin文件进行PQ初始化*/
#define HV_PROJECT_CONFIG_PQ_INITBYBIN                      HV_CONFIG_ON
/*PQ模块调试工具是否读写数据库，默认关闭，调试PQ打开*/
#define HV_PROJECT_CONFIG_PQ_DATABASEWREN                   HV_CONFIG_ON
/* PQ模块关闭HDR是否切换EDID*/
#define HV_PROJECT_CONFIG_PQ_HDR_CHANGEEDID                 HV_CONFIG_OFF

/*搜索端口的间隔时间，单位ms*/
#define HV_PROJECT_CONFIG_PERIOD_SEARCH_CHECK_SROUCE_TIMER  100
#define HV_PROJECT_CONFIG_CURRENT_PORT_SEARCHE_TIMES        90                   /*当前通道搜索次数，一次HV_PROJECT_CONFIG_PERIOD_SEARCH_CHECK_SROUCE_TIMER毫秒*/
#define HV_PROJECT_CONFIG_EACH_PORT_DISCONNECT_SEARCHE_TIMES  20                 /*通道未插线搜索次数，一次HV_PROJECT_CONFIG_PERIOD_SEARCH_CHECK_SROUCE_TIMER毫秒*/
#if (HV_PROJECT_CONFIG_CTS == HV_CONFIG_OFF)
#define HV_PROJECT_CONFIG_NO_SIGNAL_CHECK_TIMES             10                   /*无信号时进入待机前的检测信号的次数，每1秒检测一次*/ 
#define HV_PROJECT_CONFIG_EACH_PORT_SERARCH_MAX_TIMES       30                   /*提示无信号前，每个插线通道搜索的次数,每100ms搜索一次*/ 
#else
#define HV_PROJECT_CONFIG_NO_SIGNAL_CHECK_TIMES             200
#define HV_PROJECT_CONFIG_EACH_PORT_SERARCH_MAX_TIMES       100
#endif
/*工厂模式下，加速进入老化模式*/
#define HV_PROJECT_CONFIG_BURN_IN_EACH_PORT_SEARCH_TIMES    10
#define HV_PROJECT_CONFIG_MAX_SEARCH_TIMERS_BURN_IN         (HV_PROJECT_CONFIG_BURN_IN_EACH_PORT_SEARCH_TIMES * (HV_BOARD_CONFIG_MAX_HDMI_PORT_NUM + HV_BOARD_CONFIG_MAX_DP_PORT_NUM))


/*unit millisecond*/
/*total nosignal keep time = NO_SIGNAL_DURATION_TIMES * NO_SIGNAL_CHECK_TIMER_LENGTH */
#define HV_PROJECT_CONFIG_NO_SIGNAL_CHECK_TIMER_LENGTH      1000
#define HV_PROJECT_CONFIG_DPU_OVER_SCAN_SIDE_SIZE           0UL         /*side image (250 is 2.5% of each side size) over screen, 0: off*/
#define HV_PROJECT_CONFIG_DPU_BRIGHT_FRAME                  HV_CONFIG_OFF
#define HV_PROJECT_CONFIG_AUTO_POWER_OFF                    HV_CONFIG_OFF
#define HV_PROJECT_CONFIG_MAGNIFY_SAMPLING_FLOW_POS         HV_CONFIG_ON   /*放大镜取样位置是否跟随放大镜显示位置（放大放大镜正下方画面）*/
#define HV_PROJECT_CONFIG_PIP_POS_PRECISE_ADJ               HV_CONFIG_OFF   /*PIP sub 位置是否开启精确调节，开启后h v位置可以步进调节*/
#define HV_PROJECT_CONFIG_CHANNEL_SEAMLESS_SWITCH           HV_CONFIG_OFF  /*双通道冻结一帧切换*/
#define HV_PROJECT_CONFIG_OVER_PANEL_CLOCK_EN               HV_CONFIG_OFF
#define HV_PROJECT_CONFIG_OVER_PANEL_CLOCK_UP               2000    /*over panel pixel clock KHz*/
#define HV_PROJECT_CONFIG_OVER_PANEL_CLOCK_DOWN             2000    /*reduce panel pixel clock KHz*/

/*************************************************
   PM51 Option
*************************************************/

#define HV_PROJECT_CONFIG_PM51_UART_PRINT_ENABLE            HV_CONFIG_ON
#define HV_PROJECT_CONFIG_PM51_TYPEC0_ENABLE                HV_CONFIG_ON

/*************************************************
   DPMS Option
*************************************************/

#define HV_PROJECT_CONFIG_DPMS_HDMI0_CABLE_ENABLE           HV_CONFIG_ON
#define HV_PROJECT_CONFIG_DPMS_HDMI1_CABLE_ENABLE           HV_CONFIG_ON
#define HV_PROJECT_CONFIG_DPMS_DP0_CABLE_ENABLE             HV_CONFIG_OFF
#define HV_PROJECT_CONFIG_DPMS_DP1_CABLE_ENABLE             HV_CONFIG_ON
#define HV_PROJECT_CONFIG_DPMS_DP0_AUX_ENABLE               HV_CONFIG_OFF
#define HV_PROJECT_CONFIG_DPMS_DP1_AUX_ENABLE               HV_CONFIG_ON
#define HV_PROJECT_CONFIG_DPMS_DP0_GPIO_ENABLE              HV_CONFIG_OFF
#define HV_PROJECT_CONFIG_DPMS_DP1_GPIO_ENABLE              HV_CONFIG_ON
#define HV_PROJECT_CONFIG_HDMI0_DDC_WAKEUP_ENABLE           HV_CONFIG_OFF
#define HV_PROJECT_CONFIG_HDMI1_DDC_WAKEUP_ENABLE           HV_CONFIG_OFF
#define HV_PROJECT_CONFIG_CABLE_WAKEUP_DOUBLE_ENABLE        HV_CONFIG_OFF
/*************************************************
   Audio Option
*************************************************/

#define HV_PROJECT_CONFIG_VOLUME_CONSISTENT                  1
#define HV_PROJECT_CONFIG_DIGITAL_MAX_VOLUME                 256

/*************************************************
   Panel Option
*************************************************/
#define HV_PROJECT_CONFIG_EDP_TX_TRAINING_TYPE               HV_EDP_TX_FULL_LINK_TRAINING
#define HV_PROJECT_CONFIG_EDP_TX_ASSR_EN                     HV_CONFIG_OFF
#define HV_PROJECT_CONFIG_EDP_TX_AUX0_PORT                   EDP_AUX_PROT_INDEX0
#define HV_PROJECT_CONFIG_EDP_TX_AUX1_PORT                   EDP_AUX_PROT_INDEX1
#define HV_PROJECT_CONFIG_EDP_TX_HPD0_PORT                   EDP_HPD_PROT_INDEX0
#define HV_PROJECT_CONFIG_EDP_TX_HPD1_PORT                   EDP_HPD_PROT_INDEX1
#define HV_PROJECT_CONFIG_EDP_TX_HPD_IRQ_EN                  HV_CONFIG_OFF

/*************************************************
   MPRT(PWM) Option
*************************************************/
/* 通过原理图查看pinshare，选择合适的port输出波形 */
#define HV_PROJECT_CONFIG_MPRT_HIGHT_PORT                    1       //GPIO11/PWM1/PIN92控制
#define HV_PROJECT_CONFIG_MPRT_HIGHT_POL                     0
#define HV_PROJECT_CONFIG_BACKLIGHT_ENABLE                   1       //背光开
#define HV_PROJECT_CONFIG_BACKLIGHT_DISABLE                  0       //背光关
/* 输出固定高频PWM所需的固定参数，根据要设置的频率查表得到此值 */
#define HV_PROJECT_CONFIG_MPRT_HIGHT_FREQ_PWM_TOTAL          4304
#define HV_PROJECT_CONFIG_MPRT_HIGHT_FREQ_PWM_MULT           0
#define HV_PROJECT_CONFIG_MPRT_HIGHT_FREQ_PWM_DUTY           90

/* 通过原理图查看pinshare，选择合适的port输出波形 */
#define HV_PROJECT_CONFIG_MPRT_PORT                          2       //GPIO12/PWM2/PIN93控制
#define HV_PROJECT_CONFIG_MPRT_POL                           0
/* 输出固定MPRT的PWM所需的固定参数 */
#define HV_PROJECT_CONFIG_MPRT_MODE                          0
#define HV_PROJECT_CONFIG_MPRT_STA_VALUE                     690     //普通MPRT模式下的拉高起始行，根据实际效果调节
#define HV_PROJECT_CONFIG_MPRT_VALUE                         1440
#define HV_PROJECT_CONFIG_MPRT_VS_CLEAR                      1       // VRR下MPRT开时，VS_CLEAR也要开，保证在帧结尾波形被拉低
#define HV_PROJECT_CONFIG_MPRT_VRR_STA_VALUE                 19660   //65535的占比，起始行占htotal的比例，会根据上一帧自动计算，这里只设比例即可
#define HV_PROJECT_CONFIG_MPRT_VRR_VALUE                     1440    // VRR下MPRT开时，VALUE按h total算，要保障拉行数足够大在帧结尾保持高电平

/* 设置供LDC使用的vsync接口,需要PWM的一个通道 */
#define HV_PROJECT_CONFIG_MPRT_LDCVSYNC_PORT                 4

/*************************************************
   Factory Option
*************************************************/
/* Factory Min*/
#define HV_PROJECT_CONFIG_FACTORY_PANEL_TIME_COUNT_PERIOD    30

/* Device Info Define*/
#define HV_PROJECT_CONFIG_FACTORY_MONITOR_MODE               "HIVIEW 27G5F_QHD"
#define HV_PROJECT_CONFIG_FACTORY_SCALER_MODE                "HT7315"
#define HV_PROJECT_CONFIG_FACTORY_FW_VERSION                 "1.0.0"
#define HV_PROJECT_CONFIG_FACTORY_FW_CHANGE_DATE             "20241209"
#define HV_PROJECT_CONFIG_FACTORY_PANEL_TYPE                 "SN270ES01_1 V1.4"
#define HV_PROJECT_CONFIG_FACTORY_PANEL_SIZE                 "27.0"

#define HV_PROJECT_CONFIG_SW_MAJOR_VER                       0x1
#define HV_PROJECT_CONFIG_SW_MINOR_VER                       0x3

/* 8Bytes Max */
#define HV_PROJECT_CONFIG_HDMI_SCDC_DEVICE_STR               "HiView"

/*Color Filter Define */
#define HV_PROJECT_CONFIG_COLOR_FILTER                      HV_CONFIG_ON
/*PQ Ambilight Define */
#define HV_PROJECT_CONFIG_AMBILIGHT                         HV_CONFIG_ON
/*PQ Ambient Light Define */
#define HV_PROJECT_CONFIG_AMBIENT_LIGHT                     HV_CONFIG_OFF

/*OTA Partition Define */
#define HV_PROJECT_CONFIG_DUAL_PARTITION                    HV_CONFIG_ON

#endif
