import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / video / mt8127 / mt8127 / dpi_drv.h
1 #ifndef __DPI_DRV_H__
2 #define __DPI_DRV_H__
3
4 #include "lcm_drv.h"
5 #include "disp_intr.h"
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 // ---------------------------------------------------------------------------
11
12 #define DPI_CHECK_RET(expr) \
13 do { \
14 DPI_STATUS ret = (expr); \
15 ASSERT(DPI_STATUS_OK == ret); \
16 } while (0)
17
18 // ---------------------------------------------------------------------------
19
20 typedef enum
21 {
22 DPI_STATUS_OK = 0,
23
24 DPI_STATUS_ERROR,
25 } DPI_STATUS;
26
27
28 typedef enum
29 {
30 DPI_FB_FORMAT_RGB565 = 0,
31 DPI_FB_FORMAT_RGB888 = 1,
32 DPI_FB_FORMAT_XRGB888 = 1,
33 DPI_FB_FORMAT_RGBX888 = 1,
34 DPI_FB_FORMAT_NUM,
35 } DPI_FB_FORMAT;
36
37
38 typedef enum
39 {
40 DPI_RGB_ORDER_RGB = 0,
41 DPI_RGB_ORDER_BGR = 1,
42 } DPI_RGB_ORDER;
43
44
45 typedef enum
46 {
47 DPI_FB_0 = 0,
48 DPI_FB_1 = 1,
49 DPI_FB_2 = 2,
50 DPI_FB_NUM,
51 } DPI_FB_ID;
52
53
54 typedef enum
55 {
56 DPI_POLARITY_RISING = 0,
57 DPI_POLARITY_FALLING = 1
58 } DPI_POLARITY;
59
60 /*
61 typedef enum
62 {
63 DPI_OUTPUT_BIT_NUM_8BITS = 0,
64 DPI_OUTPUT_BIT_NUM_10BITS = 1,
65 DPI_OUTPUT_BIT_NUM_12BITS = 2
66 } DPI_OUTPUT_BIT_NUM;
67
68 typedef enum
69 {
70 DPI_OUTPUT_CHANNEL_SWAP_RGB = 0,
71 DPI_OUTPUT_CHANNEL_SWAP_GBR = 1,
72 DPI_OUTPUT_CHANNEL_SWAP_BRG = 2,
73 DPI_OUTPUT_CHANNEL_SWAP_RBG = 3,
74 DPI_OUTPUT_CHANNEL_SWAP_GRB = 4,
75 DPI_OUTPUT_CHANNEL_SWAP_BGR = 5
76 } DPI_OUTPUT_CHANNEL_SWAP;
77
78 typedef enum
79 {
80 DPI_OUTPUT_YC_MAP_RGB_OR_CrYCb = 0, // {R[7:4],G[7:4],B[7:4]} or {Cr[7:4],Y[7:4],Cb[7:4]}
81 DPI_OUTPUT_YC_MAP_CYCY = 4, // {C[11:4],Y[11:4],C[3:0],Y[3:0]}
82 DPI_OUTPUT_YC_MAP_YCYC = 5, // {Y[11:4],C[11:4],Y[3:0],C[3:0]}
83 DPI_OUTPUT_YC_MAP_CY = 6, // {C[11:0],Y[11:0]}
84 DPI_OUTPUT_YC_MAP_YC = 7 // {Y[11:0],C[11:0]}
85 } DPI_OUTPUT_YC_MAP;
86
87 typedef enum
88 {
89 RGB = 0,
90 RGB_FULL,
91 YCBCR_444,
92 YCBCR_422,
93 XV_YCC,
94 YCBCR_444_FULL,
95 YCBCR_422_FULL
96
97 } COLOR_SPACE_T;
98 */
99 // ---------------------------------------------------------------------------
100
101 DPI_STATUS DPI_Init(BOOL isDpiPoweredOn);
102 DPI_STATUS DPI_Deinit(void);
103
104 DPI_STATUS DPI_Init_PLL(void);
105 DPI_STATUS DPI_Set_DrivingCurrent(LCM_PARAMS *lcm_params);
106
107 DPI_STATUS DPI_PowerOn(void);
108 DPI_STATUS DPI_PowerOff(void);
109
110 DPI_STATUS DPI_EnableClk(void);
111 DPI_STATUS DPI_DisableClk(void);
112
113 DPI_STATUS DPI_EnableSeqOutput(BOOL enable);
114 DPI_STATUS DPI_SetRGBOrder(DPI_RGB_ORDER input, DPI_RGB_ORDER output);
115
116 DPI_STATUS DPI_ConfigPixelClk(DPI_POLARITY polarity, UINT32 divisor, UINT32 duty);
117 DPI_STATUS DPI_ConfigDataEnable(DPI_POLARITY polarity);
118 DPI_STATUS DPI_ConfigVsync(DPI_POLARITY polarity,
119 UINT32 pulseWidth, UINT32 backPorch, UINT32 frontPorch);
120 DPI_STATUS DPI_ConfigHsync(DPI_POLARITY polarity,
121 UINT32 pulseWidth, UINT32 backPorch, UINT32 frontPorch);
122
123 DPI_STATUS DPI_FBSyncFlipWithLCD(BOOL enable);
124 DPI_STATUS DPI_SetDSIMode(BOOL enable);
125 BOOL DPI_IsDSIMode(void);
126 DPI_STATUS DPI_FBSetFormat(DPI_FB_FORMAT format);
127 DPI_FB_FORMAT DPI_FBGetFormat(void);
128 DPI_STATUS DPI_FBSetSize(UINT32 width, UINT32 height);
129 DPI_STATUS DPI_FBEnable(DPI_FB_ID id, BOOL enable);
130 DPI_STATUS DPI_FBSetAddress(DPI_FB_ID id, UINT32 address);
131 DPI_STATUS DPI_FBSetPitch(DPI_FB_ID id, UINT32 pitchInByte);
132
133 DPI_STATUS DPI_SetFifoThreshold(UINT32 low, UINT32 high);
134
135 // Debug
136 DPI_STATUS DPI_DumpRegisters(void);
137
138 DPI_STATUS DPI_Capture_Framebuffer(unsigned int pvbuf, unsigned int bpp);
139
140 //FM De-sense
141 DPI_STATUS DPI_FMDesense_Query(void);
142 DPI_STATUS DPI_FM_Desense(unsigned long freq);
143 DPI_STATUS DPI_Get_Default_CLK(unsigned int *clk);
144 DPI_STATUS DPI_Get_Current_CLK(unsigned int *clk);
145 DPI_STATUS DPI_Change_CLK(unsigned int clk);
146 DPI_STATUS DPI_Reset_CLK(void);
147
148 void DPI_mipi_switch(bool on);
149 void DPI_DisableIrq(void);
150 void DPI_EnableIrq(void);
151 DPI_STATUS DPI_FreeIRQ(void);
152
153 DPI_STATUS DPI_EnableInterrupt(DISP_INTERRUPT_EVENTS eventID);
154 DPI_STATUS DPI_SetInterruptCallback(void (*pCB)(DISP_INTERRUPT_EVENTS eventID));
155 void DPI_WaitVSYNC(void);
156 void DPI_InitVSYNC(unsigned int vsync_interval);
157 void DPI_PauseVSYNC(bool enable);
158
159 DPI_STATUS DPI_ConfigLVDS(LCM_PARAMS *lcm_params);
160 DPI_STATUS DPI_LVDS_Enable(void);
161 DPI_STATUS DPI_LVDS_Disable(void);
162
163 DPI_STATUS DPI_ConfigHDMI(void);
164
165 unsigned int DPI_Check_LCM(void);
166 // ---------------------------------------------------------------------------
167
168 #ifdef __cplusplus
169 }
170 #endif
171
172 #endif // __DPI_DRV_H__