| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* 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 Kalia | 27020d1 | 2011-10-14 17:50:29 -0700 | [diff] [blame^] | 38 | #include <linux/list.h> |
| 39 | #include <linux/types.h> |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 40 | |
| Vinay Kalia | 27020d1 | 2011-10-14 17:50:29 -0700 | [diff] [blame^] | 41 | #include <linux/msm_mdp.h> |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 42 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 43 | #include <linux/earlysuspend.h> |
| 44 | #endif |
| 45 | |
| 46 | #include "msm_fb_panel.h" |
| 47 | #include "mdp.h" |
| 48 | |
| 49 | #define MSM_FB_DEFAULT_PAGE_SIZE 2 |
| 50 | #define MFD_KEY 0x11161126 |
| 51 | #define MSM_FB_MAX_DEV_LIST 32 |
| 52 | |
| 53 | struct disp_info_type_suspend { |
| 54 | boolean op_enable; |
| 55 | boolean sw_refreshing_enable; |
| 56 | boolean panel_power_on; |
| 57 | }; |
| 58 | |
| Vinay Kalia | 27020d1 | 2011-10-14 17:50:29 -0700 | [diff] [blame^] | 59 | struct msmfb_writeback_data_list { |
| 60 | struct list_head registered_entry; |
| 61 | struct list_head active_entry; |
| 62 | void *addr; |
| 63 | struct file *pmem_file; |
| 64 | struct msmfb_data buf_info; |
| 65 | struct msmfb_img img; |
| 66 | int state; |
| 67 | }; |
| 68 | |
| 69 | |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 70 | struct msm_fb_data_type { |
| 71 | __u32 key; |
| 72 | __u32 index; |
| 73 | __u32 ref_cnt; |
| 74 | __u32 fb_page; |
| 75 | |
| 76 | panel_id_type panel; |
| 77 | struct msm_panel_info panel_info; |
| 78 | |
| 79 | DISP_TARGET dest; |
| 80 | struct fb_info *fbi; |
| 81 | |
| 82 | boolean op_enable; |
| 83 | uint32 fb_imgType; |
| 84 | boolean sw_currently_refreshing; |
| 85 | boolean sw_refreshing_enable; |
| 86 | boolean hw_refresh; |
| 87 | #ifdef CONFIG_FB_MSM_OVERLAY |
| 88 | int overlay_play_enable; |
| 89 | #endif |
| 90 | |
| 91 | MDPIBUF ibuf; |
| 92 | boolean ibuf_flushed; |
| 93 | struct timer_list refresh_timer; |
| 94 | struct completion refresher_comp; |
| 95 | |
| 96 | boolean pan_waiting; |
| 97 | struct completion pan_comp; |
| 98 | |
| 99 | /* vsync */ |
| 100 | boolean use_mdp_vsync; |
| 101 | __u32 vsync_gpio; |
| 102 | __u32 total_lcd_lines; |
| 103 | __u32 total_porch_lines; |
| 104 | __u32 lcd_ref_usec_time; |
| 105 | __u32 refresh_timer_duration; |
| 106 | |
| 107 | struct hrtimer dma_hrtimer; |
| 108 | |
| 109 | boolean panel_power_on; |
| 110 | struct work_struct dma_update_worker; |
| 111 | struct semaphore sem; |
| 112 | |
| 113 | struct timer_list vsync_resync_timer; |
| 114 | boolean vsync_handler_pending; |
| 115 | struct work_struct vsync_resync_worker; |
| 116 | |
| 117 | ktime_t last_vsync_timetick; |
| 118 | |
| 119 | __u32 *vsync_width_boundary; |
| 120 | |
| 121 | unsigned int pmem_id; |
| 122 | struct disp_info_type_suspend suspend; |
| 123 | |
| 124 | __u32 channel_irq; |
| 125 | |
| 126 | struct mdp_dma_data *dma; |
| 127 | void (*dma_fnc) (struct msm_fb_data_type *mfd); |
| 128 | int (*cursor_update) (struct fb_info *info, |
| 129 | struct fb_cursor *cursor); |
| 130 | int (*lut_update) (struct fb_info *info, |
| 131 | struct fb_cmap *cmap); |
| 132 | int (*do_histogram) (struct fb_info *info, |
| 133 | struct mdp_histogram *hist); |
| 134 | void *cursor_buf; |
| 135 | void *cursor_buf_phys; |
| 136 | |
| 137 | void *cmd_port; |
| 138 | void *data_port; |
| 139 | void *data_port_phys; |
| 140 | |
| 141 | __u32 bl_level; |
| 142 | |
| 143 | struct platform_device *pdev; |
| 144 | |
| 145 | __u32 var_xres; |
| 146 | __u32 var_yres; |
| 147 | __u32 var_pixclock; |
| 148 | |
| 149 | #ifdef MSM_FB_ENABLE_DBGFS |
| 150 | struct dentry *sub_dir; |
| 151 | #endif |
| 152 | |
| 153 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 154 | struct early_suspend early_suspend; |
| 155 | #ifdef CONFIG_FB_MSM_MDDI |
| 156 | struct early_suspend mddi_early_suspend; |
| 157 | struct early_suspend mddi_ext_early_suspend; |
| 158 | #endif |
| 159 | #endif |
| 160 | u32 mdp_fb_page_protection; |
| 161 | |
| 162 | struct clk *ebi1_clk; |
| 163 | boolean dma_update_flag; |
| 164 | struct timer_list msmfb_no_update_notify_timer; |
| 165 | struct completion msmfb_update_notify; |
| 166 | struct completion msmfb_no_update_notify; |
| Nagamalleswararao Ganji | 0737d65 | 2011-10-14 02:02:33 -0700 | [diff] [blame] | 167 | u32 ov_start, ov_end; |
| Vinay Kalia | 27020d1 | 2011-10-14 17:50:29 -0700 | [diff] [blame^] | 168 | |
| 169 | struct mutex writeback_mutex; |
| 170 | struct mutex unregister_mutex; |
| 171 | struct list_head writeback_busy_queue; |
| 172 | struct list_head writeback_free_queue; |
| 173 | struct list_head writeback_register_queue; |
| 174 | wait_queue_head_t wait_q; |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 175 | }; |
| 176 | |
| 177 | struct dentry *msm_fb_get_debugfs_root(void); |
| 178 | void msm_fb_debugfs_file_create(struct dentry *root, const char *name, |
| 179 | u32 *var); |
| 180 | void msm_fb_set_backlight(struct msm_fb_data_type *mfd, __u32 bkl_lvl); |
| 181 | |
| 182 | struct platform_device *msm_fb_add_device(struct platform_device *pdev); |
| Vinay Kalia | 27020d1 | 2011-10-14 17:50:29 -0700 | [diff] [blame^] | 183 | struct fb_info *msm_fb_get_writeback_fb(void); |
| 184 | int msm_fb_writeback_init(struct fb_info *info); |
| 185 | int msm_fb_writeback_register_buffer(struct fb_info *info, |
| 186 | struct msmfb_writeback_data *data); |
| 187 | int msm_fb_writeback_queue_buffer(struct fb_info *info, |
| 188 | struct msmfb_data *data); |
| 189 | int msm_fb_writeback_dequeue_buffer(struct fb_info *info, |
| 190 | struct msmfb_data *data); |
| 191 | int msm_fb_writeback_unregister_buffer(struct fb_info *info, |
| 192 | struct msmfb_writeback_data *data); |
| 193 | int msm_fb_writeback_terminate(struct fb_info *info); |
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 194 | int msm_fb_detect_client(const char *name); |
| 195 | |
| 196 | #ifdef CONFIG_FB_BACKLIGHT |
| 197 | void msm_fb_config_backlight(struct msm_fb_data_type *mfd); |
| 198 | #endif |
| 199 | |
| 200 | void fill_black_screen(void); |
| 201 | void unfill_black_screen(void); |
| 202 | |
| 203 | #endif /* MSM_FB_H */ |