123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- #ifndef _DRV_PQ_INTERNAL_H
- #define _DRV_PQ_INTERNAL_H
- #include "drv_types.h"
- #include <linux/ioctl.h>
- #include <drv_pq_external.h>
- #include <drv_slr.h>
- #define REG_ADR1_PWM0_BACKLIGHT 0xbe0f0100
- #define REG_ADR2_PWM0_BACKLIGHT 0xbe0f0104
- /*for add extra source*/
- #define SEPERATE_YPBPR1_YPBPR2 1
- #define SW_DYN_CONTRAST_330C 1
- #define VIP_358C0 0x5812
- #define PQ_REG_END_OF_SUB_TAB 0x80000000
- #define PQ_REG_VALUE_DEFINE 0x18000000
- //sis atsc have enhenced setting in menu
- #if defined(CONFIG_ATSC_SYSTEM)
- #define MENU_SET_ENHANCED_COLOR
- #endif
- #define NEW_COEFFICIENT
- #define DISABLE_PQ_DEBUG 1 //for 330 code reduced option
- #define STATIC_FRAME_THRESHOLD 0x100
- #ifdef __KERNEL__
- #ifndef CONFIG_SUPPORT_DEBUG_MESSAGE
- #define PQDebugPrint(fmt, args...) //DBG_MSG1(DBGCFG_VIP,"[PQ_HW] "fmt"\n",## args)
- #define PQ_ADVANCE_HWPrint(fmt, args...) //DBG_MSG1(DBGCFG_VIP,"PQ] "fmt"\n",## args)
- #define PQ_KICDebugPrint( fmt, args...) //DBG_MSG1(DBGCFG_VIP,"PQ]"fmt,## args)
- #else
- #if DISABLE_PQ_DEBUG
- #define PQDebugPrint(fmt, args...) //DBG_MSG1(DBGCFG_VIP,"[PQ_HW] "fmt"\n",## args)
- #define PQ_ADVANCE_HWPrint(fmt, args...) //DBG_MSG1(DBGCFG_VIP,"PQ] "fmt"\n",## args)
- #define PQ_KICDebugPrint( fmt, args...) //DBG_MSG1(DBGCFG_VIP,"PQ]"fmt,## args)
- #else
- #define PQDebugPrint(fmt, args...) DBG_MSG1(DBGCFG_VIP,"PQ]"fmt"\n",## args)
- #define PQ_ADVANCE_HWPrint(fmt, args...) DBG_MSG1(DBGCFG_VIP,"PQ] "fmt"\n",## args)
- #define PQ_KICDebugPrint( fmt, args...) DBG_MSG1(DBGCFG_VIP,"PQ]"fmt,## args)
- #endif
- #endif
- #endif
- typedef enum
- {
- PQ_CT_BIAS_R,
- PQ_CT_BIAS_G,
- PQ_CT_BIAS_B,
- } PQ_COLOR_TEMP_BIAS;
- typedef enum
- {
- PQ_CT_GAIN_R,
- PQ_CT_GAIN_G,
- PQ_CT_GAIN_B,
- } PQ_COLOR_TEMP_GAIN;
- enum
- {
- STATIC_FRAME,
- MOTION_FRAME,
- };
- enum{
- PQ_DITHER_DISABLE,
- PQ_DITHER_METHOD_1,
- PQ_DITHER_METHOD_2,
- };
- enum{
- PQ_Panel_12_BITS,
- PQ_Panel_10_BITS,
- PQ_Panel_9_BITS,
- PQ_Panel_8_BITS,
- PQ_Panel_7_BITS,
- PQ_Panel_6_BITS,
- PQ_AUTO_DETECT_Panel_BITS,
- };
- enum{
- PQ_DITHER_ALGORITHM_2D,
- PQ_DITHER_ALGORITHM_3D,
- };
- enum{
- COLORLUT_HUE_GAIN,
- COLORLUT_SAT_GAIN,
- };
- #ifdef NEW_COEFFICIENT
- #if CONFIG_CHIPID == 0x330
- extern UINT32 V_SCALING_UP[99];
- extern UINT32 V_SCALING_100_115[99];
- extern UINT32 V_SCALING_115_135[99];
- extern UINT32 V_SCALING_135_155[99];
- extern UINT32 V_SCALING_155_175[99];
- extern UINT32 V_SCALING_175_195[99];
- extern UINT32 V_SCALING_195_250[99];
- extern UINT32 V_SCALING_250_300[99];
- extern UINT32 V_SCALING_300_down[99];
- extern UINT32 V_1080i_blurred[99];
- extern UINT32 V_SCALING_120_130[99];
- #else
- extern UINT32 V_SCALING_UP[99];
- extern UINT32 V_SCALING_100_110[99];
- extern UINT32 V_SCALING_110_120[99];
- extern UINT32 V_SCALING_120_130[99];
- extern UINT32 V_SCALING_130_140[99];
- extern UINT32 V_SCALING_140_150[99];
- extern UINT32 V_SCALING_150_160[99];
- extern UINT32 V_SCALING_160_170[99];
- extern UINT32 V_SCALING_170_180[99];
- extern UINT32 V_SCALING_180_190[99];
- extern UINT32 V_SCALING_190_200[99];
- extern UINT32 V_SCALING_200_250[99];
- extern UINT32 V_SCALING_250_300[99];
- extern UINT32 V_SCALING_300_350[99];
- extern UINT32 V_SCALING_350_400[99];
- extern UINT32 SCALING_1[99];
- #endif
- #endif
- void PQ_Sharpness(BOOL bReset,UINT8 ucValue);
- void PQ_ColorProcesser(UINT8 ucEnable);
- void PQ_SourceSetting(UINT8 ucSource, UINT8 ucSubSource);
- void PQ_SourceSelect(UINT8 ucUserInputSource);
- BOOL PQ_SetupLUTTable(UINT8 ucEnable);
- void PQ_VDISize(void);
- void PQ_InitDynamicBackLight(void);
- void PQ_DPYSetup(UINT8 ucUserSource,UINT8 ucSubSource);
- void PQ_HWDestroyWorkqueue(void);
- void PQ_InitialTable(void);
- void PQ_ColorProcesserDisable(void);
- void PQ_Contrast(UINT8 bReset, int iValue);
- void PQ_Hue(UINT8 ucIndex);
- void PQ_ColorTempGain(PQ_COLOR_TEMP_GAIN ucType, int iValue);
- void PQ_ColorTempGainALL(INT16 bRgain, INT16 bGgain,INT16 bBgain,UINT8 bGammaSwitch,UINT8 bGammaIndex);
- void PQ_EnableDynamicBackLight(UINT8 ucLevel, UINT32 dwLightUser);
- int PQ_GetMenuHueValue(void);
- INT32 _MappingDrvValToOSD(UINT8 ucFunID, INT32 iDrvVal);
- INT32 _MappingOSDValToDrv(UINT8 ucFunID, INT32 iOsdVal);
- INT32 PQ_GetMenuValue(UINT8 ucFunID);
- void PQ_SetMenuValue(UINT8 ucFunID, int iValue);
- void PQ_SetMenuValueCT(UINT8 ucFunID, INT32 iValue1,INT32 iValue2,INT32 iValue3 );
- void PQ_DynamicGammaSetting_ISR(void);
- UINT8 PQ_GetGammaEnableSt(void);
- void PQ_SetLocationMode(UINT8 ucMode);
- void PQ_GammaCorrect(UINT8);
- void PQ_SetColorMatrix(UINT8 ucEnable);
- int PQ_GetCurrContrastValue(void);
- void PQ_EnNRWorkQue_ISR(void);
- void PQ_AdjustNRCounter_ISR(int AdjustNRCounter);
- UINT32 PQ_ChromaBinPercentage(UINT8 ucBin);
- /**
- * @brief detect the input pattern if color bar or not
- *
- * This function use the statistic distribution of chroma data in the capture window to judge if current pattern is color bar or not.
- * The method is take chroma distribution as 18 part, and the color adjoining to specific color must less than 1%
- * (the remainder of (chroma[x] * 100 / capture window) <= 0)
- *
- * @param n/a
- * @return 1 = color bar pattern ; 0 = not color bar apttern
- * note : PQ_IsColorBar() since 6710, PQ_SWDTColorBar for previous project
- */
- UINT8 PQ_IsColorBar(void);
- BOOL PQ_SWDTColorBar(void);
- /**
- * @brief For detect specific pattern : FLUKE 54200, PAT#DIGITAL SCAN(DIG_ADC2)
- *
- * This function detec tthe Chroma bin distribution for check specific pattern
- *
- * @param n/a
- * @return 1 : is DIGITAL SCAN(DIG_ADC2), 0 : not DIGITAL SCAN(DIG_ADC2)
- */
- UINT8 PQ_IsDigitalScanADC2(void);
- void PQ_EnColorBarDetectWorkQue_ISR(void);
- void PQ_ColorBarDetect(void);
- void PQ_ColorTempBias(PQ_COLOR_TEMP_BIAS ucType, int iValue);
- void PQ_SetupColorSpaceConversionTable(void);
- int PQ_GetMenuColorBias(UINT8 index);
- void PQ_DemoModeWidth(void);
- void PQ_PeakingFilterSetup(void);
- void PQ_FilterSetup(UINT8 ucSource, UINT8 ucSubSource);
- void PQ_CustomerUserCurve_HW_AutoThreshold(BOOL bReset);
- void PQ_VSyncUserCurveWrite(BOOL bReset);
- void PQ_CustomerUserCurve(BOOL bReset);
- void PQ_PrintSWDynamicContrastSetting(void);
- UINT32 PQ_LoadGammaTable(UINT32 *pulAddr);
- void PQ_GmeSetup(void);
- void PQ_GmeSetupWritePath(void);
- void PQ_GmeSetupReadPath(void);
- void PQ_ChangeBackLight(UINT32 dwLightTarget, int nSpeed);
- void PQ_EventSetFunction(UINT8 ucFunID, int iValue, int iParm1, int iParm2);
- void PQ_SetColorStyleSaturation(UINT8 ucType);
- void PQ_SetUserCurve(UINT8 ucFunID, UINT8 ucPointIdx, INT16 iValue);
- void PQ_GetRegInfo(PQ_RegInfo* pRegInfo);
- INT8 PQ_ColorLUT_GetRegionGain(UINT8 Type, UINT8 Index);
- void PQ_ColorLUT_SetRegion(INT32 iRegionIdx, INT32 iSatGain, INT32 iYGain, INT32 iRotAngle, INT32 iRotGain, INT32 bEnable, BOOL bSet);
- void PQ_ColorLUT_SetRange(UINT8 RegionIdx, UINT8 bMake, UINT8 HueMin, UINT8 HueMax, UINT8 SatMin, UINT8 SatMax, UINT8 YMin, UINT8 YMax, UINT8 SmoothLevel, BOOL bSet);
- BOOL PQ_GetGammaChange(void);
- void PQ_WriteGammaTable(void);
- BOOL PQ_SetGammaTable(UINT32 *pulAddr);
- void PQ_BackLightDetect(BOOL bReset);
- void PQ_VideoDetectionSetup(UINT8,UINT8,BOOL);
- void PQ_SetColorProcessor(BOOL bEnable);
- BOOL PQ_GetMatrixbypassCtl(void);
- void PQ_ResetDynamicConteast(void);
- void PQ_EnSWDCWorkQue_ISR(void);
- void PQ_SW_DynamicContrast_SceneChangeDetect_ISR(void);
- UINT8 PQ_GetDynamicContrastEnable(void);
- void PQ_regionLumaAverage(UINT8 bRegionIndex,UINT8 bTotalHnum,UINT8 bTotalVnum);
- void PQ_GetRegionLumaAverage(UINT16* bRegionYaverage);
- void PQ_GetRegionvalue(RegionHVStartSize* bRegionvalue);
- void PQ_SetFadeInOut(void);
- void PQ_Decide_Coefficient_Table(UINT8 ucUserSource, DRV_SLR_CONFIG eSlrConfig, UINT32 PreHfactor, UINT32 PostHfactor, UINT32 Vfactor);
- void load_coeff_table(void);
- void sp_w_table(void);
- void mips1_word_coeff_group(UINT8 ucAddr, UINT32 dw64, UINT32 dw68, UINT32 dw6c);
- void mips1_word_coeff_group_nodelay(UINT8 ucAddr, UINT32 dw64, UINT32 dw68, UINT32 dw6c);
- void PQ_AffectInPanelVSync_ISR(void);
- void PQ_AffectInInputVSync_ISR(void);
- #ifdef CONFIG_ENABLE_MIR
- void PQ_MIR_Decide_Coefficient_Table(UINT32 Hfactor);
- #endif
- void PQ_GetHistBin(UINT32 *Y_Hist);
- void PQ_SetHistBinindex(UINT8 index);
- void PQ_YUV_Datat_Formal(UINT8 ucType);
- UINT8 PQ_GET_YUV_Datat_Formal(void);
- void PQ_SetDIM_REF_CTRL(UINT32 pwm_number, UINT32 status, UINT32 mmiovalue);
- void PQ_SETPWMFreq(UINT32 PWMFreq);
- UINT32 PQ_GETCurrPWMFreq(void);
- UINT32 PQ_GETCurrPWM(void);
- UINT32 PQ_Getbjpeg(void);
- void PQ_SetPWMOff(BOOL bStatus);
- UINT32 PQ_GETCurrDutyPWM(void);
- void PQ_SETCurrDutyPWM(UINT16 uwDuty);
- UINT32 PQ_GETCurrPolarity(void);
- UINT32 PQ_GETCurrElectricity(void);
- void PQ_Sharpness_Control_In_3D(UINT8 bStatus);
- UINT8 PQ_GetPanelPWMNum(void);
- UINT8 PQ_GetMotionStatus(void);
- void PQ_SetMotioncond(void);
- void PQ_SetFilmMode(UINT8 ucEnable);
- void PQ_set_PWM_Duty(UINT16 uwMaxDuty, UINT16 uwMinDuty);
- void PQ_get_PWM_Duty(UINT16* uwMaxDuty, UINT16* uwMinDuty);
- UINT8 PQ_GetColorBarStatus(void);
- void PQ_SetNotFullScreenPatchStatus(BOOL bStatus);
- UINT8 PQ_GetNotFullScreenPatchStatus(void);
- void PQ_SetColorCross(BOOL ucEnable);
- void PQ_ResetColorCrossMemData(BOOL bReset);
- BOOL PQ_GetColorProcessor(void);
- /**
- * @brief Set NR setting by source
- *
- * This function set NR setting by source, for the NR setting that did not dynamic changed by noise level.
- * This function triggered while change source
- *
- * @param n/a
- * @return n/a
- */
- void PQ_AdjustNrBySource(void);
- /**
- * @brief adjust PQ setting in different JPEG display mode
- *
- * This function adjust PQ setting while JPEG in the preview mode
- *
- * @param ucDisplayMode, 0 as full screen mode, 1 as preview mode
- * @return n/a
- */
- void PQ_SetJPEGDisplayModePatch(UINT8 ucDisplayMode);
- UINT32 PQ_PureColorPatternDetect(INT8 ucHBin); //eric
- /**
- * @brief get parameter of current frame is pure color or not
- *
- * This function return parameter for current frame is pure color or not
- *
- * @param n/a
- * @return TRUE is pure color pattern, FALSE is not
- */
- BOOL PQ_GetPureColorPattern(void);
- #ifdef CONFIG_EXTRA_PWM_CONTROL_FOR_FAN
- void tv_Disable_ExtraPwm(UINT8 ucPwmNum, UINT32 uiFrequency, UINT32 uiDuty);
- #endif
- UINT8 PQ_GetGammaIndex(void);
- #endif
|