rk3188:add lcdc support
[firefly-linux-kernel-4.4.55.git] / include / linux / rk_screen.h
1 #ifndef _SCREEN_H
2 #define _SCREEN_H
3
4 typedef enum _SCREEN_TYPE {
5     SCREEN_NULL = 0,
6     SCREEN_RGB,
7     SCREEN_LVDS,
8         SCREEN_MCU,
9     SCREEN_TVOUT,
10     SCREEN_HDMI,
11 } SCREEN_TYPE;
12
13 typedef enum _REFRESH_STAGE {
14     REFRESH_PRE = 0,
15     REFRESH_END,
16
17 } REFRESH_STAGE;
18
19
20 typedef enum _MCU_IOCTL {
21     MCU_WRCMD = 0,
22     MCU_WRDATA,
23     MCU_SETBYPASS,
24
25 } MCU_IOCTL;
26
27
28 typedef enum _MCU_STATUS {
29     MS_IDLE = 0,
30     MS_MCU,
31     MS_EBOOK,
32     MS_EWAITSTART,
33     MS_EWAITEND,
34     MS_EEND,
35
36 } MCU_STATUS;
37
38 enum rk_disp_prop{       //display device property
39     PRMRY = 0,                     //primary display device ,like LCD screen
40     EXTEND,                        //extend display device ,like hdmi ,tv out
41 };
42
43 struct rk29lcd_info {
44         u32 lcd_id;
45         u32 txd_pin;
46         u32 clk_pin;
47         u32 cs_pin;
48         u32     reset_pin;
49         int (*io_init)(void);
50         int (*io_deinit)(void);
51         int (*io_enable)(void);
52         int (*io_disable)(void);
53 };
54
55
56 /* Screen description */
57 typedef struct rk29fb_screen {
58         /* screen type & hardware connect format & out face */
59         u16 type;
60         u16 hw_format;
61         u16 face;
62         u8 lcdc_id;    //which output interface the screeen connect to
63         u8 screen_id; //screen number
64
65         /* Screen size */
66         u16 x_res;
67         u16 y_res;
68         u16 width;
69         u16 height;
70
71         u32 mode;
72         /* Timing */
73         u32 pixclock;
74         u16 left_margin;
75         u16 right_margin;
76         u16 hsync_len;
77         u16 upper_margin;
78         u16 lower_margin;
79         u16 vsync_len;
80         u8  ft; //the time need to display one frame,in ms
81         int *dsp_lut; //display lut 
82 #if defined(CONFIG_HDMI_DUAL_DISP) || defined(CONFIG_ONE_LCDC_DUAL_OUTPUT_INF)
83     /* Scaler mode Timing */
84         u32 s_pixclock;
85         u16 s_left_margin;
86         u16 s_right_margin;
87         u16 s_hsync_len;
88         u16 s_upper_margin;
89         u16 s_lower_margin;
90         u16 s_vsync_len; 
91         u16 s_hsync_st;
92         u16 s_vsync_st;
93         bool s_den_inv;
94         bool s_hv_sync_inv;
95         bool s_clk_inv;
96 #endif
97         u8 hdmi_resolution;
98             /* mcu need */
99         u8 mcu_wrperiod;
100         u8 mcu_usefmk;
101         u8 mcu_frmrate;
102
103                 /* Pin polarity */
104         u8 pin_hsync;
105         u8 pin_vsync;
106         u8 pin_den;
107         u8 pin_dclk;
108         u32 lcdc_aclk;
109         u8 pin_dispon;
110
111         /* Swap rule */
112         u8 swap_bg;
113         u8 swap_rg;
114         u8 swap_rb;
115         u8 swap_delta;
116         u8 swap_dumy;
117
118         int xpos;  //horizontal display start position on the sceen ,then can be changed by application
119         int ypos;
120         int xsize; //horizontal and vertical display size on he screen,they can be changed by application
121         int ysize;
122         /* Operation function*/
123         int (*init)(void);
124         int (*standby)(u8 enable);
125         int (*refresh)(u8 arg);
126         int (*scandir)(u16 dir);
127         int (*disparea)(u8 area);
128         int (*sscreen_get)(struct rk29fb_screen *screen, u8 resolution);
129         int (*sscreen_set)(struct rk29fb_screen *screen, bool type);// 1: use scaler 0:bypass
130 } rk_screen;
131
132 #ifndef CONFIG_DISPLAY_SUPPORT
133 static inline void set_lcd_info(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info) {}
134 #else
135 extern void set_lcd_info(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info);
136 #endif
137 extern void set_tv_info(struct rk29fb_screen *screen);
138 extern void set_hdmi_info(struct rk29fb_screen *screen);
139
140 #endif