blob: 43802a22ab3dfbb1cbd5efe204064073a8cf198d [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>
38
39#ifdef CONFIG_HAS_EARLYSUSPEND
40#include <linux/earlysuspend.h>
41#endif
42
43#include "msm_fb_panel.h"
44#include "mdp.h"
45
46#define MSM_FB_DEFAULT_PAGE_SIZE 2
47#define MFD_KEY 0x11161126
48#define MSM_FB_MAX_DEV_LIST 32
49
50struct disp_info_type_suspend {
51 boolean op_enable;
52 boolean sw_refreshing_enable;
53 boolean panel_power_on;
54};
55
56struct msm_fb_data_type {
57 __u32 key;
58 __u32 index;
59 __u32 ref_cnt;
60 __u32 fb_page;
61
62 panel_id_type panel;
63 struct msm_panel_info panel_info;
64
65 DISP_TARGET dest;
66 struct fb_info *fbi;
67
68 boolean op_enable;
69 uint32 fb_imgType;
70 boolean sw_currently_refreshing;
71 boolean sw_refreshing_enable;
72 boolean hw_refresh;
73#ifdef CONFIG_FB_MSM_OVERLAY
74 int overlay_play_enable;
75#endif
76
77 MDPIBUF ibuf;
78 boolean ibuf_flushed;
79 struct timer_list refresh_timer;
80 struct completion refresher_comp;
81
82 boolean pan_waiting;
83 struct completion pan_comp;
84
85 /* vsync */
86 boolean use_mdp_vsync;
87 __u32 vsync_gpio;
88 __u32 total_lcd_lines;
89 __u32 total_porch_lines;
90 __u32 lcd_ref_usec_time;
91 __u32 refresh_timer_duration;
92
93 struct hrtimer dma_hrtimer;
94
95 boolean panel_power_on;
96 struct work_struct dma_update_worker;
97 struct semaphore sem;
98
99 struct timer_list vsync_resync_timer;
100 boolean vsync_handler_pending;
101 struct work_struct vsync_resync_worker;
102
103 ktime_t last_vsync_timetick;
104
105 __u32 *vsync_width_boundary;
106
107 unsigned int pmem_id;
108 struct disp_info_type_suspend suspend;
109
110 __u32 channel_irq;
111
112 struct mdp_dma_data *dma;
113 void (*dma_fnc) (struct msm_fb_data_type *mfd);
114 int (*cursor_update) (struct fb_info *info,
115 struct fb_cursor *cursor);
116 int (*lut_update) (struct fb_info *info,
117 struct fb_cmap *cmap);
118 int (*do_histogram) (struct fb_info *info,
119 struct mdp_histogram *hist);
120 void *cursor_buf;
121 void *cursor_buf_phys;
122
123 void *cmd_port;
124 void *data_port;
125 void *data_port_phys;
126
127 __u32 bl_level;
128
129 struct platform_device *pdev;
130
131 __u32 var_xres;
132 __u32 var_yres;
133 __u32 var_pixclock;
134
135#ifdef MSM_FB_ENABLE_DBGFS
136 struct dentry *sub_dir;
137#endif
138
139#ifdef CONFIG_HAS_EARLYSUSPEND
140 struct early_suspend early_suspend;
141#ifdef CONFIG_FB_MSM_MDDI
142 struct early_suspend mddi_early_suspend;
143 struct early_suspend mddi_ext_early_suspend;
144#endif
145#endif
146 u32 mdp_fb_page_protection;
147
148 struct clk *ebi1_clk;
149 boolean dma_update_flag;
150 struct timer_list msmfb_no_update_notify_timer;
151 struct completion msmfb_update_notify;
152 struct completion msmfb_no_update_notify;
Nagamalleswararao Ganji0737d652011-10-14 02:02:33 -0700153 u32 ov_start, ov_end;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700154};
155
156struct dentry *msm_fb_get_debugfs_root(void);
157void msm_fb_debugfs_file_create(struct dentry *root, const char *name,
158 u32 *var);
159void msm_fb_set_backlight(struct msm_fb_data_type *mfd, __u32 bkl_lvl);
160
161struct platform_device *msm_fb_add_device(struct platform_device *pdev);
162
163int msm_fb_detect_client(const char *name);
164
165#ifdef CONFIG_FB_BACKLIGHT
166void msm_fb_config_backlight(struct msm_fb_data_type *mfd);
167#endif
168
169void fill_black_screen(void);
170void unfill_black_screen(void);
171
172#endif /* MSM_FB_H */