Staging: add MSM framebuffer driver
[safe/jmp/linux-2.6] / drivers / staging / msm / msm_fb_panel.h
1 /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are met:
5  *     * Redistributions of source code must retain the above copyright
6  *       notice, this list of conditions and the following disclaimer.
7  *     * Redistributions in binary form must reproduce the above copyright
8  *       notice, this list of conditions and the following disclaimer in the
9  *       documentation and/or other materials provided with the distribution.
10  *     * Neither the name of Code Aurora nor
11  *       the names of its contributors may be used to endorse or promote
12  *       products derived from this software without specific prior written
13  *       permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28
29 #ifndef MSM_FB_PANEL_H
30 #define MSM_FB_PANEL_H
31
32 #include "msm_fb_def.h"
33
34 struct msm_fb_data_type;
35
36 typedef void (*msm_fb_vsync_handler_type) (void *arg);
37
38 /* panel id type */
39 typedef struct panel_id_s {
40         uint16 id;
41         uint16 type;
42 } panel_id_type;
43
44 /* panel type list */
45 #define NO_PANEL       0xffff   /* No Panel */
46 #define MDDI_PANEL     1        /* MDDI */
47 #define EBI2_PANEL     2        /* EBI2 */
48 #define LCDC_PANEL     3        /* internal LCDC type */
49 #define EXT_MDDI_PANEL 4        /* Ext.MDDI */
50 #define TV_PANEL       5        /* TV */
51 #define HDMI_PANEL     6        /* HDMI TV */
52
53 /* panel class */
54 typedef enum {
55         DISPLAY_LCD = 0,        /* lcd = ebi2/mddi */
56         DISPLAY_LCDC,           /* lcdc */
57         DISPLAY_TV,             /* TV Out */
58         DISPLAY_EXT_MDDI,       /* External MDDI */
59 } DISP_TARGET;
60
61 /* panel device locaiton */
62 typedef enum {
63         DISPLAY_1 = 0,          /* attached as first device */
64         DISPLAY_2,              /* attached on second device */
65         MAX_PHYS_TARGET_NUM,
66 } DISP_TARGET_PHYS;
67
68 /* panel info type */
69 struct lcd_panel_info {
70         __u32 vsync_enable;
71         __u32 refx100;
72         __u32 v_back_porch;
73         __u32 v_front_porch;
74         __u32 v_pulse_width;
75         __u32 hw_vsync_mode;
76         __u32 vsync_notifier_period;
77 };
78
79 struct lcdc_panel_info {
80         __u32 h_back_porch;
81         __u32 h_front_porch;
82         __u32 h_pulse_width;
83         __u32 v_back_porch;
84         __u32 v_front_porch;
85         __u32 v_pulse_width;
86         __u32 border_clr;
87         __u32 underflow_clr;
88         __u32 hsync_skew;
89 };
90
91 struct mddi_panel_info {
92         __u32 vdopkt;
93 };
94
95 struct msm_panel_info {
96         __u32 xres;
97         __u32 yres;
98         __u32 bpp;
99         __u32 type;
100         __u32 wait_cycle;
101         DISP_TARGET_PHYS pdest;
102         __u32 bl_max;
103         __u32 bl_min;
104         __u32 fb_num;
105         __u32 clk_rate;
106         __u32 clk_min;
107         __u32 clk_max;
108         __u32 frame_count;
109
110         union {
111                 struct mddi_panel_info mddi;
112         };
113
114         union {
115                 struct lcd_panel_info lcd;
116                 struct lcdc_panel_info lcdc;
117         };
118 };
119
120 struct msm_fb_panel_data {
121         struct msm_panel_info panel_info;
122         void (*set_rect) (int x, int y, int xres, int yres);
123         void (*set_vsync_notifier) (msm_fb_vsync_handler_type, void *arg);
124         void (*set_backlight) (struct msm_fb_data_type *);
125
126         /* function entry chain */
127         int (*on) (struct platform_device *pdev);
128         int (*off) (struct platform_device *pdev);
129         struct platform_device *next;
130 };
131
132 /*===========================================================================
133   FUNCTIONS PROTOTYPES
134 ============================================================================*/
135 struct platform_device *msm_fb_device_alloc(struct msm_fb_panel_data *pdata,
136                                                 u32 type, u32 id);
137 int panel_next_on(struct platform_device *pdev);
138 int panel_next_off(struct platform_device *pdev);
139
140 int lcdc_device_register(struct msm_panel_info *pinfo);
141
142 int mddi_toshiba_device_register(struct msm_panel_info *pinfo,
143                                         u32 channel, u32 panel);
144
145 #endif /* MSM_FB_PANEL_H */