blob: 9ee8972e1f39c364c0bbe258ccc6e11025ab996e [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2008-2011, 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
14#ifndef MSM_FB_H
15#define MSM_FB_H
16
17#include <linux/module.h>
18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/time.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include "linux/proc_fs.h"
24
25#include <mach/hardware.h>
26#include <linux/io.h>
27#include <mach/board.h>
28
29#include <asm/system.h>
30#include <asm/mach-types.h>
31#include <mach/memory.h>
32#include <linux/semaphore.h>
33#include <linux/spinlock.h>
34#include <linux/workqueue.h>
35#include <linux/hrtimer.h>
36
37#include <linux/fb.h>
Vinay Kalia27020d12011-10-14 17:50:29 -070038#include <linux/list.h>
39#include <linux/types.h>
Nagamalleswararao Ganjie69bed82011-10-17 16:21:42 -070040#include <linux/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041
Vinay Kalia27020d12011-10-14 17:50:29 -070042#include <linux/msm_mdp.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070043#ifdef CONFIG_HAS_EARLYSUSPEND
44#include <linux/earlysuspend.h>
45#endif
46
47#include "msm_fb_panel.h"
48#include "mdp.h"
49
50#define MSM_FB_DEFAULT_PAGE_SIZE 2
51#define MFD_KEY 0x11161126
52#define MSM_FB_MAX_DEV_LIST 32
53
54struct disp_info_type_suspend {
55 boolean op_enable;
56 boolean sw_refreshing_enable;
57 boolean panel_power_on;
58};
59
Vinay Kalia27020d12011-10-14 17:50:29 -070060struct msmfb_writeback_data_list {
61 struct list_head registered_entry;
62 struct list_head active_entry;
63 void *addr;
64 struct file *pmem_file;
65 struct msmfb_data buf_info;
66 struct msmfb_img img;
67 int state;
68};
69
70
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071struct msm_fb_data_type {
72 __u32 key;
73 __u32 index;
74 __u32 ref_cnt;
75 __u32 fb_page;
76
77 panel_id_type panel;
78 struct msm_panel_info panel_info;
79
80 DISP_TARGET dest;
81 struct fb_info *fbi;
82
83 boolean op_enable;
84 uint32 fb_imgType;
85 boolean sw_currently_refreshing;
86 boolean sw_refreshing_enable;
87 boolean hw_refresh;
88#ifdef CONFIG_FB_MSM_OVERLAY
89 int overlay_play_enable;
90#endif
91
92 MDPIBUF ibuf;
93 boolean ibuf_flushed;
94 struct timer_list refresh_timer;
95 struct completion refresher_comp;
96
97 boolean pan_waiting;
98 struct completion pan_comp;
99
100 /* vsync */
101 boolean use_mdp_vsync;
102 __u32 vsync_gpio;
103 __u32 total_lcd_lines;
104 __u32 total_porch_lines;
105 __u32 lcd_ref_usec_time;
106 __u32 refresh_timer_duration;
107
108 struct hrtimer dma_hrtimer;
109
110 boolean panel_power_on;
111 struct work_struct dma_update_worker;
112 struct semaphore sem;
113
114 struct timer_list vsync_resync_timer;
115 boolean vsync_handler_pending;
116 struct work_struct vsync_resync_worker;
117
118 ktime_t last_vsync_timetick;
119
120 __u32 *vsync_width_boundary;
121
122 unsigned int pmem_id;
123 struct disp_info_type_suspend suspend;
124
125 __u32 channel_irq;
126
127 struct mdp_dma_data *dma;
128 void (*dma_fnc) (struct msm_fb_data_type *mfd);
129 int (*cursor_update) (struct fb_info *info,
130 struct fb_cursor *cursor);
131 int (*lut_update) (struct fb_info *info,
132 struct fb_cmap *cmap);
133 int (*do_histogram) (struct fb_info *info,
134 struct mdp_histogram *hist);
135 void *cursor_buf;
136 void *cursor_buf_phys;
137
138 void *cmd_port;
139 void *data_port;
140 void *data_port_phys;
141
142 __u32 bl_level;
143
144 struct platform_device *pdev;
145
146 __u32 var_xres;
147 __u32 var_yres;
148 __u32 var_pixclock;
149
150#ifdef MSM_FB_ENABLE_DBGFS
151 struct dentry *sub_dir;
152#endif
153
154#ifdef CONFIG_HAS_EARLYSUSPEND
155 struct early_suspend early_suspend;
156#ifdef CONFIG_FB_MSM_MDDI
157 struct early_suspend mddi_early_suspend;
158 struct early_suspend mddi_ext_early_suspend;
159#endif
160#endif
161 u32 mdp_fb_page_protection;
162
163 struct clk *ebi1_clk;
164 boolean dma_update_flag;
165 struct timer_list msmfb_no_update_notify_timer;
166 struct completion msmfb_update_notify;
167 struct completion msmfb_no_update_notify;
Nagamalleswararao Ganji0737d652011-10-14 02:02:33 -0700168 u32 ov_start, ov_end;
Huaibin Yang91018362011-11-29 14:57:43 -0800169 void *writeback_overlay0_phys;
170 void *writeback_overlay1_phys;
Vinay Kalia27020d12011-10-14 17:50:29 -0700171 struct mutex writeback_mutex;
172 struct mutex unregister_mutex;
173 struct list_head writeback_busy_queue;
174 struct list_head writeback_free_queue;
175 struct list_head writeback_register_queue;
176 wait_queue_head_t wait_q;
Nagamalleswararao Ganjie69bed82011-10-17 16:21:42 -0700177 struct ion_client *client;
Nagamalleswararao Ganjie8943492011-11-01 13:04:10 -0700178 u32 mdp_rev;
179 u32 use_ov0_blt, ov0_blt_state;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700180};
181
182struct dentry *msm_fb_get_debugfs_root(void);
183void msm_fb_debugfs_file_create(struct dentry *root, const char *name,
184 u32 *var);
185void msm_fb_set_backlight(struct msm_fb_data_type *mfd, __u32 bkl_lvl);
186
187struct platform_device *msm_fb_add_device(struct platform_device *pdev);
Vinay Kalia27020d12011-10-14 17:50:29 -0700188struct fb_info *msm_fb_get_writeback_fb(void);
189int msm_fb_writeback_init(struct fb_info *info);
190int msm_fb_writeback_register_buffer(struct fb_info *info,
191 struct msmfb_writeback_data *data);
192int msm_fb_writeback_queue_buffer(struct fb_info *info,
193 struct msmfb_data *data);
194int msm_fb_writeback_dequeue_buffer(struct fb_info *info,
195 struct msmfb_data *data);
196int msm_fb_writeback_unregister_buffer(struct fb_info *info,
197 struct msmfb_writeback_data *data);
198int msm_fb_writeback_terminate(struct fb_info *info);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700199int msm_fb_detect_client(const char *name);
200
201#ifdef CONFIG_FB_BACKLIGHT
202void msm_fb_config_backlight(struct msm_fb_data_type *mfd);
203#endif
204
205void fill_black_screen(void);
206void unfill_black_screen(void);
207
208#endif /* MSM_FB_H */