1 /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
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
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.
32 #include <linux/module.h>
33 #include <linux/kernel.h>
34 #include <linux/sched.h>
35 #include <linux/time.h>
36 #include <linux/init.h>
37 #include <linux/interrupt.h>
38 #include "linux/proc_fs.h"
40 #include <mach/hardware.h>
42 #include <mach/board.h>
44 #include <asm/system.h>
45 #include <asm/mach-types.h>
46 #include <mach/memory.h>
47 #include <linux/semaphore.h>
48 #include <linux/spinlock.h>
49 #include <linux/workqueue.h>
50 #include <linux/hrtimer.h>
54 #ifdef CONFIG_HAS_EARLYSUSPEND
55 #include <linux/earlysuspend.h>
58 #include "msm_fb_panel.h"
61 #define MSM_FB_DEFAULT_PAGE_SIZE 2
62 #define MFD_KEY 0x11161126
63 #define MSM_FB_MAX_DEV_LIST 32
65 struct disp_info_type_suspend
{
67 boolean sw_refreshing_enable
;
68 boolean panel_power_on
;
71 struct msm_fb_data_type
{
78 struct msm_panel_info panel_info
;
85 boolean sw_currently_refreshing
;
86 boolean sw_refreshing_enable
;
91 struct timer_list refresh_timer
;
92 struct completion refresher_comp
;
95 struct completion pan_comp
;
98 boolean use_mdp_vsync
;
100 __u32 total_lcd_lines
;
101 __u32 total_porch_lines
;
102 __u32 lcd_ref_usec_time
;
103 __u32 refresh_timer_duration
;
105 struct hrtimer dma_hrtimer
;
107 boolean panel_power_on
;
108 struct work_struct dma_update_worker
;
109 struct semaphore sem
;
111 struct timer_list vsync_resync_timer
;
112 boolean vsync_handler_pending
;
113 struct work_struct vsync_resync_worker
;
115 ktime_t last_vsync_timetick
;
117 __u32
*vsync_width_boundary
;
119 unsigned int pmem_id
;
120 struct disp_info_type_suspend suspend
;
124 struct mdp_dma_data
*dma
;
125 void (*dma_fnc
) (struct msm_fb_data_type
*mfd
);
126 int (*cursor_update
) (struct fb_info
*info
,
127 struct fb_cursor
*cursor
);
128 int (*lut_update
) (struct fb_info
*info
,
129 struct fb_cmap
*cmap
);
130 int (*do_histogram
) (struct fb_info
*info
,
131 struct mdp_histogram
*hist
);
133 void *cursor_buf_phys
;
137 void *data_port_phys
;
141 struct platform_device
*pdev
;
147 #ifdef MSM_FB_ENABLE_DBGFS
148 struct dentry
*sub_dir
;
151 #ifdef CONFIG_HAS_EARLYSUSPEND
152 struct early_suspend early_suspend
;
153 struct early_suspend mddi_early_suspend
;
154 struct early_suspend mddi_ext_early_suspend
;
156 u32 mdp_fb_page_protection
;
157 int allow_set_offset
;
160 struct dentry
*msm_fb_get_debugfs_root(void);
161 void msm_fb_debugfs_file_create(struct dentry
*root
, const char *name
,
163 void msm_fb_set_backlight(struct msm_fb_data_type
*mfd
, __u32 bkl_lvl
,
166 void msm_fb_add_device(struct platform_device
*pdev
);
168 int msm_fb_detect_client(const char *name
);
170 #ifdef CONFIG_FB_BACKLIGHT
171 void msm_fb_config_backlight(struct msm_fb_data_type
*mfd
);
174 #endif /* MSM_FB_H */