staging: msm: Use explicit GPLv2 licenses
[pandora-kernel.git] / drivers / staging / msm / msm_fb.h
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_H
14 #define MSM_FB_H
15
16 #include <linux/module.h>
17 #include <linux/kernel.h>
18 #include <linux/sched.h>
19 #include <linux/time.h>
20 #include <linux/init.h>
21 #include <linux/interrupt.h>
22 #include "linux/proc_fs.h"
23
24 #include <mach/hardware.h>
25 #include <linux/io.h>
26 #include <mach/board.h>
27
28 #include <asm/system.h>
29 #include <asm/mach-types.h>
30 #include <mach/memory.h>
31 #include <linux/semaphore.h>
32 #include <linux/spinlock.h>
33 #include <linux/workqueue.h>
34 #include <linux/hrtimer.h>
35
36 #include <linux/fb.h>
37
38 #ifdef CONFIG_HAS_EARLYSUSPEND
39 #include <linux/earlysuspend.h>
40 #endif
41
42 #include "msm_fb_panel.h"
43 #include "mdp.h"
44
45 #define MSM_FB_DEFAULT_PAGE_SIZE 2
46 #define MFD_KEY  0x11161126
47 #define MSM_FB_MAX_DEV_LIST 32
48
49 struct disp_info_type_suspend {
50         boolean op_enable;
51         boolean sw_refreshing_enable;
52         boolean panel_power_on;
53 };
54
55 struct msm_fb_data_type {
56         __u32 key;
57         __u32 index;
58         __u32 ref_cnt;
59         __u32 fb_page;
60
61         panel_id_type panel;
62         struct msm_panel_info panel_info;
63
64         DISP_TARGET dest;
65         struct fb_info *fbi;
66
67         boolean op_enable;
68         uint32 fb_imgType;
69         boolean sw_currently_refreshing;
70         boolean sw_refreshing_enable;
71         boolean hw_refresh;
72
73         MDPIBUF ibuf;
74         boolean ibuf_flushed;
75         struct timer_list refresh_timer;
76         struct completion refresher_comp;
77
78         boolean pan_waiting;
79         struct completion pan_comp;
80
81         /* vsync */
82         boolean use_mdp_vsync;
83         __u32 vsync_gpio;
84         __u32 total_lcd_lines;
85         __u32 total_porch_lines;
86         __u32 lcd_ref_usec_time;
87         __u32 refresh_timer_duration;
88
89         struct hrtimer dma_hrtimer;
90
91         boolean panel_power_on;
92         struct work_struct dma_update_worker;
93         struct semaphore sem;
94
95         struct timer_list vsync_resync_timer;
96         boolean vsync_handler_pending;
97         struct work_struct vsync_resync_worker;
98
99         ktime_t last_vsync_timetick;
100
101         __u32 *vsync_width_boundary;
102
103         unsigned int pmem_id;
104         struct disp_info_type_suspend suspend;
105
106         __u32 channel_irq;
107
108         struct mdp_dma_data *dma;
109         void (*dma_fnc) (struct msm_fb_data_type *mfd);
110         int (*cursor_update) (struct fb_info *info,
111                               struct fb_cursor *cursor);
112         int (*lut_update) (struct fb_info *info,
113                               struct fb_cmap *cmap);
114         int (*do_histogram) (struct fb_info *info,
115                               struct mdp_histogram *hist);
116         void *cursor_buf;
117         void *cursor_buf_phys;
118
119         void *cmd_port;
120         void *data_port;
121         void *data_port_phys;
122
123         __u32 bl_level;
124
125         struct platform_device *pdev;
126
127         __u32 var_xres;
128         __u32 var_yres;
129         __u32 var_pixclock;
130
131 #ifdef MSM_FB_ENABLE_DBGFS
132         struct dentry *sub_dir;
133 #endif
134
135 #ifdef CONFIG_HAS_EARLYSUSPEND
136         struct early_suspend early_suspend;
137         struct early_suspend mddi_early_suspend;
138         struct early_suspend mddi_ext_early_suspend;
139 #endif
140         u32 mdp_fb_page_protection;
141         int allow_set_offset;
142 };
143
144 struct dentry *msm_fb_get_debugfs_root(void);
145 void msm_fb_debugfs_file_create(struct dentry *root, const char *name,
146                                 u32 *var);
147 void msm_fb_set_backlight(struct msm_fb_data_type *mfd, __u32 bkl_lvl,
148                                 u32 save);
149
150 void msm_fb_add_device(struct platform_device *pdev);
151
152 int msm_fb_detect_client(const char *name);
153
154 #ifdef CONFIG_FB_BACKLIGHT
155 void msm_fb_config_backlight(struct msm_fb_data_type *mfd);
156 #endif
157
158 #endif /* MSM_FB_H */