drv_pq_internal.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. #ifndef _DRV_PQ_INTERNAL_H
  2. #define _DRV_PQ_INTERNAL_H
  3. #include "drv_types.h"
  4. #include <linux/ioctl.h>
  5. #include <drv_pq_external.h>
  6. #include <drv_slr.h>
  7. #define REG_ADR1_PWM0_BACKLIGHT 0xbe0f0100
  8. #define REG_ADR2_PWM0_BACKLIGHT 0xbe0f0104
  9. /*for add extra source*/
  10. #define SEPERATE_YPBPR1_YPBPR2 1
  11. #define SW_DYN_CONTRAST_330C 1
  12. #define VIP_358C0 0x5812
  13. #define PQ_REG_END_OF_SUB_TAB 0x80000000
  14. #define PQ_REG_VALUE_DEFINE 0x18000000
  15. //sis atsc have enhenced setting in menu
  16. #if defined(CONFIG_ATSC_SYSTEM)
  17. #define MENU_SET_ENHANCED_COLOR
  18. #endif
  19. #define NEW_COEFFICIENT
  20. #define DISABLE_PQ_DEBUG 1 //for 330 code reduced option
  21. #define STATIC_FRAME_THRESHOLD 0x100
  22. #ifdef __KERNEL__
  23. #ifndef CONFIG_SUPPORT_DEBUG_MESSAGE
  24. #define PQDebugPrint(fmt, args...) //DBG_MSG1(DBGCFG_VIP,"[PQ_HW] "fmt"\n",## args)
  25. #define PQ_ADVANCE_HWPrint(fmt, args...) //DBG_MSG1(DBGCFG_VIP,"PQ] "fmt"\n",## args)
  26. #define PQ_KICDebugPrint( fmt, args...) //DBG_MSG1(DBGCFG_VIP,"PQ]"fmt,## args)
  27. #else
  28. #if DISABLE_PQ_DEBUG
  29. #define PQDebugPrint(fmt, args...) //DBG_MSG1(DBGCFG_VIP,"[PQ_HW] "fmt"\n",## args)
  30. #define PQ_ADVANCE_HWPrint(fmt, args...) //DBG_MSG1(DBGCFG_VIP,"PQ] "fmt"\n",## args)
  31. #define PQ_KICDebugPrint( fmt, args...) //DBG_MSG1(DBGCFG_VIP,"PQ]"fmt,## args)
  32. #else
  33. #define PQDebugPrint(fmt, args...) DBG_MSG1(DBGCFG_VIP,"PQ]"fmt"\n",## args)
  34. #define PQ_ADVANCE_HWPrint(fmt, args...) DBG_MSG1(DBGCFG_VIP,"PQ] "fmt"\n",## args)
  35. #define PQ_KICDebugPrint( fmt, args...) DBG_MSG1(DBGCFG_VIP,"PQ]"fmt,## args)
  36. #endif
  37. #endif
  38. #endif
  39. typedef enum
  40. {
  41. PQ_CT_BIAS_R,
  42. PQ_CT_BIAS_G,
  43. PQ_CT_BIAS_B,
  44. } PQ_COLOR_TEMP_BIAS;
  45. typedef enum
  46. {
  47. PQ_CT_GAIN_R,
  48. PQ_CT_GAIN_G,
  49. PQ_CT_GAIN_B,
  50. } PQ_COLOR_TEMP_GAIN;
  51. enum
  52. {
  53. STATIC_FRAME,
  54. MOTION_FRAME,
  55. };
  56. enum{
  57. PQ_DITHER_DISABLE,
  58. PQ_DITHER_METHOD_1,
  59. PQ_DITHER_METHOD_2,
  60. };
  61. enum{
  62. PQ_Panel_12_BITS,
  63. PQ_Panel_10_BITS,
  64. PQ_Panel_9_BITS,
  65. PQ_Panel_8_BITS,
  66. PQ_Panel_7_BITS,
  67. PQ_Panel_6_BITS,
  68. PQ_AUTO_DETECT_Panel_BITS,
  69. };
  70. enum{
  71. PQ_DITHER_ALGORITHM_2D,
  72. PQ_DITHER_ALGORITHM_3D,
  73. };
  74. enum{
  75. COLORLUT_HUE_GAIN,
  76. COLORLUT_SAT_GAIN,
  77. };
  78. #ifdef NEW_COEFFICIENT
  79. #if CONFIG_CHIPID == 0x330
  80. extern UINT32 V_SCALING_UP[99];
  81. extern UINT32 V_SCALING_100_115[99];
  82. extern UINT32 V_SCALING_115_135[99];
  83. extern UINT32 V_SCALING_135_155[99];
  84. extern UINT32 V_SCALING_155_175[99];
  85. extern UINT32 V_SCALING_175_195[99];
  86. extern UINT32 V_SCALING_195_250[99];
  87. extern UINT32 V_SCALING_250_300[99];
  88. extern UINT32 V_SCALING_300_down[99];
  89. extern UINT32 V_1080i_blurred[99];
  90. extern UINT32 V_SCALING_120_130[99];
  91. #else
  92. extern UINT32 V_SCALING_UP[99];
  93. extern UINT32 V_SCALING_100_110[99];
  94. extern UINT32 V_SCALING_110_120[99];
  95. extern UINT32 V_SCALING_120_130[99];
  96. extern UINT32 V_SCALING_130_140[99];
  97. extern UINT32 V_SCALING_140_150[99];
  98. extern UINT32 V_SCALING_150_160[99];
  99. extern UINT32 V_SCALING_160_170[99];
  100. extern UINT32 V_SCALING_170_180[99];
  101. extern UINT32 V_SCALING_180_190[99];
  102. extern UINT32 V_SCALING_190_200[99];
  103. extern UINT32 V_SCALING_200_250[99];
  104. extern UINT32 V_SCALING_250_300[99];
  105. extern UINT32 V_SCALING_300_350[99];
  106. extern UINT32 V_SCALING_350_400[99];
  107. extern UINT32 SCALING_1[99];
  108. #endif
  109. #endif
  110. void PQ_Sharpness(BOOL bReset,UINT8 ucValue);
  111. void PQ_ColorProcesser(UINT8 ucEnable);
  112. void PQ_SourceSetting(UINT8 ucSource, UINT8 ucSubSource);
  113. void PQ_SourceSelect(UINT8 ucUserInputSource);
  114. BOOL PQ_SetupLUTTable(UINT8 ucEnable);
  115. void PQ_VDISize(void);
  116. void PQ_InitDynamicBackLight(void);
  117. void PQ_DPYSetup(UINT8 ucUserSource,UINT8 ucSubSource);
  118. void PQ_HWDestroyWorkqueue(void);
  119. void PQ_InitialTable(void);
  120. void PQ_ColorProcesserDisable(void);
  121. void PQ_Contrast(UINT8 bReset, int iValue);
  122. void PQ_Hue(UINT8 ucIndex);
  123. void PQ_ColorTempGain(PQ_COLOR_TEMP_GAIN ucType, int iValue);
  124. void PQ_ColorTempGainALL(INT16 bRgain, INT16 bGgain,INT16 bBgain,UINT8 bGammaSwitch,UINT8 bGammaIndex);
  125. void PQ_EnableDynamicBackLight(UINT8 ucLevel, UINT32 dwLightUser);
  126. int PQ_GetMenuHueValue(void);
  127. INT32 _MappingDrvValToOSD(UINT8 ucFunID, INT32 iDrvVal);
  128. INT32 _MappingOSDValToDrv(UINT8 ucFunID, INT32 iOsdVal);
  129. INT32 PQ_GetMenuValue(UINT8 ucFunID);
  130. void PQ_SetMenuValue(UINT8 ucFunID, int iValue);
  131. void PQ_SetMenuValueCT(UINT8 ucFunID, INT32 iValue1,INT32 iValue2,INT32 iValue3 );
  132. void PQ_DynamicGammaSetting_ISR(void);
  133. UINT8 PQ_GetGammaEnableSt(void);
  134. void PQ_SetLocationMode(UINT8 ucMode);
  135. void PQ_GammaCorrect(UINT8);
  136. void PQ_SetColorMatrix(UINT8 ucEnable);
  137. int PQ_GetCurrContrastValue(void);
  138. void PQ_EnNRWorkQue_ISR(void);
  139. void PQ_AdjustNRCounter_ISR(int AdjustNRCounter);
  140. UINT32 PQ_ChromaBinPercentage(UINT8 ucBin);
  141. /**
  142. * @brief detect the input pattern if color bar or not
  143. *
  144. * This function use the statistic distribution of chroma data in the capture window to judge if current pattern is color bar or not.
  145. * The method is take chroma distribution as 18 part, and the color adjoining to specific color must less than 1%
  146. * (the remainder of (chroma[x] * 100 / capture window) <= 0)
  147. *
  148. * @param n/a
  149. * @return 1 = color bar pattern ; 0 = not color bar apttern
  150. * note : PQ_IsColorBar() since 6710, PQ_SWDTColorBar for previous project
  151. */
  152. UINT8 PQ_IsColorBar(void);
  153. BOOL PQ_SWDTColorBar(void);
  154. /**
  155. * @brief For detect specific pattern : FLUKE 54200, PAT#DIGITAL SCAN(DIG_ADC2)
  156. *
  157. * This function detec tthe Chroma bin distribution for check specific pattern
  158. *
  159. * @param n/a
  160. * @return 1 : is DIGITAL SCAN(DIG_ADC2), 0 : not DIGITAL SCAN(DIG_ADC2)
  161. */
  162. UINT8 PQ_IsDigitalScanADC2(void);
  163. void PQ_EnColorBarDetectWorkQue_ISR(void);
  164. void PQ_ColorBarDetect(void);
  165. void PQ_ColorTempBias(PQ_COLOR_TEMP_BIAS ucType, int iValue);
  166. void PQ_SetupColorSpaceConversionTable(void);
  167. int PQ_GetMenuColorBias(UINT8 index);
  168. void PQ_DemoModeWidth(void);
  169. void PQ_PeakingFilterSetup(void);
  170. void PQ_FilterSetup(UINT8 ucSource, UINT8 ucSubSource);
  171. void PQ_CustomerUserCurve_HW_AutoThreshold(BOOL bReset);
  172. void PQ_VSyncUserCurveWrite(BOOL bReset);
  173. void PQ_CustomerUserCurve(BOOL bReset);
  174. void PQ_PrintSWDynamicContrastSetting(void);
  175. UINT32 PQ_LoadGammaTable(UINT32 *pulAddr);
  176. void PQ_GmeSetup(void);
  177. void PQ_GmeSetupWritePath(void);
  178. void PQ_GmeSetupReadPath(void);
  179. void PQ_ChangeBackLight(UINT32 dwLightTarget, int nSpeed);
  180. void PQ_EventSetFunction(UINT8 ucFunID, int iValue, int iParm1, int iParm2);
  181. void PQ_SetColorStyleSaturation(UINT8 ucType);
  182. void PQ_SetUserCurve(UINT8 ucFunID, UINT8 ucPointIdx, INT16 iValue);
  183. void PQ_GetRegInfo(PQ_RegInfo* pRegInfo);
  184. INT8 PQ_ColorLUT_GetRegionGain(UINT8 Type, UINT8 Index);
  185. void PQ_ColorLUT_SetRegion(INT32 iRegionIdx, INT32 iSatGain, INT32 iYGain, INT32 iRotAngle, INT32 iRotGain, INT32 bEnable, BOOL bSet);
  186. void PQ_ColorLUT_SetRange(UINT8 RegionIdx, UINT8 bMake, UINT8 HueMin, UINT8 HueMax, UINT8 SatMin, UINT8 SatMax, UINT8 YMin, UINT8 YMax, UINT8 SmoothLevel, BOOL bSet);
  187. BOOL PQ_GetGammaChange(void);
  188. void PQ_WriteGammaTable(void);
  189. BOOL PQ_SetGammaTable(UINT32 *pulAddr);
  190. void PQ_BackLightDetect(BOOL bReset);
  191. void PQ_VideoDetectionSetup(UINT8,UINT8,BOOL);
  192. void PQ_SetColorProcessor(BOOL bEnable);
  193. BOOL PQ_GetMatrixbypassCtl(void);
  194. void PQ_ResetDynamicConteast(void);
  195. void PQ_EnSWDCWorkQue_ISR(void);
  196. void PQ_SW_DynamicContrast_SceneChangeDetect_ISR(void);
  197. UINT8 PQ_GetDynamicContrastEnable(void);
  198. void PQ_regionLumaAverage(UINT8 bRegionIndex,UINT8 bTotalHnum,UINT8 bTotalVnum);
  199. void PQ_GetRegionLumaAverage(UINT16* bRegionYaverage);
  200. void PQ_GetRegionvalue(RegionHVStartSize* bRegionvalue);
  201. void PQ_SetFadeInOut(void);
  202. void PQ_Decide_Coefficient_Table(UINT8 ucUserSource, DRV_SLR_CONFIG eSlrConfig, UINT32 PreHfactor, UINT32 PostHfactor, UINT32 Vfactor);
  203. void load_coeff_table(void);
  204. void sp_w_table(void);
  205. void mips1_word_coeff_group(UINT8 ucAddr, UINT32 dw64, UINT32 dw68, UINT32 dw6c);
  206. void mips1_word_coeff_group_nodelay(UINT8 ucAddr, UINT32 dw64, UINT32 dw68, UINT32 dw6c);
  207. void PQ_AffectInPanelVSync_ISR(void);
  208. void PQ_AffectInInputVSync_ISR(void);
  209. #ifdef CONFIG_ENABLE_MIR
  210. void PQ_MIR_Decide_Coefficient_Table(UINT32 Hfactor);
  211. #endif
  212. void PQ_GetHistBin(UINT32 *Y_Hist);
  213. void PQ_SetHistBinindex(UINT8 index);
  214. void PQ_YUV_Datat_Formal(UINT8 ucType);
  215. UINT8 PQ_GET_YUV_Datat_Formal(void);
  216. void PQ_SetDIM_REF_CTRL(UINT32 pwm_number, UINT32 status, UINT32 mmiovalue);
  217. void PQ_SETPWMFreq(UINT32 PWMFreq);
  218. UINT32 PQ_GETCurrPWMFreq(void);
  219. UINT32 PQ_GETCurrPWM(void);
  220. UINT32 PQ_Getbjpeg(void);
  221. void PQ_SetPWMOff(BOOL bStatus);
  222. UINT32 PQ_GETCurrDutyPWM(void);
  223. void PQ_SETCurrDutyPWM(UINT16 uwDuty);
  224. UINT32 PQ_GETCurrPolarity(void);
  225. UINT32 PQ_GETCurrElectricity(void);
  226. void PQ_Sharpness_Control_In_3D(UINT8 bStatus);
  227. UINT8 PQ_GetPanelPWMNum(void);
  228. UINT8 PQ_GetMotionStatus(void);
  229. void PQ_SetMotioncond(void);
  230. void PQ_SetFilmMode(UINT8 ucEnable);
  231. void PQ_set_PWM_Duty(UINT16 uwMaxDuty, UINT16 uwMinDuty);
  232. void PQ_get_PWM_Duty(UINT16* uwMaxDuty, UINT16* uwMinDuty);
  233. UINT8 PQ_GetColorBarStatus(void);
  234. void PQ_SetNotFullScreenPatchStatus(BOOL bStatus);
  235. UINT8 PQ_GetNotFullScreenPatchStatus(void);
  236. void PQ_SetColorCross(BOOL ucEnable);
  237. void PQ_ResetColorCrossMemData(BOOL bReset);
  238. BOOL PQ_GetColorProcessor(void);
  239. /**
  240. * @brief Set NR setting by source
  241. *
  242. * This function set NR setting by source, for the NR setting that did not dynamic changed by noise level.
  243. * This function triggered while change source
  244. *
  245. * @param n/a
  246. * @return n/a
  247. */
  248. void PQ_AdjustNrBySource(void);
  249. /**
  250. * @brief adjust PQ setting in different JPEG display mode
  251. *
  252. * This function adjust PQ setting while JPEG in the preview mode
  253. *
  254. * @param ucDisplayMode, 0 as full screen mode, 1 as preview mode
  255. * @return n/a
  256. */
  257. void PQ_SetJPEGDisplayModePatch(UINT8 ucDisplayMode);
  258. UINT32 PQ_PureColorPatternDetect(INT8 ucHBin); //eric
  259. /**
  260. * @brief get parameter of current frame is pure color or not
  261. *
  262. * This function return parameter for current frame is pure color or not
  263. *
  264. * @param n/a
  265. * @return TRUE is pure color pattern, FALSE is not
  266. */
  267. BOOL PQ_GetPureColorPattern(void);
  268. #ifdef CONFIG_EXTRA_PWM_CONTROL_FOR_FAN
  269. void tv_Disable_ExtraPwm(UINT8 ucPwmNum, UINT32 uiFrequency, UINT32 uiDuty);
  270. #endif
  271. UINT8 PQ_GetGammaIndex(void);
  272. #endif