1 /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 and
5  * only version 2 as published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12 
13 #ifndef MSM_FB_PANEL_H
14 #define MSM_FB_PANEL_H
15 
16 #include "msm_fb_def.h"
17 
18 struct msm_fb_data_type;
19 
20 typedef void (*msm_fb_vsync_handler_type) (void *arg);
21 
22 /* panel id type */
23 typedef struct panel_id_s {
24 	uint16 id;
25 	uint16 type;
26 } panel_id_type;
27 
28 /* panel type list */
29 #define NO_PANEL       0xffff	/* No Panel */
30 #define MDDI_PANEL     1	/* MDDI */
31 #define EBI2_PANEL     2	/* EBI2 */
32 #define LCDC_PANEL     3	/* internal LCDC type */
33 #define EXT_MDDI_PANEL 4	/* Ext.MDDI */
34 #define TV_PANEL       5	/* TV */
35 #define HDMI_PANEL     6	/* HDMI TV */
36 
37 /* panel class */
38 typedef enum {
39 	DISPLAY_LCD = 0,	/* lcd = ebi2/mddi */
40 	DISPLAY_LCDC,		/* lcdc */
41 	DISPLAY_TV,		/* TV Out */
42 	DISPLAY_EXT_MDDI,	/* External MDDI */
43 } DISP_TARGET;
44 
45 /* panel device locaiton */
46 typedef enum {
47 	DISPLAY_1 = 0,		/* attached as first device */
48 	DISPLAY_2,		/* attached on second device */
49 	MAX_PHYS_TARGET_NUM,
50 } DISP_TARGET_PHYS;
51 
52 /* panel info type */
53 struct lcd_panel_info {
54 	__u32 vsync_enable;
55 	__u32 refx100;
56 	__u32 v_back_porch;
57 	__u32 v_front_porch;
58 	__u32 v_pulse_width;
59 	__u32 hw_vsync_mode;
60 	__u32 vsync_notifier_period;
61 };
62 
63 struct lcdc_panel_info {
64 	__u32 h_back_porch;
65 	__u32 h_front_porch;
66 	__u32 h_pulse_width;
67 	__u32 v_back_porch;
68 	__u32 v_front_porch;
69 	__u32 v_pulse_width;
70 	__u32 border_clr;
71 	__u32 underflow_clr;
72 	__u32 hsync_skew;
73 };
74 
75 struct mddi_panel_info {
76 	__u32 vdopkt;
77 };
78 
79 struct msm_panel_info {
80 	__u32 xres;
81 	__u32 yres;
82 	__u32 bpp;
83 	__u32 type;
84 	__u32 wait_cycle;
85 	DISP_TARGET_PHYS pdest;
86 	__u32 bl_max;
87 	__u32 bl_min;
88 	__u32 fb_num;
89 	__u32 clk_rate;
90 	__u32 clk_min;
91 	__u32 clk_max;
92 	__u32 frame_count;
93 
94 	union {
95 		struct mddi_panel_info mddi;
96 	};
97 
98 	union {
99 		struct lcd_panel_info lcd;
100 		struct lcdc_panel_info lcdc;
101 	};
102 };
103 
104 struct msm_fb_panel_data {
105 	struct msm_panel_info panel_info;
106 	void (*set_rect) (int x, int y, int xres, int yres);
107 	void (*set_vsync_notifier) (msm_fb_vsync_handler_type, void *arg);
108 	void (*set_backlight) (struct msm_fb_data_type *);
109 
110 	/* function entry chain */
111 	int (*on) (struct platform_device *pdev);
112 	int (*off) (struct platform_device *pdev);
113 	struct platform_device *next;
114 };
115 
116 /*===========================================================================
117   FUNCTIONS PROTOTYPES
118 ============================================================================*/
119 struct platform_device *msm_fb_device_alloc(struct msm_fb_panel_data *pdata,
120 						u32 type, u32 id);
121 int panel_next_on(struct platform_device *pdev);
122 int panel_next_off(struct platform_device *pdev);
123 
124 int lcdc_device_register(struct msm_panel_info *pinfo);
125 
126 int mddi_toshiba_device_register(struct msm_panel_info *pinfo,
127 					u32 channel, u32 panel);
128 
129 #endif /* MSM_FB_PANEL_H */
130